Skip to content

Commit 4ce8e9b

Browse files
MegamouseNekotekina
authored andcommitted
fix debugger o.O (RPCS3#2903)
* fix debugger o.O * minor simplification * how did I not see this the first time
1 parent 51ce8f6 commit 4ce8e9b

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

rpcs3/rpcs3qt/debugger_frame.cpp

+33-29
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ debugger_frame::debugger_frame(QWidget *parent) : QDockWidget(tr("Debugger"), pa
8888
});
8989
connect(m_choice_units, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &debugger_frame::UpdateUI);
9090
connect(m_choice_units, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &debugger_frame::OnSelectUnit);
91-
connect(m_choice_units, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), m_list, [=](int index) {
92-
m_list->m_noThreadSelected = m_choice_units->itemText(index) == NoThread ? true : false;
93-
});
9491
connect(this, &QDockWidget::visibilityChanged, this, &debugger_frame::EnableUpdateTimer);
9592

9693
m_list->ShowAddr(CentrePc(m_list->m_pc));
@@ -103,7 +100,6 @@ void debugger_frame::closeEvent(QCloseEvent *event)
103100
emit DebugFrameClosed();
104101
}
105102

106-
//static const int show_lines = 30;
107103
#include <map>
108104

109105
std::map<u32, bool> g_breakpoints;
@@ -137,6 +133,8 @@ void debugger_frame::UpdateUI()
137133
{
138134
UpdateUnitList();
139135

136+
if (m_noThreadSelected) return;
137+
140138
const auto cpu = this->cpu.lock();
141139

142140
if (!cpu)
@@ -228,37 +226,43 @@ void debugger_frame::UpdateUnitList()
228226

229227
void debugger_frame::OnSelectUnit()
230228
{
231-
if (m_choice_units->count() < 1 || m_current_choice == m_choice_units->currentText() || m_choice_units->currentText() == NoThread) return;
229+
if (m_choice_units->count() < 1 || m_current_choice == m_choice_units->currentText()) return;
232230

233231
m_current_choice = m_choice_units->currentText();
232+
m_noThreadSelected = m_current_choice == NoThread;
233+
m_list->m_noThreadSelected = m_noThreadSelected;
234234

235235
m_disasm.reset();
236+
cpu.reset();
236237

237-
const auto on_select = [&](u32, cpu_thread& cpu)
238+
if (!m_noThreadSelected)
238239
{
239-
cpu_thread* data = (cpu_thread *)m_choice_units->currentData().value<void *>();
240-
return data == &cpu;
241-
};
240+
const auto on_select = [&](u32, cpu_thread& cpu)
241+
{
242+
cpu_thread* data = (cpu_thread *)m_choice_units->currentData().value<void *>();
243+
return data == &cpu;
244+
};
242245

243-
if (auto ppu = idm::select<ppu_thread>(on_select))
244-
{
245-
m_disasm = std::make_unique<PPUDisAsm>(CPUDisAsm_InterpreterMode);
246-
cpu = ppu.ptr;
247-
}
248-
else if (auto spu1 = idm::select<SPUThread>(on_select))
249-
{
250-
m_disasm = std::make_unique<SPUDisAsm>(CPUDisAsm_InterpreterMode);
251-
cpu = spu1.ptr;
252-
}
253-
else if (auto rspu = idm::select<RawSPUThread>(on_select))
254-
{
255-
m_disasm = std::make_unique<SPUDisAsm>(CPUDisAsm_InterpreterMode);
256-
cpu = rspu.ptr;
257-
}
258-
else if (auto arm = idm::select<ARMv7Thread>(on_select))
259-
{
260-
m_disasm = std::make_unique<ARMv7DisAsm>(CPUDisAsm_InterpreterMode);
261-
cpu = arm.ptr;
246+
if (auto ppu = idm::select<ppu_thread>(on_select))
247+
{
248+
m_disasm = std::make_unique<PPUDisAsm>(CPUDisAsm_InterpreterMode);
249+
cpu = ppu.ptr;
250+
}
251+
else if (auto spu1 = idm::select<SPUThread>(on_select))
252+
{
253+
m_disasm = std::make_unique<SPUDisAsm>(CPUDisAsm_InterpreterMode);
254+
cpu = spu1.ptr;
255+
}
256+
else if (auto rspu = idm::select<RawSPUThread>(on_select))
257+
{
258+
m_disasm = std::make_unique<SPUDisAsm>(CPUDisAsm_InterpreterMode);
259+
cpu = rspu.ptr;
260+
}
261+
else if (auto arm = idm::select<ARMv7Thread>(on_select))
262+
{
263+
m_disasm = std::make_unique<ARMv7DisAsm>(CPUDisAsm_InterpreterMode);
264+
cpu = arm.ptr;
265+
}
262266
}
263267

264268
DoUpdate();
@@ -373,7 +377,7 @@ void debugger_frame::Show_Val()
373377

374378
void debugger_frame::Show_PC()
375379
{
376-
if (const auto cpu = this->cpu.lock()) m_list->ShowAddr(CentrePc(GetPc()));
380+
m_list->ShowAddr(CentrePc(GetPc()));
377381
}
378382

379383
void debugger_frame::DoStep()

0 commit comments

Comments
 (0)