2020-02-07 19:51:58 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <mesosphere/kern_common.hpp>
|
|
|
|
#include <mesosphere/kern_k_synchronization_object.hpp>
|
2020-07-19 03:03:27 +00:00
|
|
|
#include <mesosphere/kern_k_process.hpp>
|
|
|
|
#include <mesosphere/kern_k_event_info.hpp>
|
|
|
|
#include <mesosphere/kern_k_light_lock.hpp>
|
2020-02-07 19:51:58 +00:00
|
|
|
|
|
|
|
namespace ams::kern {
|
|
|
|
|
|
|
|
class KDebugBase : public KSynchronizationObject {
|
2020-07-19 03:03:27 +00:00
|
|
|
protected:
|
|
|
|
using DebugEventList = util::IntrusiveListBaseTraits<KEventInfo>::ListType;
|
|
|
|
private:
|
|
|
|
DebugEventList event_info_list;
|
|
|
|
u32 continue_flags;
|
|
|
|
KProcess *process;
|
|
|
|
KLightLock lock;
|
|
|
|
KProcess::State old_process_state;
|
2020-02-07 19:51:58 +00:00
|
|
|
public:
|
2020-07-19 03:03:27 +00:00
|
|
|
explicit KDebugBase() { /* ... */ }
|
|
|
|
virtual ~KDebugBase() { /* ... */ }
|
|
|
|
public:
|
|
|
|
void Initialize();
|
|
|
|
Result Attach(KProcess *process);
|
|
|
|
|
|
|
|
Result GetDebugEventInfo(ams::svc::lp64::DebugEventInfo *out);
|
|
|
|
Result GetDebugEventInfo(ams::svc::ilp32::DebugEventInfo *out);
|
|
|
|
|
2020-02-07 19:51:58 +00:00
|
|
|
/* TODO: This is a placeholder definition. */
|
2020-07-19 03:03:27 +00:00
|
|
|
private:
|
|
|
|
KScopedAutoObject<KProcess> GetProcess();
|
|
|
|
|
|
|
|
void PushDebugEvent(ams::svc::DebugEvent event, uintptr_t param0 = 0, uintptr_t param1 = 0, uintptr_t param2 = 0, uintptr_t param3 = 0, uintptr_t param4 = 0);
|
|
|
|
void EnqueueDebugEventInfo(KEventInfo *info);
|
|
|
|
public:
|
|
|
|
virtual void OnFinalizeSynchronizationObject() override;
|
|
|
|
virtual bool IsSignaled() const override;
|
|
|
|
public:
|
|
|
|
static KEventInfo *CreateDebugEvent(ams::svc::DebugEvent event, uintptr_t param0, uintptr_t param1, uintptr_t param2, uintptr_t param3, uintptr_t param4, u64 thread_id);
|
2020-02-07 19:51:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|