Skip to content

Commit 7963e52

Browse files
tarterpmrexodia
authored andcommitted
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
1 parent 200c861 commit 7963e52

File tree

6 files changed

+38
-0
lines changed

6 files changed

+38
-0
lines changed

src/gui/Src/Gui/CPUDump.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ void CPUDump::setupContextMenu()
130130
{
131131
return (DbgGetBpxTypeAt(rvaToVa(getSelectionStart())) & bp_memory) == 0;
132132
});
133+
MenuBuilder* wMemoryReadMenu = new MenuBuilder(this, [this](QMenu*)
134+
{
135+
return (DbgGetBpxTypeAt(rvaToVa(getSelectionStart())) & bp_memory) == 0;
136+
});
133137
MenuBuilder* wMemoryWriteMenu = new MenuBuilder(this, [this](QMenu*)
134138
{
135139
return (DbgGetBpxTypeAt(rvaToVa(getSelectionStart())) & bp_memory) == 0;
@@ -163,11 +167,14 @@ void CPUDump::setupContextMenu()
163167
wBreakpointMenu->addSeparator();
164168
wMemoryAccessMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryAccessSingleshootSlot())));
165169
wMemoryAccessMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryAccessRestoreSlot())));
170+
wMemoryReadMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryReadSingleshootSlot())));
171+
wMemoryReadMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryReadRestoreSlot())));
166172
wMemoryWriteMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryWriteSingleshootSlot())));
167173
wMemoryWriteMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryWriteRestoreSlot())));
168174
wMemoryExecuteMenu->addAction(makeAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), SLOT(memoryExecuteSingleshootSlot())));
169175
wMemoryExecuteMenu->addAction(makeAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore on hit"), SLOT(memoryExecuteRestoreSlot())));
170176
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_access.png"), tr("Memory, Access")), wMemoryAccessMenu);
177+
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_read.png"), tr("Memory, Read")), wMemoryReadMenu);
171178
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_write.png"), tr("Memory, Write")), wMemoryWriteMenu);
172179
wBreakpointMenu->addMenu(makeMenu(DIcon("breakpoint_memory_execute.png"), tr("Memory, Execute")), wMemoryExecuteMenu);
173180
wBreakpointMenu->addAction(makeAction(DIcon("breakpoint_remove.png"), tr("Remove &Memory"), SLOT(memoryRemoveSlot())), [this](QMenu*)
@@ -1276,6 +1283,18 @@ void CPUDump::memoryAccessRestoreSlot()
12761283
DbgCmdExec(QString("bpm " + addr_text + ", 1, a").toUtf8().constData());
12771284
}
12781285

1286+
void CPUDump::memoryReadSingleshootSlot()
1287+
{
1288+
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
1289+
DbgCmdExec(QString("bpm " + addr_text + ", 0, r").toUtf8().constData());
1290+
}
1291+
1292+
void CPUDump::memoryReadRestoreSlot()
1293+
{
1294+
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));
1295+
DbgCmdExec(QString("bpm " + addr_text + ", 1, r").toUtf8().constData());
1296+
}
1297+
12791298
void CPUDump::memoryWriteSingleshootSlot()
12801299
{
12811300
QString addr_text = ToPtrString(rvaToVa(getSelectionStart()));

src/gui/Src/Gui/CPUDump.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class CPUDump : public HexDump
2626
public slots:
2727
void memoryAccessSingleshootSlot();
2828
void memoryAccessRestoreSlot();
29+
void memoryReadSingleshootSlot();
30+
void memoryReadRestoreSlot();
2931
void memoryWriteSingleshootSlot();
3032
void memoryWriteRestoreSlot();
3133
void memoryExecuteSingleshootSlot();

src/gui/Src/Gui/MemoryMapView.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ void MemoryMapView::setupContextMenu()
8484
mMemoryAccessMenu->addAction(mMemoryAccessRestore);
8585
mBreakpointMenu->addMenu(mMemoryAccessMenu);
8686

87+
//Breakpoint->Memory Read
88+
mMemoryReadMenu = new QMenu(tr("Read"), this);
89+
mMemoryReadMenu->setIcon(DIcon("breakpoint_memory_read.png"));
90+
mMemoryReadSingleshoot = new QAction(DIcon("breakpoint_memory_singleshoot.png"), tr("&Singleshoot"), this);
91+
makeCommandAction(mMemoryReadSingleshoot, "bpm $, 0, r");
92+
mMemoryReadMenu->addAction(mMemoryReadSingleshoot);
93+
mMemoryReadRestore = new QAction(DIcon("breakpoint_memory_restore_on_hit.png"), tr("&Restore"), this);
94+
makeCommandAction(mMemoryReadRestore, "bpm $, 1, r");
95+
mMemoryReadMenu->addAction(mMemoryReadRestore);
96+
mBreakpointMenu->addMenu(mMemoryReadMenu);
97+
8798
//Breakpoint->Memory Write
8899
mMemoryWriteMenu = new QMenu(tr("Write"), this);
89100
mMemoryWriteMenu->setIcon(DIcon("breakpoint_memory_write.png"));
@@ -233,13 +244,15 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
233244
if((DbgGetBpxTypeAt(selectedAddr) & bp_memory) == bp_memory) //memory breakpoint set
234245
{
235246
mMemoryAccessMenu->menuAction()->setVisible(false);
247+
mMemoryReadMenu->menuAction()->setVisible(false);
236248
mMemoryWriteMenu->menuAction()->setVisible(false);
237249
mMemoryExecuteMenu->menuAction()->setVisible(false);
238250
mMemoryRemove->setVisible(true);
239251
}
240252
else //memory breakpoint not set
241253
{
242254
mMemoryAccessMenu->menuAction()->setVisible(true);
255+
mMemoryReadMenu->menuAction()->setVisible(true);
243256
mMemoryWriteMenu->menuAction()->setVisible(true);
244257
mMemoryExecuteMenu->menuAction()->setVisible(true);
245258
mMemoryRemove->setVisible(false);

src/gui/Src/Gui/MemoryMapView.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public slots:
5858
QMenu* mMemoryAccessMenu;
5959
QAction* mMemoryAccessSingleshoot;
6060
QAction* mMemoryAccessRestore;
61+
QMenu* mMemoryReadMenu;
62+
QAction* mMemoryReadSingleshoot;
63+
QAction* mMemoryReadRestore;
6164
QMenu* mMemoryWriteMenu;
6265
QAction* mMemoryWriteSingleshoot;
6366
QAction* mMemoryWriteRestore;
863 Bytes
Loading

src/gui/resource.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
<file>images/prevref.png</file>
312312
<file>images/bug.png</file>
313313
<file>images/donation_qr.png</file>
314+
<file>images/breakpoint_memory_read.png</file>
314315
<file>images/lib.png</file>
315316
</qresource>
316317
</RCC>

0 commit comments

Comments
 (0)