From 43c87e99b0316d4328b597ad50ff415ef42a73af Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 18 Dec 2020 09:12:23 +0200 Subject: [PATCH] Debugger: Switch from NoThread when the emulation is running And fix UpdateUnitList() when the emulation is stopped at initial startup. --- rpcs3/rpcs3qt/debugger_frame.cpp | 13 ++++++++++--- rpcs3/rpcs3qt/debugger_frame.h | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 8bd80b7a77..8a9e1330c8 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -420,11 +420,9 @@ void debugger_frame::UpdateUnitList() return; } + const int old_size = m_choice_units->count(); QVariant old_cpu = m_choice_units->currentData(); - m_choice_units->clear(); - m_choice_units->addItem(NoThreadString); - const auto on_select = [&](u32 id, cpu_thread& cpu) { QVariant var_cpu = QVariant::fromValue>( @@ -437,8 +435,17 @@ void debugger_frame::UpdateUnitList() { const QSignalBlocker blocker(m_choice_units); + m_choice_units->clear(); + m_choice_units->addItem(NoThreadString); + idm::select>(on_select); idm::select>(on_select); + + if (m_choice_units->count() > 1 && old_size <= 1) + { + // Select the first thread after "No Thread", usually the PPU main thread + m_choice_units->setCurrentIndex(1); + } } OnSelectUnit(); diff --git a/rpcs3/rpcs3qt/debugger_frame.h b/rpcs3/rpcs3qt/debugger_frame.h index 317ea23883..5f73d2e266 100644 --- a/rpcs3/rpcs3qt/debugger_frame.h +++ b/rpcs3/rpcs3qt/debugger_frame.h @@ -39,8 +39,8 @@ class debugger_frame : public custom_dock_widget QTimer* m_update; QSplitter* m_splitter; - u64 m_threads_created = 0; - u64 m_threads_deleted = 0; + u64 m_threads_created = -1; + u64 m_threads_deleted = -1; u32 m_last_pc = -1; std::vector m_last_query_state; u32 m_last_step_over_breakpoint = -1;