Skip to content

Commit

Permalink
Handle debugger disconnect and reconnect properly
Browse files Browse the repository at this point in the history
When connecting the debugger the debugger variable was
being set to true before setting up the dbgMain and other related
function pointers. This caused the idle loop to attempt to call dbgMain
which was still NULL. This change makes sure that debugger isn't
set to true until all function pointers are set and that when disconnecting
the remotePort variable is reset back to 0 so we can reconnect properly.
  • Loading branch information
knightsc authored and rkitover committed Dec 5, 2018
1 parent 6ba3b77 commit a52eddb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wx/cmdevents.cpp
Expand Up @@ -1968,14 +1968,14 @@ void MainFrame::GDBBreak()

if (connected) {
remotePort = gdbPort;
debugger = true;
emulating = 1;
dbgMain = remoteStubMain;
dbgSignal = remoteStubSignal;
dbgOutput = remoteOutput;
cmd_enable &= ~(CMDEN_NGDB_ANY | CMDEN_NGDB_GBA);
cmd_enable |= CMDEN_GDB;
enable_menus();
debugger = true;
} else {
remoteCleanUp();
}
Expand Down Expand Up @@ -2004,6 +2004,7 @@ EVT_HANDLER_MASK(DebugGDBDisconnect, "Disconnect GDB", CMDEN_GDB)
dbgMain = NULL;
dbgSignal = NULL;
dbgOutput = NULL;
remotePort = 0;
remoteCleanUp();
cmd_enable &= ~CMDEN_GDB;
cmd_enable |= CMDEN_NGDB_GBA | CMDEN_NGDB_ANY;
Expand Down

0 comments on commit a52eddb

Please sign in to comment.