Delay GDB server launch until emulator run (#4658)

This commit is contained in:
Daniel Valentine 2018-06-08 08:34:27 -04:00 committed by Ani
parent 7b5dcd9d6a
commit fb20c27e7b
3 changed files with 10 additions and 3 deletions

View File

@ -338,6 +338,7 @@ bool GDBDebugServer::select_thread(u64 id)
selected_thread = ppu.ptr;
return true;
}
gdbDebugServer.warning("Unable to select thread! Is the emulator running?");
return false;
}

View File

@ -60,8 +60,8 @@ class GDBDebugServer : public named_thread {
void try_read_cmd(gdb_cmd& out_cmd);
//reads commands until receiveing one with valid checksum
//in case of other exception (i.e. wrong first char of command)
//it will log exception text and return false
//in that case best for caller would be to stop reading, because
//it will log exception text and return false
//in that case best for caller would be to stop reading, because
//chance of getting correct command is low
bool read_cmd(gdb_cmd& out_cmd);
//send cnt bytes from buf to client

View File

@ -263,8 +263,9 @@ void Emulator::Init()
fs::create_path(dev_usb);
#ifdef WITH_GDB_DEBUGGER
fxm::make<GDBDebugServer>();
LOG_SUCCESS(GENERAL, "GDB debug server will be started and listening on %d upon emulator boot", (int) g_cfg.misc.gdb_server_port);
#endif
// Initialize patch engine
fxm::make_always<patch_engine>()->append(fs::get_config_dir() + "/patch.yml");
@ -1136,6 +1137,11 @@ void Emulator::Run()
idm::select<ppu_thread>(on_select);
idm::select<RawSPUThread>(on_select);
idm::select<SPUThread>(on_select);
#ifdef WITH_GDB_DEBUGGER
// Initialize debug server at the end of emu run sequence
fxm::make<GDBDebugServer>();
#endif
}
bool Emulator::Pause()