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);
|
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRenameFunction);
|
||||||
m_contextMenu->addAction(action = new QAction(tr("Remove Function"), this));
|
m_contextMenu->addAction(action = new QAction(tr("Remove Function"), this));
|
||||||
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRemoveFunction);
|
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()
|
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)
|
void DisassemblyWidget::SetCpu(DebugInterface* cpu)
|
||||||
{
|
{
|
||||||
m_cpu = cpu;
|
m_cpu = cpu;
|
||||||
|
|
|
@ -64,6 +64,8 @@ public slots:
|
||||||
void contextAddFunction();
|
void contextAddFunction();
|
||||||
void contextRenameFunction();
|
void contextRenameFunction();
|
||||||
void contextRemoveFunction();
|
void contextRemoveFunction();
|
||||||
|
void contextStubFunction();
|
||||||
|
|
||||||
void gotoAddress(u32 address);
|
void gotoAddress(u32 address);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -74,7 +76,7 @@ signals:
|
||||||
private:
|
private:
|
||||||
Ui::DisassemblyWidget ui;
|
Ui::DisassemblyWidget ui;
|
||||||
|
|
||||||
QMenu* m_contextMenu = 0x0;
|
QMenu* m_contextMenu = nullptr;
|
||||||
void CreateCustomContextMenu();
|
void CreateCustomContextMenu();
|
||||||
|
|
||||||
DebugInterface* m_cpu;
|
DebugInterface* m_cpu;
|
||||||
|
|
Loading…
Reference in New Issue