mirror of https://github.com/PCSX2/pcsx2.git
Debugger: Implement stubbing (noping) functions
This commit is contained in:
parent
55c9cb45ac
commit
4269f16bcd
|
@ -83,6 +83,8 @@ void DisassemblyWidget::CreateCustomContextMenu()
|
|||
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRenameFunction);
|
||||
m_contextMenu->addAction(action = new QAction(tr("Remove Function"), this));
|
||||
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRemoveFunction);
|
||||
m_contextMenu->addAction(action = new QAction(tr("Stub (NOP) Function"), this));
|
||||
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextStubFunction);
|
||||
}
|
||||
|
||||
void DisassemblyWidget::contextCopyAddress()
|
||||
|
@ -309,6 +311,23 @@ void DisassemblyWidget::contextRenameFunction()
|
|||
}
|
||||
}
|
||||
|
||||
void DisassemblyWidget::contextStubFunction()
|
||||
{
|
||||
const u32 curFuncAddress = m_cpu->GetSymbolMap().GetFunctionStart(m_selectedAddressStart);
|
||||
if (curFuncAddress != SymbolMap::INVALID_ADDRESS)
|
||||
{
|
||||
Host::RunOnCPUThread([this, curFuncAddress, cpu = m_cpu] {
|
||||
cpu->write32(curFuncAddress, 0x03E00008); // jr $ra
|
||||
cpu->write32(curFuncAddress + 4, 0x00000000); // nop
|
||||
QtHost::RunOnUIThread([this] { VMUpdate(); });
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, tr("Stub Function Error"), tr("No function / symbol is currently selected."));
|
||||
}
|
||||
}
|
||||
|
||||
void DisassemblyWidget::SetCpu(DebugInterface* cpu)
|
||||
{
|
||||
m_cpu = cpu;
|
||||
|
|
|
@ -64,6 +64,8 @@ public slots:
|
|||
void contextAddFunction();
|
||||
void contextRenameFunction();
|
||||
void contextRemoveFunction();
|
||||
void contextStubFunction();
|
||||
|
||||
void gotoAddress(u32 address);
|
||||
|
||||
signals:
|
||||
|
@ -74,7 +76,7 @@ signals:
|
|||
private:
|
||||
Ui::DisassemblyWidget ui;
|
||||
|
||||
QMenu* m_contextMenu = 0x0;
|
||||
QMenu* m_contextMenu = nullptr;
|
||||
void CreateCustomContextMenu();
|
||||
|
||||
DebugInterface* m_cpu;
|
||||
|
|
Loading…
Reference in New Issue