Merge pull request #10336 from aldelaro5/gdb-stub-fix-first-packet
GDB Stub: do not send a packet when we just connected
This commit is contained in:
commit
4ee20368f8
|
@ -136,7 +136,8 @@ void Run()
|
||||||
state_lock.unlock();
|
state_lock.unlock();
|
||||||
if (GDBStub::IsActive() && GDBStub::HasControl())
|
if (GDBStub::IsActive() && GDBStub::HasControl())
|
||||||
{
|
{
|
||||||
GDBStub::SendSignal(GDBStub::Signal::Sigtrap);
|
if (!GDBStub::JustConnected())
|
||||||
|
GDBStub::SendSignal(GDBStub::Signal::Sigtrap);
|
||||||
GDBStub::ProcessCommands(true);
|
GDBStub::ProcessCommands(true);
|
||||||
// If we are still going to step, emulate the fact we just sent a step command
|
// If we are still going to step, emulate the fact we just sent a step command
|
||||||
if (GDBStub::HasControl())
|
if (GDBStub::HasControl())
|
||||||
|
|
|
@ -63,6 +63,7 @@ constexpr u32 NUM_BREAKPOINT_TYPES = 4;
|
||||||
const s64 GDB_UPDATE_CYCLES = 100000;
|
const s64 GDB_UPDATE_CYCLES = 100000;
|
||||||
|
|
||||||
static bool s_has_control = false;
|
static bool s_has_control = false;
|
||||||
|
static bool s_just_connected = false;
|
||||||
|
|
||||||
static int s_tmpsock = -1;
|
static int s_tmpsock = -1;
|
||||||
static int s_sock = -1;
|
static int s_sock = -1;
|
||||||
|
@ -901,6 +902,7 @@ static void HandleRemoveBreakpoint()
|
||||||
|
|
||||||
void ProcessCommands(bool loop_until_continue)
|
void ProcessCommands(bool loop_until_continue)
|
||||||
{
|
{
|
||||||
|
s_just_connected = false;
|
||||||
while (IsActive())
|
while (IsActive())
|
||||||
{
|
{
|
||||||
if (CPU::GetState() == CPU::State::PowerDown)
|
if (CPU::GetState() == CPU::State::PowerDown)
|
||||||
|
@ -1041,6 +1043,7 @@ static void InitGeneric(int domain, const sockaddr* server_addr, socklen_t serve
|
||||||
if (s_sock < 0)
|
if (s_sock < 0)
|
||||||
ERROR_LOG_FMT(GDB_STUB, "Failed to accept gdb client");
|
ERROR_LOG_FMT(GDB_STUB, "Failed to accept gdb client");
|
||||||
INFO_LOG_FMT(GDB_STUB, "Client connected.");
|
INFO_LOG_FMT(GDB_STUB, "Client connected.");
|
||||||
|
s_just_connected = true;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
closesocket(s_tmpsock);
|
closesocket(s_tmpsock);
|
||||||
|
@ -1086,6 +1089,11 @@ void TakeControl()
|
||||||
s_has_control = true;
|
s_has_control = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool JustConnected()
|
||||||
|
{
|
||||||
|
return s_just_connected;
|
||||||
|
}
|
||||||
|
|
||||||
void SendSignal(Signal signal)
|
void SendSignal(Signal signal)
|
||||||
{
|
{
|
||||||
char bfr[128] = {};
|
char bfr[128] = {};
|
||||||
|
|
|
@ -22,6 +22,7 @@ void Deinit();
|
||||||
bool IsActive();
|
bool IsActive();
|
||||||
bool HasControl();
|
bool HasControl();
|
||||||
void TakeControl();
|
void TakeControl();
|
||||||
|
bool JustConnected();
|
||||||
|
|
||||||
void ProcessCommands(bool loop_until_continue);
|
void ProcessCommands(bool loop_until_continue);
|
||||||
void SendSignal(Signal signal);
|
void SendSignal(Signal signal);
|
||||||
|
|
Loading…
Reference in New Issue