mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 21:24:11 -04:00
dmnt: refactor to use process accessor
This commit is contained in:
parent
c6fad1b0ee
commit
1401f3520e
7 changed files with 785 additions and 205 deletions
|
@ -16,6 +16,8 @@
|
|||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
#include "dmnt2_gdb_packet_io.hpp"
|
||||
#include "dmnt2_gdb_signal.hpp"
|
||||
#include "dmnt2_debug_process.hpp"
|
||||
|
||||
namespace ams::dmnt {
|
||||
|
||||
|
@ -27,19 +29,6 @@ namespace ams::dmnt {
|
|||
Exited,
|
||||
Destroyed,
|
||||
};
|
||||
|
||||
enum GdbSignal {
|
||||
GdbSignal_Signal0 = 0,
|
||||
GdbSignal_Interrupt = 2,
|
||||
GdbSignal_IllegalInstruction = 4,
|
||||
GdbSignal_BreakpointTrap = 5,
|
||||
GdbSignal_EmulationTrap = 7,
|
||||
GdbSignal_ArithmeticException = 8,
|
||||
GdbSignal_Killed = 9,
|
||||
GdbSignal_BusError = 10,
|
||||
GdbSignal_SegmentationFault = 11,
|
||||
GdbSignal_BadSystemCall = 12,
|
||||
};
|
||||
private:
|
||||
int m_socket;
|
||||
HtcsSession m_session;
|
||||
|
@ -48,14 +37,10 @@ namespace ams::dmnt {
|
|||
char *m_reply_packet{nullptr};
|
||||
char m_buffer[GdbPacketBufferSize / 2];
|
||||
bool m_killed{false};
|
||||
svc::Handle m_debug_handle{svc::InvalidHandle};
|
||||
os::ThreadType m_events_thread;
|
||||
State m_state;
|
||||
bool m_attached{false};
|
||||
u64 m_thread_id{0};
|
||||
DebugProcess m_debug_process;
|
||||
os::ProcessId m_process_id{os::InvalidProcessId};
|
||||
os::ProcessId m_target_process_id{os::InvalidProcessId};
|
||||
svc::DebugInfoCreateProcess m_create_process_info;
|
||||
os::Event m_event;
|
||||
public:
|
||||
GdbServerImpl(int socket, void *thread_stack, size_t stack_size);
|
||||
|
@ -68,9 +53,9 @@ namespace ams::dmnt {
|
|||
void SendPacket(bool *out_break, const char *src) { return m_packet_io.SendPacket(out_break, src, std::addressof(m_session)); }
|
||||
char *ReceivePacket(bool *out_break, char *dst, size_t size) { return m_packet_io.ReceivePacket(out_break, dst, size, std::addressof(m_session)); }
|
||||
private:
|
||||
bool HasDebugProcess() const { return m_debug_handle != svc::InvalidHandle; }
|
||||
bool Is64Bit() const { return (m_create_process_info.flags & svc::CreateProcessFlag_Is64Bit) == svc::CreateProcessFlag_Is64Bit; }
|
||||
bool Is64BitAddressSpace() const { return (m_create_process_info.flags & svc::CreateProcessFlag_AddressSpaceMask) == svc::CreateProcessFlag_AddressSpace64Bit; }
|
||||
bool HasDebugProcess() const { return m_debug_process.IsValid(); }
|
||||
bool Is64Bit() const { return m_debug_process.Is64Bit(); }
|
||||
bool Is64BitAddressSpace() const { return m_debug_process.Is64BitAddressSpace(); }
|
||||
private:
|
||||
static void DebugEventsThreadEntry(void *arg) { static_cast<GdbServerImpl *>(arg)->DebugEventsThread(); }
|
||||
void DebugEventsThread();
|
||||
|
@ -95,6 +80,7 @@ namespace ams::dmnt {
|
|||
void qSupported();
|
||||
void qXfer();
|
||||
void qXferFeaturesRead();
|
||||
void qXferLibrariesRead();
|
||||
void qXferOsdataRead();
|
||||
bool qXferThreadsRead();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue