make it possible to change gdb stub settings without destroying/recreating a NDS

This commit is contained in:
Arisotura
2024-11-17 20:00:52 +01:00
parent 99aa5676db
commit 0ea0af3abf
7 changed files with 41 additions and 17 deletions

View File

@ -109,21 +109,13 @@ const u32 ARM::ConditionTable[16] =
ARM::ARM(u32 num, bool jit, std::optional<GDBArgs> gdb, melonDS::NDS& nds) :
#ifdef GDBSTUB_ENABLED
GdbStub(this, gdb ? (num ? gdb->PortARM7 : gdb->PortARM9) : 0),
BreakOnStartup(gdb ? (num ? gdb->ARM7BreakOnStartup : gdb->ARM9BreakOnStartup) : false),
GdbStub(this),
BreakOnStartup(false),
#endif
Num(num), // well uh
NDS(nds)
{
#ifdef GDBSTUB_ENABLED
if (gdb
#ifdef JIT_ENABLED
&& !jit // TODO: Should we support toggling the GdbStub without destroying the ARM?
#endif
)
GdbStub.Init();
IsSingleStep = false;
#endif
SetGdbArgs(jit ? gdb : std::nullopt);
}
ARM::~ARM()
@ -148,6 +140,20 @@ ARMv5::~ARMv5()
// DTCM is owned by Memory, not going to delete it
}
void ARM::SetGdbArgs(std::optional<GDBArgs> gdb)
{
#ifdef GDBSTUB_ENABLED
GdbStub.Close();
if (gdb)
{
int port = Num ? gdb->PortARM7 : gdb->PortARM9;
GdbStub.Init(port);
BreakOnStartup = Num ? gdb->ARM7BreakOnStartup : gdb->ARM9BreakOnStartup;
}
IsSingleStep = false;
#endif
}
void ARM::Reset()
{
Cycles = 0;