mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-22 07:00:06 +00:00
Merge pull request #5106 from GovanifY/master
gdbstub: Ensure gdbstub doesn't drop packets crucial to initialization
This commit is contained in:
commit
7afcc0d658
@ -308,7 +308,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
|
|||||||
|
|
||||||
HW::Init(*memory);
|
HW::Init(*memory);
|
||||||
Service::Init(*this);
|
Service::Init(*this);
|
||||||
GDBStub::Init();
|
GDBStub::DeferStart();
|
||||||
|
|
||||||
VideoCore::ResultStatus result = VideoCore::Init(emu_window, *memory);
|
VideoCore::ResultStatus result = VideoCore::Init(emu_window, *memory);
|
||||||
if (result != VideoCore::ResultStatus::Success) {
|
if (result != VideoCore::ResultStatus::Success) {
|
||||||
|
@ -121,6 +121,7 @@ constexpr char target_xml[] =
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
int gdbserver_socket = -1;
|
int gdbserver_socket = -1;
|
||||||
|
bool defer_start = false;
|
||||||
|
|
||||||
u8 command_buffer[GDB_BUFFER_SIZE];
|
u8 command_buffer[GDB_BUFFER_SIZE];
|
||||||
u32 command_length;
|
u32 command_length;
|
||||||
@ -1043,6 +1044,9 @@ static void RemoveBreakpoint() {
|
|||||||
|
|
||||||
void HandlePacket() {
|
void HandlePacket() {
|
||||||
if (!IsConnected()) {
|
if (!IsConnected()) {
|
||||||
|
if (defer_start) {
|
||||||
|
ToggleServer(true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1133,6 +1137,10 @@ void ToggleServer(bool status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeferStart() {
|
||||||
|
defer_start = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void Init(u16 port) {
|
static void Init(u16 port) {
|
||||||
if (!server_enabled) {
|
if (!server_enabled) {
|
||||||
// Set the halt loop to false in case the user enabled the gdbstub mid-execution.
|
// Set the halt loop to false in case the user enabled the gdbstub mid-execution.
|
||||||
@ -1216,6 +1224,7 @@ void Shutdown() {
|
|||||||
if (!server_enabled) {
|
if (!server_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
defer_start = false;
|
||||||
|
|
||||||
LOG_INFO(Debug_GDBStub, "Stopping GDB ...");
|
LOG_INFO(Debug_GDBStub, "Stopping GDB ...");
|
||||||
if (gdbserver_socket != -1) {
|
if (gdbserver_socket != -1) {
|
||||||
|
@ -42,6 +42,13 @@ void ToggleServer(bool status);
|
|||||||
/// Start the gdbstub server.
|
/// Start the gdbstub server.
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defer initialization of the gdbstub to the first packet processing functions.
|
||||||
|
* This avoids a case where the gdbstub thread is frozen after initialization
|
||||||
|
* and fails to respond in time to packets.
|
||||||
|
*/
|
||||||
|
void DeferStart();
|
||||||
|
|
||||||
/// Stop gdbstub server.
|
/// Stop gdbstub server.
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user