qt: gdb: Do not change GDB settings when the gdbport arg is used (#2257)

This commit is contained in:
PabloMK7 2026-07-05 00:00:32 +02:00 committed by GitHub
parent 9a0f0e3caf
commit d61801ad76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 4 deletions

View File

@ -299,8 +299,7 @@ GMainWindow::GMainWindow(Core::System& system_)
if (i >= args.size() - 1 || args[i + 1].startsWith(QChar::fromLatin1('-'))) {
continue;
}
Settings::values.use_gdbstub = true;
Settings::values.gdbstub_port = strtoul(args[++i].toLatin1(), NULL, 0);
gdbport_from_arg = strtoul(args[++i].toLatin1(), NULL, 0);
continue;
}
@ -1526,6 +1525,13 @@ void GMainWindow::BootGame(const QString& filename) {
system.RegisterAppLoaderEarly(loader);
}
// Override GDB settings if emulator was launched with
// GDB port option.
if (gdbport_from_arg != -1) {
system.SetGDBPortOverride(gdbport_from_arg);
system.SetDebugNextProcessFlag();
}
system.ApplySettings();
Settings::LogSettings();

View File

@ -407,6 +407,8 @@ private:
// Whether game was paused due to stopping video dumping
bool game_paused_for_dumping = false;
int gdbport_from_arg = -1;
QString gl_renderer;
std::vector<QString> physical_devices;

View File

@ -762,8 +762,13 @@ void System::Reset() {
void System::ApplySettings() {
#ifdef ENABLE_GDBSTUB
GDBStub::SetServerPort(Settings::values.gdbstub_port.GetValue());
GDBStub::ToggleServer(Settings::values.use_gdbstub.GetValue());
if (override_gdb_port != -1) {
GDBStub::SetServerPort(override_gdb_port);
GDBStub::ToggleServer(true);
} else {
GDBStub::SetServerPort(Settings::values.gdbstub_port.GetValue());
GDBStub::ToggleServer(Settings::values.use_gdbstub.GetValue());
}
#endif
if (gpu) {

View File

@ -421,6 +421,10 @@ public:
void DebugUnscheduleAllThreadsFromFrontend(bool unschedule);
void SetGDBPortOverride(int port) {
override_gdb_port = port;
}
private:
/**
* Initialize the emulated system.
@ -531,6 +535,7 @@ private:
std::function<void()> info_led_color_changed;
bool debug_next_process;
int override_gdb_port = -1;
friend class boost::serialization::access;
template <typename Archive>