Debugger: Switch from NoThread when the emulation is running

And fix UpdateUnitList() when the emulation is stopped at initial startup.
This commit is contained in:
Eladash 2020-12-18 09:12:23 +02:00 committed by Ivan
parent 74a09a6338
commit 43c87e99b0
2 changed files with 12 additions and 5 deletions

View File

@ -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<std::weak_ptr<cpu_thread>>(
@ -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<named_thread<ppu_thread>>(on_select);
idm::select<named_thread<spu_thread>>(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();

View File

@ -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<char> m_last_query_state;
u32 m_last_step_over_breakpoint = -1;