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) :
|
ARM::ARM(u32 num, bool jit, std::optional<GDBArgs> gdb, melonDS::NDS& nds) :
|
||||||
#ifdef GDBSTUB_ENABLED
|
#ifdef GDBSTUB_ENABLED
|
||||||
GdbStub(this, gdb ? (num ? gdb->PortARM7 : gdb->PortARM9) : 0),
|
GdbStub(this),
|
||||||
BreakOnStartup(gdb ? (num ? gdb->ARM7BreakOnStartup : gdb->ARM9BreakOnStartup) : false),
|
BreakOnStartup(false),
|
||||||
#endif
|
#endif
|
||||||
Num(num), // well uh
|
Num(num), // well uh
|
||||||
NDS(nds)
|
NDS(nds)
|
||||||
{
|
{
|
||||||
#ifdef GDBSTUB_ENABLED
|
SetGdbArgs(jit ? gdb : std::nullopt);
|
||||||
if (gdb
|
|
||||||
#ifdef JIT_ENABLED
|
|
||||||
&& !jit // TODO: Should we support toggling the GdbStub without destroying the ARM?
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
GdbStub.Init();
|
|
||||||
IsSingleStep = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM::~ARM()
|
ARM::~ARM()
|
||||||
|
@ -148,6 +140,20 @@ ARMv5::~ARMv5()
|
||||||
// DTCM is owned by Memory, not going to delete it
|
// 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()
|
void ARM::Reset()
|
||||||
{
|
{
|
||||||
Cycles = 0;
|
Cycles = 0;
|
||||||
|
|
|
@ -68,6 +68,8 @@ public:
|
||||||
ARM(u32 num, bool jit, std::optional<GDBArgs> gdb, NDS& nds);
|
ARM(u32 num, bool jit, std::optional<GDBArgs> gdb, NDS& nds);
|
||||||
virtual ~ARM(); // destroy shit
|
virtual ~ARM(); // destroy shit
|
||||||
|
|
||||||
|
void SetGdbArgs(std::optional<GDBArgs> gdb);
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
virtual void DoSavestate(Savestate* file);
|
virtual void DoSavestate(Savestate* file);
|
||||||
|
|
|
@ -227,6 +227,15 @@ void NDS::SetJITArgs(std::optional<JITArgs> args) noexcept
|
||||||
}
|
}
|
||||||
#endif
|
#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()
|
void NDS::InitTimings()
|
||||||
{
|
{
|
||||||
// TODO, eventually:
|
// TODO, eventually:
|
||||||
|
|
|
@ -476,6 +476,12 @@ public: // TODO: Encapsulate the rest of these members
|
||||||
void SetJITArgs(std::optional<JITArgs> args) noexcept {}
|
void SetJITArgs(std::optional<JITArgs> args) noexcept {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GDBSTUB_ENABLED
|
||||||
|
void SetGdbArgs(std::optional<GDBArgs> args) noexcept;
|
||||||
|
#else
|
||||||
|
void SetGdbArgs(std::optional<GDBArgs> args) noexcept {}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitTimings();
|
void InitTimings();
|
||||||
u32 SchedListMask;
|
u32 SchedListMask;
|
||||||
|
|
|
@ -51,16 +51,17 @@ static int SocketSetBlocking(int fd, bool block)
|
||||||
namespace Gdb
|
namespace Gdb
|
||||||
{
|
{
|
||||||
|
|
||||||
GdbStub::GdbStub(StubCallbacks* cb, int port)
|
GdbStub::GdbStub(StubCallbacks* cb)
|
||||||
: Cb(cb), Port(port)
|
: Cb(cb), Port(0)
|
||||||
, SockFd(0), ConnFd(0)
|
, SockFd(0), ConnFd(0)
|
||||||
, Stat(TgtStatus::None), CurBkpt(0), CurWatchpt(0), StatFlag(false), NoAck(false)
|
, Stat(TgtStatus::None), CurBkpt(0), CurWatchpt(0), StatFlag(false), NoAck(false)
|
||||||
, ServerSA((void*)new struct sockaddr_in())
|
, ServerSA((void*)new struct sockaddr_in())
|
||||||
, ClientSA((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",
|
Log(LogLevel::Info, "[GDB] initializing GDB stub for core %d on port %d\n",
|
||||||
Cb->GetCPU(), Port);
|
Cb->GetCPU(), Port);
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,10 @@ public:
|
||||||
int kind;
|
int kind;
|
||||||
};
|
};
|
||||||
|
|
||||||
GdbStub(StubCallbacks* cb, int port);
|
GdbStub(StubCallbacks* cb);
|
||||||
~GdbStub();
|
~GdbStub();
|
||||||
|
|
||||||
bool Init();
|
bool Init(int port);
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
StubState Poll(bool wait = false);
|
StubState Poll(bool wait = false);
|
||||||
|
|
|
@ -1362,7 +1362,7 @@ bool EmuInstance::updateConsole() noexcept
|
||||||
nds->SetARM9BIOS(*args->ARM9BIOS);
|
nds->SetARM9BIOS(*args->ARM9BIOS);
|
||||||
nds->SetFirmware(std::move(args->Firmware));
|
nds->SetFirmware(std::move(args->Firmware));
|
||||||
nds->SetJITArgs(args->JIT);
|
nds->SetJITArgs(args->JIT);
|
||||||
// TODO GDB stub shit
|
nds->SetGdbArgs(args->GDB);
|
||||||
nds->SPU.SetInterpolation(args->Interpolation);
|
nds->SPU.SetInterpolation(args->Interpolation);
|
||||||
nds->SPU.SetDegrade10Bit(args->BitDepth);
|
nds->SPU.SetDegrade10Bit(args->BitDepth);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue