make it possible to change gdb stub settings without destroying/recreating a NDS
This commit is contained in:
parent
99aa5676db
commit
0ea0af3abf
28
src/ARM.cpp
28
src/ARM.cpp
|
@ -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;
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
ARM(u32 num, bool jit, std::optional<GDBArgs> gdb, NDS& nds);
|
||||
virtual ~ARM(); // destroy shit
|
||||
|
||||
void SetGdbArgs(std::optional<GDBArgs> gdb);
|
||||
|
||||
virtual void Reset();
|
||||
|
||||
virtual void DoSavestate(Savestate* file);
|
||||
|
|
|
@ -227,6 +227,15 @@ void NDS::SetJITArgs(std::optional<JITArgs> args) noexcept
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
void NDS::SetGdbArgs(std::optional<GDBArgs> args) noexcept
|
||||
{
|
||||
ARM9.SetGdbArgs(args);
|
||||
ARM7.SetGdbArgs(args);
|
||||
EnableGDBStub = args.has_value();
|
||||
}
|
||||
#endif
|
||||
|
||||
void NDS::InitTimings()
|
||||
{
|
||||
// TODO, eventually:
|
||||
|
|
|
@ -476,6 +476,12 @@ public: // TODO: Encapsulate the rest of these members
|
|||
void SetJITArgs(std::optional<JITArgs> args) noexcept {}
|
||||
#endif
|
||||
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
void SetGdbArgs(std::optional<GDBArgs> args) noexcept;
|
||||
#else
|
||||
void SetGdbArgs(std::optional<GDBArgs> args) noexcept {}
|
||||
#endif
|
||||
|
||||
private:
|
||||
void InitTimings();
|
||||
u32 SchedListMask;
|
||||
|
|
|
@ -51,16 +51,17 @@ static int SocketSetBlocking(int fd, bool block)
|
|||
namespace Gdb
|
||||
{
|
||||
|
||||
GdbStub::GdbStub(StubCallbacks* cb, int port)
|
||||
: Cb(cb), Port(port)
|
||||
GdbStub::GdbStub(StubCallbacks* cb)
|
||||
: Cb(cb), Port(0)
|
||||
, SockFd(0), ConnFd(0)
|
||||
, Stat(TgtStatus::None), CurBkpt(0), CurWatchpt(0), StatFlag(false), NoAck(false)
|
||||
, ServerSA((void*)new struct sockaddr_in())
|
||||
, ClientSA((void*)new struct sockaddr_in())
|
||||
{ }
|
||||
|
||||
bool GdbStub::Init()
|
||||
bool GdbStub::Init(int port)
|
||||
{
|
||||
Port = port;
|
||||
Log(LogLevel::Info, "[GDB] initializing GDB stub for core %d on port %d\n",
|
||||
Cb->GetCPU(), Port);
|
||||
|
||||
|
|
|
@ -115,10 +115,10 @@ public:
|
|||
int kind;
|
||||
};
|
||||
|
||||
GdbStub(StubCallbacks* cb, int port);
|
||||
GdbStub(StubCallbacks* cb);
|
||||
~GdbStub();
|
||||
|
||||
bool Init();
|
||||
bool Init(int port);
|
||||
void Close();
|
||||
|
||||
StubState Poll(bool wait = false);
|
||||
|
|
|
@ -1362,7 +1362,7 @@ bool EmuInstance::updateConsole() noexcept
|
|||
nds->SetARM9BIOS(*args->ARM9BIOS);
|
||||
nds->SetFirmware(std::move(args->Firmware));
|
||||
nds->SetJITArgs(args->JIT);
|
||||
// TODO GDB stub shit
|
||||
nds->SetGdbArgs(args->GDB);
|
||||
nds->SPU.SetInterpolation(args->Interpolation);
|
||||
nds->SPU.SetDegrade10Bit(args->BitDepth);
|
||||
|
||||
|
|
Loading…
Reference in New Issue