1
0
Fork 0

Add memory read breakpoint to context menu

* added breakpoint_memory_read.png
* added breakpoint_memory_read.png to resource.qrc
* breakpoint memory read added to memory dump context menu
* breakpoint memory read added to context menu
This commit is contained in:
Paul 2017-11-17 07:00:32 -05:00 committed by Duncan Ogilvie
parent 200c861761
commit 7963e5206f
6 changed files with 38 additions and 0 deletions

View File

@ -130,6 +130,10 @@ void CPUDump::setupContextMenu()
{
return (DbgGetBpxTypeAt(rvaToVa(getSelectionStart())) & bp_memory) == 0;
});
MenuBuilder* wMemoryReadMenu = new MenuBuilder(this, [this](QMenu*)
{
return (DbgGetBpxTypeAt(rvaToVa(getSelectionStart())) & bp_memory) == 0;
});
MenuBuilder* wMemoryWriteMenu = new MenuBuilder(this, [this](QMenu*)
{
return (DbgGetBpxTypeAt(rvaToVa(getSelectionStart())) & bp_memory) == 0;
@ -163,11 +167,14 @@ void CPUDump::setupContextMenu()
wBreakpointMenu->addSeparator();
wMemoryAccessMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryAccessSingleshootSlot())));
wMemoryAccessMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryAccessRestoreSlot())));
wMemoryReadMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryReadSingleshootSlot())));
wMemoryReadMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryReadRestoreSlot())));
wMemoryWriteMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryWriteSingleshootSlot())));
wMemoryWriteMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryWriteRestoreSlot())));
wMemoryExecuteMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryExecuteSingleshootSlot())));
wMemoryExecuteMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryExecuteRestoreSlot())));
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_access.png"), tr("Memory, Access")), wMemoryAccessMenu);
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_read.png"), tr("Memory, Read")), wMemoryReadMenu);
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_write.png"), tr("Memory, Write")), wMemoryWriteMenu);
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_execute.png"), tr("Memory, Execute")), wMemoryExecuteMenu);
wBreakpointMenu->addAction(makeAction(DIcon("breakpoint_remove.png"), tr("Remove &Memory"), SLOT(memoryRemoveSlot())), [this](QMenu*)
@ -1276,6 +1283,18 @@ void CPUDump::memoryAccessRestoreSlot()
DbgCmdExec(QString("bpm " + addr_text + ", 1, a").toUtf8().constData());
}
void CPUDump::memoryReadSingleshootSlot()
{
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
DbgCmdExec(QString("bpm " + addr_text + ", 0, r").toUtf8().constData());
}
void CPUDump::memoryReadRestoreSlot()
{
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
DbgCmdExec(QString("bpm " + addr_text + ", 1, r").toUtf8().constData());
}
void CPUDump::memoryWriteSingleshootSlot()
{
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));

View File

@ -26,6 +26,8 @@ signals:
public slots:
void memoryAccessSingleshootSlot();
void memoryAccessRestoreSlot();
void memoryReadSingleshootSlot();
void memoryReadRestoreSlot();
void memoryWriteSingleshootSlot();
void memoryWriteRestoreSlot();
void memoryExecuteSingleshootSlot();

View File

@ -84,6 +84,17 @@ void MemoryMapView::setupContextMenu()
mMemoryAccessMenu->addAction(mMemoryAccessRestore);
mBreakpointMenu->addMenu(mMemoryAccessMenu);
//Breakpoint->Memory Read
mMemoryReadMenu = new QMenu(tr("Read"), this);
mMemoryReadMenu->setIcon(DIcon("breakpoint_memory_read.png"));
mMemoryReadSingleshoot = new QAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), this);
makeCommandAction(mMemoryReadSingleshoot, "bpm $, 0, r");
mMemoryReadMenu->addAction(mMemoryReadSingleshoot);
mMemoryReadRestore = new QAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore"), this);
makeCommandAction(mMemoryReadRestore, "bpm $, 1, r");
mMemoryReadMenu->addAction(mMemoryReadRestore);
mBreakpointMenu->addMenu(mMemoryReadMenu);
//Breakpoint->Memory Write
mMemoryWriteMenu = new QMenu(tr("Write"), this);
mMemoryWriteMenu->setIcon(DIcon("breakpoint_memory_write.png"));
@ -233,6 +244,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
if((DbgGetBpxTypeAt(selectedAddr) & bp_memory) == bp_memory) //memory breakpoint set
{
mMemoryAccessMenu->menuAction()->setVisible(false);
mMemoryReadMenu->menuAction()->setVisible(false);
mMemoryWriteMenu->menuAction()->setVisible(false);
mMemoryExecuteMenu->menuAction()->setVisible(false);
mMemoryRemove->setVisible(true);
@ -240,6 +252,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
else //memory breakpoint not set
{
mMemoryAccessMenu->menuAction()->setVisible(true);
mMemoryReadMenu->menuAction()->setVisible(true);
mMemoryWriteMenu->menuAction()->setVisible(true);
mMemoryExecuteMenu->menuAction()->setVisible(true);
mMemoryRemove->setVisible(false);

View File

@ -58,6 +58,9 @@ private:
QMenu* mMemoryAccessMenu;
QAction* mMemoryAccessSingleshoot;
QAction* mMemoryAccessRestore;
QMenu* mMemoryReadMenu;
QAction* mMemoryReadSingleshoot;
QAction* mMemoryReadRestore;
QMenu* mMemoryWriteMenu;
QAction* mMemoryWriteSingleshoot;
QAction* mMemoryWriteRestore;

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

View File

@ -311,6 +311,7 @@
<file>images/prevref.png</file>
<file>images/bug.png</file>
<file>images/donation_qr.png</file>
<file>images/breakpoint_memory_read.png</file>
<file>images/lib.png</file>
</qresource>
</RCC>