Debugger Disassembly: Add 'NOP Instruction(s)' Context menu action

This commit is contained in:
Ty Lamontagne 2022-12-31 23:24:39 -05:00 committed by lightningterror
parent ec5a91b89a
commit eac90c6b42
2 changed files with 14 additions and 0 deletions

View File

@ -60,6 +60,8 @@ void DisassemblyWidget::CreateCustomContextMenu()
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction(action = new QAction(tr("Assemble new Instruction(s)"), this)); m_contextMenu->addAction(action = new QAction(tr("Assemble new Instruction(s)"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextAssembleInstruction); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextAssembleInstruction);
m_contextMenu->addAction(action = new QAction(tr("NOP Instruction(s)"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextNoopInstruction);
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction(action = new QAction(tr("Run to Cursor"), this)); m_contextMenu->addAction(action = new QAction(tr("Run to Cursor"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRunToCursor); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRunToCursor);
@ -136,6 +138,17 @@ void DisassemblyWidget::contextAssembleInstruction()
} }
} }
void DisassemblyWidget::contextNoopInstruction()
{
Host::RunOnCPUThread([this, start = m_selectedAddressStart, end = m_selectedAddressEnd, cpu = m_cpu] {
for (u32 i = start; i <= end; i += 4)
{
cpu->write32(i, 0x00);
}
QtHost::RunOnUIThread([this] { VMUpdate(); });
});
}
void DisassemblyWidget::contextRunToCursor() void DisassemblyWidget::contextRunToCursor()
{ {
Host::RunOnCPUThread([&] { CBreakPoints::AddBreakPoint(m_cpu->getCpuType(), m_selectedAddressStart); }); Host::RunOnCPUThread([&] { CBreakPoints::AddBreakPoint(m_cpu->getCpuType(), m_selectedAddressStart); });

View File

@ -55,6 +55,7 @@ public slots:
void contextCopyInstructionHex(); void contextCopyInstructionHex();
void contextCopyInstructionText(); void contextCopyInstructionText();
void contextAssembleInstruction(); void contextAssembleInstruction();
void contextNoopInstruction();
void contextRunToCursor(); void contextRunToCursor();
void contextJumpToCursor(); void contextJumpToCursor();
void contextToggleBreakpoint(); void contextToggleBreakpoint();