mirror of https://github.com/PCSX2/pcsx2.git
Debugger: Fixes crash on debugger open when cpu not alive
The debugger was crashing on open if no game was running due to failing to read from the CPU while the cpu was not alive. The opcode was read before checking if it should be shown, so I have moved it to only read if the showOpcode boolean is true, and set it to not show opcodes of the cpu is not alive.
This commit is contained in:
parent
78b6323272
commit
f00f0cc846
|
@ -746,12 +746,12 @@ inline QString DisassemblyWidget::DisassemblyStringFromAddress(u32 address, QFon
|
|||
const bool isCurrentPC = m_cpu->getPC() == address;
|
||||
|
||||
const std::string addressSymbol = m_cpu->GetSymbolMap().GetLabelName(address);
|
||||
const u32 opcode = m_cpu->read32(address);
|
||||
|
||||
const auto demangler = demangler::CDemangler::createGcc();
|
||||
const bool showOpcode = m_showInstructionOpcode && m_cpu->isAlive();
|
||||
|
||||
QString lineString;
|
||||
if (m_showInstructionOpcode)
|
||||
if (showOpcode)
|
||||
{
|
||||
lineString = QString(" %1 %2 %3 %4 %5 %6");
|
||||
}
|
||||
|
@ -783,8 +783,11 @@ inline QString DisassemblyWidget::DisassemblyStringFromAddress(u32 address, QFon
|
|||
lineString = lineString.arg(metric.elidedText(symbolString, Qt::ElideRight, (selected ? 32.0f : 7.5f) * font.pointSize()));
|
||||
}
|
||||
|
||||
if (m_showInstructionOpcode)
|
||||
if (showOpcode)
|
||||
{
|
||||
const u32 opcode = m_cpu->read32(address);
|
||||
lineString = lineString.arg(QtUtils::FilledQStringFromValue(opcode, 16));
|
||||
}
|
||||
|
||||
lineString = lineString.leftJustified(4, ' ') // Address / symbol
|
||||
.arg(line.name.c_str())
|
||||
|
|
Loading…
Reference in New Issue