summaryrefslogtreecommitdiff
path: root/src/core/gdbstub/gdbstub.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
-rw-r--r--src/core/gdbstub/gdbstub.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index e8d8871a7..6ee4df6b5 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -141,6 +141,7 @@ constexpr char target_xml[] =
141)"; 141)";
142 142
143int gdbserver_socket = -1; 143int gdbserver_socket = -1;
144bool defer_start = false;
144 145
145u8 command_buffer[GDB_BUFFER_SIZE]; 146u8 command_buffer[GDB_BUFFER_SIZE];
146u32 command_length; 147u32 command_length;
@@ -1165,7 +1166,8 @@ static void RemoveBreakpoint() {
1165} 1166}
1166 1167
1167void HandlePacket() { 1168void HandlePacket() {
1168 if (!IsConnected()) { 1169 if (!IsConnected() && defer_start) {
1170 ToggleServer(true);
1169 return; 1171 return;
1170 } 1172 }
1171 1173
@@ -1256,6 +1258,10 @@ void ToggleServer(bool status) {
1256 } 1258 }
1257} 1259}
1258 1260
1261void DeferStart() {
1262 defer_start = true;
1263}
1264
1259static void Init(u16 port) { 1265static void Init(u16 port) {
1260 if (!server_enabled) { 1266 if (!server_enabled) {
1261 // Set the halt loop to false in case the user enabled the gdbstub mid-execution. 1267 // Set the halt loop to false in case the user enabled the gdbstub mid-execution.
@@ -1341,6 +1347,7 @@ void Shutdown() {
1341 if (!server_enabled) { 1347 if (!server_enabled) {
1342 return; 1348 return;
1343 } 1349 }
1350 defer_start = false;
1344 1351
1345 LOG_INFO(Debug_GDBStub, "Stopping GDB ..."); 1352 LOG_INFO(Debug_GDBStub, "Stopping GDB ...");
1346 if (gdbserver_socket != -1) { 1353 if (gdbserver_socket != -1) {