mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-22 12:35:21 +00:00
prevent debugger crash when no thread is selected
This commit is contained in:
parent
bb464b0b64
commit
6fe615605a
1 changed files with 18 additions and 12 deletions
|
@ -54,7 +54,7 @@ debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *
|
|||
m_btn_step_over = new QPushButton(tr("Step Over"), this);
|
||||
m_btn_run = new QPushButton(RunString, this);
|
||||
|
||||
EnableButtons(!Emu.IsStopped());
|
||||
EnableButtons(false);
|
||||
|
||||
ChangeColors();
|
||||
|
||||
|
@ -198,7 +198,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event)
|
|||
const auto cpu = this->cpu.lock();
|
||||
int i = m_debugger_list->currentRow();
|
||||
|
||||
if (!isActiveWindow() || i < 0 || !cpu)
|
||||
if (!isActiveWindow() || i < 0 || !cpu || m_no_thread_selected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -248,7 +248,6 @@ void debugger_frame::keyPressEvent(QKeyEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
u32 debugger_frame::GetPc() const
|
||||
{
|
||||
const auto cpu = this->cpu.lock();
|
||||
|
@ -276,11 +275,11 @@ void debugger_frame::UpdateUI()
|
|||
m_last_pc = -1;
|
||||
m_last_stat = 0;
|
||||
DoUpdate();
|
||||
|
||||
m_btn_run->setEnabled(false);
|
||||
m_btn_step->setEnabled(false);
|
||||
m_btn_step_over->setEnabled(false);
|
||||
}
|
||||
|
||||
m_btn_run->setEnabled(false);
|
||||
m_btn_step->setEnabled(false);
|
||||
m_btn_step_over->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -380,9 +379,12 @@ void debugger_frame::OnSelectUnit()
|
|||
}
|
||||
}
|
||||
|
||||
EnableButtons(!m_no_thread_selected);
|
||||
|
||||
m_debugger_list->UpdateCPUData(this->cpu, m_disasm);
|
||||
m_breakpoint_list->UpdateCPUData(this->cpu, m_disasm);
|
||||
DoUpdate();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
void debugger_frame::DoUpdate()
|
||||
|
@ -460,7 +462,7 @@ void debugger_frame::ShowGotoAddressDialog()
|
|||
if (cpu)
|
||||
{
|
||||
unsigned long pc = cpu ? GetPc() : 0x0;
|
||||
address_preview_label->setText("Address: " + QString("0x%1").arg(pc, 8, 16, QChar('0')));
|
||||
address_preview_label->setText(QString("Address: 0x%1").arg(pc, 8, 16, QChar('0')));
|
||||
expression_input->setPlaceholderText(QString("0x%1").arg(pc, 8, 16, QChar('0')));
|
||||
}
|
||||
else
|
||||
|
@ -469,16 +471,16 @@ void debugger_frame::ShowGotoAddressDialog()
|
|||
address_preview_label->setText("Address: 0x00000000");
|
||||
}
|
||||
|
||||
auto l_changeLabel = [=]()
|
||||
auto l_changeLabel = [&](const QString& text)
|
||||
{
|
||||
if (expression_input->text().isEmpty())
|
||||
if (text.isEmpty())
|
||||
{
|
||||
address_preview_label->setText("Address: " + expression_input->placeholderText());
|
||||
}
|
||||
else
|
||||
{
|
||||
ulong ul_addr = EvaluateExpression(expression_input->text());
|
||||
address_preview_label->setText("Address: " + QString("0x%1").arg(ul_addr, 8, 16, QChar('0')));
|
||||
ulong ul_addr = EvaluateExpression(text);
|
||||
address_preview_label->setText(QString("Address: 0x%1").arg(ul_addr, 8, 16, QChar('0')));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -512,6 +514,8 @@ u64 debugger_frame::EvaluateExpression(const QString& expression)
|
|||
{
|
||||
auto thread = cpu.lock();
|
||||
|
||||
if (!thread) return 0;
|
||||
|
||||
// Parse expression
|
||||
QJSEngine scriptEngine;
|
||||
scriptEngine.globalObject().setProperty("pc", GetPc());
|
||||
|
@ -604,6 +608,8 @@ void debugger_frame::EnableUpdateTimer(bool enable)
|
|||
|
||||
void debugger_frame::EnableButtons(bool enable)
|
||||
{
|
||||
if (m_no_thread_selected) enable = false;
|
||||
|
||||
m_go_to_addr->setEnabled(enable);
|
||||
m_go_to_pc->setEnabled(enable);
|
||||
m_btn_step->setEnabled(enable);
|
||||
|
|
Loading…
Add table
Reference in a new issue