mirror of https://github.com/PCSX2/pcsx2.git
Debugger: Stub the current opcode if no function is selected
This commit is contained in:
parent
ebe6d3cbee
commit
93776707a9
|
@ -292,9 +292,14 @@ void DisassemblyWidget::contextStubFunction()
|
||||||
QtHost::RunOnUIThread([this] { VMUpdate(); });
|
QtHost::RunOnUIThread([this] { VMUpdate(); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else // Stub the current opcode instead
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Stub Function Error"), tr("No function / symbol is currently selected."));
|
Host::RunOnCPUThread([this, cpu = m_cpu] {
|
||||||
|
this->m_stubbedFunctions.insert({m_selectedAddressStart, {cpu->read32(m_selectedAddressStart), cpu->read32(m_selectedAddressStart + 4)}});
|
||||||
|
cpu->write32(m_selectedAddressStart, 0x03E00008); // jr $ra
|
||||||
|
cpu->write32(m_selectedAddressStart + 4, 0x00000000); // nop
|
||||||
|
QtHost::RunOnUIThread([this] { VMUpdate(); });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,9 +315,18 @@ void DisassemblyWidget::contextRestoreFunction()
|
||||||
QtHost::RunOnUIThread([this] { VMUpdate(); });
|
QtHost::RunOnUIThread([this] { VMUpdate(); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (m_stubbedFunctions.find(m_selectedAddressStart) != m_stubbedFunctions.end())
|
||||||
|
{
|
||||||
|
Host::RunOnCPUThread([this, cpu = m_cpu] {
|
||||||
|
cpu->write32(m_selectedAddressStart, std::get<0>(this->m_stubbedFunctions[m_selectedAddressStart]));
|
||||||
|
cpu->write32(m_selectedAddressStart + 4, std::get<1>(this->m_stubbedFunctions[m_selectedAddressStart]));
|
||||||
|
this->m_stubbedFunctions.erase(m_selectedAddressStart);
|
||||||
|
QtHost::RunOnUIThread([this] { VMUpdate(); });
|
||||||
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Restore Function Error"), tr("No function / symbol is currently selected."));
|
QMessageBox::warning(this, tr("Restore Function Error"), tr("Unable to stub selected address."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisassemblyWidget::SetCpu(DebugInterface* cpu)
|
void DisassemblyWidget::SetCpu(DebugInterface* cpu)
|
||||||
|
@ -848,5 +862,12 @@ bool DisassemblyWidget::FunctionCanRestore(u32 address)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_stubbedFunctions.find(address) != this->m_stubbedFunctions.end())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue