Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDBServer fixes #3592

Closed
wants to merge 10 commits into from
14 changes: 13 additions & 1 deletion Source/Tools/LinuxEmulation/LinuxSyscalls/GdbServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ void GdbServer::Break(int signal) {
SendPacket(*CommsStream, str);
}

void GdbServer::BreakThread(FEXCore::Core::InternalThreadState* Thread, int signal) {
std::lock_guard lk(sendMutex);
if (!CommsStream) {
return;
}

const fextl::string str = fextl::fmt::format("T{:02x}thread:{:x};", signal, Thread->ThreadManager.GetTID());
SendPacket(*CommsStream, str);
// Current debugging thread switches to the thread that is breaking.
CurrentDebuggingThread = Thread->ThreadManager.GetTID();
}

void GdbServer::WaitForThreadWakeup() {
// Wait for gdbserver to tell us to wake up
ThreadBreakEvent.Wait();
Expand Down Expand Up @@ -144,7 +156,7 @@ GdbServer::GdbServer(FEXCore::Context::Context* ctx, FEX::HLE::SignalDelegator*
}

// Let GDB know that we have a signal
this->Break(Signal);
this->BreakThread(Thread, Signal);

WaitForThreadWakeup();

Expand Down
1 change: 1 addition & 0 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/GdbServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class GdbServer {

private:
void Break(int signal);
void BreakThread(FEXCore::Core::InternalThreadState* Thread, int signal);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between this and Break?


void OpenListenSocket();
void CloseListenSocket();
Expand Down