mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2025-08-04 23:42:33 -07:00
core/debugger: Implement new GDB stub debugger
This commit is contained in:
@@ -50,6 +50,7 @@ void EmuThread::run() {
|
||||
|
||||
auto& gpu = system.GPU();
|
||||
auto stop_token = stop_source.get_token();
|
||||
bool debugger_should_start = system.DebuggerEnabled();
|
||||
|
||||
system.RegisterHostThread();
|
||||
|
||||
@@ -89,6 +90,12 @@ void EmuThread::run() {
|
||||
this->SetRunning(false);
|
||||
emit ErrorThrown(result, system.GetStatusDetails());
|
||||
}
|
||||
|
||||
if (debugger_should_start) {
|
||||
system.InitializeDebugger();
|
||||
debugger_should_start = false;
|
||||
}
|
||||
|
||||
running_wait.Wait();
|
||||
result = system.Pause();
|
||||
if (result != Core::SystemResultStatus::Success) {
|
||||
@@ -102,11 +109,9 @@ void EmuThread::run() {
|
||||
was_active = true;
|
||||
emit DebugModeEntered();
|
||||
}
|
||||
} else if (exec_step) {
|
||||
UNIMPLEMENTED();
|
||||
} else {
|
||||
std::unique_lock lock{running_mutex};
|
||||
running_cv.wait(lock, stop_token, [this] { return IsRunning() || exec_step; });
|
||||
running_cv.wait(lock, stop_token, [this] { return IsRunning(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,15 +54,6 @@ public:
|
||||
*/
|
||||
void run() override;
|
||||
|
||||
/**
|
||||
* Steps the emulation thread by a single CPU instruction (if the CPU is not already running)
|
||||
* @note This function is thread-safe
|
||||
*/
|
||||
void ExecStep() {
|
||||
exec_step = true;
|
||||
running_cv.notify_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the emulation thread is running or not
|
||||
* @param running Boolean value, set the emulation thread to running if true
|
||||
@@ -99,7 +90,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool exec_step = false;
|
||||
bool running = false;
|
||||
std::stop_source stop_source;
|
||||
std::mutex running_mutex;
|
||||
|
@@ -525,6 +525,9 @@ void Config::ReadDebuggingValues() {
|
||||
// Intentionally not using the QT default setting as this is intended to be changed in the ini
|
||||
Settings::values.record_frame_times =
|
||||
qt_config->value(QStringLiteral("record_frame_times"), false).toBool();
|
||||
|
||||
ReadBasicSetting(Settings::values.use_gdbstub);
|
||||
ReadBasicSetting(Settings::values.gdbstub_port);
|
||||
ReadBasicSetting(Settings::values.program_args);
|
||||
ReadBasicSetting(Settings::values.dump_exefs);
|
||||
ReadBasicSetting(Settings::values.dump_nso);
|
||||
@@ -1095,6 +1098,8 @@ void Config::SaveDebuggingValues() {
|
||||
|
||||
// Intentionally not using the QT default setting as this is intended to be changed in the ini
|
||||
qt_config->setValue(QStringLiteral("record_frame_times"), Settings::values.record_frame_times);
|
||||
WriteBasicSetting(Settings::values.use_gdbstub);
|
||||
WriteBasicSetting(Settings::values.gdbstub_port);
|
||||
WriteBasicSetting(Settings::values.program_args);
|
||||
WriteBasicSetting(Settings::values.dump_exefs);
|
||||
WriteBasicSetting(Settings::values.dump_nso);
|
||||
|
@@ -24,13 +24,18 @@ ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent)
|
||||
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LogDir));
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||
});
|
||||
|
||||
connect(ui->toggle_gdbstub, &QCheckBox::toggled,
|
||||
[&]() { ui->gdbport_spinbox->setEnabled(ui->toggle_gdbstub->isChecked()); });
|
||||
}
|
||||
|
||||
ConfigureDebug::~ConfigureDebug() = default;
|
||||
|
||||
void ConfigureDebug::SetConfiguration() {
|
||||
const bool runtime_lock = !system.IsPoweredOn();
|
||||
|
||||
ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub.GetValue());
|
||||
ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub.GetValue());
|
||||
ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port.GetValue());
|
||||
ui->toggle_console->setEnabled(runtime_lock);
|
||||
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
|
||||
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
|
||||
@@ -71,6 +76,8 @@ void ConfigureDebug::SetConfiguration() {
|
||||
}
|
||||
|
||||
void ConfigureDebug::ApplyConfiguration() {
|
||||
Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked();
|
||||
Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
|
||||
UISettings::values.show_console = ui->toggle_console->isChecked();
|
||||
Settings::values.log_filter = ui->log_filter_edit->text().toStdString();
|
||||
Settings::values.program_args = ui->homebrew_args_edit->text().toStdString();
|
||||
|
@@ -3,6 +3,60 @@
|
||||
<class>ConfigureDebug</class>
|
||||
<widget class="QWidget" name="ConfigureDebug">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Debugger</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="toggle_gdbstub">
|
||||
<property name="text">
|
||||
<string>Enable GDB Stub</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="gdbport_spinbox">
|
||||
<property name="minimum">
|
||||
<number>1024</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
|
@@ -3152,7 +3152,7 @@ void GMainWindow::OnTasStateChanged() {
|
||||
}
|
||||
|
||||
void GMainWindow::UpdateStatusBar() {
|
||||
if (emu_thread == nullptr) {
|
||||
if (emu_thread == nullptr || !system->IsPoweredOn()) {
|
||||
status_bar_update_timer.stop();
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user