From 4ce8e9ba16c7b1c500910cd77bd7e6e4bc7e1393 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 23 Jun 2017 14:08:38 +0200 Subject: [PATCH] fix debugger o.O (#2903) * fix debugger o.O * minor simplification * how did I not see this the first time --- rpcs3/rpcs3qt/debugger_frame.cpp | 62 +++++++++++++++++--------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index e9d0044bf4..68c18b847f 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -88,9 +88,6 @@ debugger_frame::debugger_frame(QWidget *parent) : QDockWidget(tr("Debugger"), pa }); connect(m_choice_units, static_cast(&QComboBox::activated), this, &debugger_frame::UpdateUI); connect(m_choice_units, static_cast(&QComboBox::currentIndexChanged), this, &debugger_frame::OnSelectUnit); - connect(m_choice_units, static_cast(&QComboBox::currentIndexChanged), m_list, [=](int index) { - m_list->m_noThreadSelected = m_choice_units->itemText(index) == NoThread ? true : false; - }); connect(this, &QDockWidget::visibilityChanged, this, &debugger_frame::EnableUpdateTimer); m_list->ShowAddr(CentrePc(m_list->m_pc)); @@ -103,7 +100,6 @@ void debugger_frame::closeEvent(QCloseEvent *event) emit DebugFrameClosed(); } -//static const int show_lines = 30; #include std::map g_breakpoints; @@ -137,6 +133,8 @@ void debugger_frame::UpdateUI() { UpdateUnitList(); + if (m_noThreadSelected) return; + const auto cpu = this->cpu.lock(); if (!cpu) @@ -228,37 +226,43 @@ void debugger_frame::UpdateUnitList() void debugger_frame::OnSelectUnit() { - if (m_choice_units->count() < 1 || m_current_choice == m_choice_units->currentText() || m_choice_units->currentText() == NoThread) return; + if (m_choice_units->count() < 1 || m_current_choice == m_choice_units->currentText()) return; m_current_choice = m_choice_units->currentText(); + m_noThreadSelected = m_current_choice == NoThread; + m_list->m_noThreadSelected = m_noThreadSelected; m_disasm.reset(); + cpu.reset(); - const auto on_select = [&](u32, cpu_thread& cpu) + if (!m_noThreadSelected) { - cpu_thread* data = (cpu_thread *)m_choice_units->currentData().value(); - return data == &cpu; - }; + const auto on_select = [&](u32, cpu_thread& cpu) + { + cpu_thread* data = (cpu_thread *)m_choice_units->currentData().value(); + return data == &cpu; + }; - if (auto ppu = idm::select(on_select)) - { - m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); - cpu = ppu.ptr; - } - else if (auto spu1 = idm::select(on_select)) - { - m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); - cpu = spu1.ptr; - } - else if (auto rspu = idm::select(on_select)) - { - m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); - cpu = rspu.ptr; - } - else if (auto arm = idm::select(on_select)) - { - m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); - cpu = arm.ptr; + if (auto ppu = idm::select(on_select)) + { + m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); + cpu = ppu.ptr; + } + else if (auto spu1 = idm::select(on_select)) + { + m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); + cpu = spu1.ptr; + } + else if (auto rspu = idm::select(on_select)) + { + m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); + cpu = rspu.ptr; + } + else if (auto arm = idm::select(on_select)) + { + m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); + cpu = arm.ptr; + } } DoUpdate(); @@ -373,7 +377,7 @@ void debugger_frame::Show_Val() void debugger_frame::Show_PC() { - if (const auto cpu = this->cpu.lock()) m_list->ShowAddr(CentrePc(GetPc())); + m_list->ShowAddr(CentrePc(GetPc())); } void debugger_frame::DoStep()