From 7963e5206fc4f5ce592e02a5d4160bec1fd3a246 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 17 Nov 2017 07:00:32 -0500 Subject: [PATCH] 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 --- src/gui/Src/Gui/CPUDump.cpp | 19 +++++++++++++++++++ src/gui/Src/Gui/CPUDump.h | 2 ++ src/gui/Src/Gui/MemoryMapView.cpp | 13 +++++++++++++ src/gui/Src/Gui/MemoryMapView.h | 3 +++ src/gui/images/breakpoint_memory_read.png | Bin 0 -> 863 bytes src/gui/resource.qrc | 1 + 6 files changed, 38 insertions(+) create mode 100644 src/gui/images/breakpoint_memory_read.png diff --git a/src/gui/Src/Gui/CPUDump.cpp b/src/gui/Src/Gui/CPUDump.cpp index 73ce476f..31979577 100644 --- a/src/gui/Src/Gui/CPUDump.cpp +++ b/src/gui/Src/Gui/CPUDump.cpp @@ -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())); diff --git a/src/gui/Src/Gui/CPUDump.h b/src/gui/Src/Gui/CPUDump.h index 8a7fd151..11f3e1a9 100644 --- a/src/gui/Src/Gui/CPUDump.h +++ b/src/gui/Src/Gui/CPUDump.h @@ -26,6 +26,8 @@ signals: public slots: void memoryAccessSingleshootSlot(); void memoryAccessRestoreSlot(); + void memoryReadSingleshootSlot(); + void memoryReadRestoreSlot(); void memoryWriteSingleshootSlot(); void memoryWriteRestoreSlot(); void memoryExecuteSingleshootSlot(); diff --git a/src/gui/Src/Gui/MemoryMapView.cpp b/src/gui/Src/Gui/MemoryMapView.cpp index 1f3fd297..3d90f002 100644 --- a/src/gui/Src/Gui/MemoryMapView.cpp +++ b/src/gui/Src/Gui/MemoryMapView.cpp @@ -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); diff --git a/src/gui/Src/Gui/MemoryMapView.h b/src/gui/Src/Gui/MemoryMapView.h index 4fc8335f..6de08e10 100644 --- a/src/gui/Src/Gui/MemoryMapView.h +++ b/src/gui/Src/Gui/MemoryMapView.h @@ -58,6 +58,9 @@ private: QMenu* mMemoryAccessMenu; QAction* mMemoryAccessSingleshoot; QAction* mMemoryAccessRestore; + QMenu* mMemoryReadMenu; + QAction* mMemoryReadSingleshoot; + QAction* mMemoryReadRestore; QMenu* mMemoryWriteMenu; QAction* mMemoryWriteSingleshoot; QAction* mMemoryWriteRestore; diff --git a/src/gui/images/breakpoint_memory_read.png b/src/gui/images/breakpoint_memory_read.png new file mode 100644 index 0000000000000000000000000000000000000000..01a97745927680f86a65fee7a96b8eafdfe23399 GIT binary patch literal 863 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>mz>o5yFa^e`~&m6z{QQCTr{2~d37nTH$qUI03!kA>xcfWSFH!To%E z>GJa14qV=S?)u@2_by$z19St>52*|cnG6ipa&jB@?caHP&xIQgZa;Yol!AcdNQv(D z$ZNMR+`gzK;q^in;&t5$L=F^V{PhT~piI-%^_&BoKn=-S)fW5tajIXk% zJ$s-FqqViQkp`!(G9%1L5G~U#BikWs7G)~iE_?4#oou_z)%D>%{Wd=RwrQ!_75ZEo zl?6KtMP1{CPdPd5H#gs9WVBLDY^k8&9wDLKf`Yq+gwE_c_u~Dx7jN!exN~X!`i*<` z96o*e`puibKxfDiJO3LQ1v7YE`26?t1%K1sJq1T)thB*j6gN{cd2< z)eKcRG5-G+8eTvP7?Zr+T^Kr8Wj%nLO`a}}ArhC96F7LAn*!K4IC%N{85SGNa7d|O zVR2+#v?%$IgN7NGo`AHVtoZy1GmbPc^!S|7S(EcdW=_l;0mi&}Po{*#+0`*RDt0t% z@QA9~wPMDOmL(!C4pC~##@=CmagK)4N(+{(S+r`|x`ivJF6I@yaPjKp>&6Bqr%cTn zIcCh7IeT_=#IwlA+X`#8Z9Tocyr87%^W0djn7emuZ4ztr-#f|2t1LJAA^MY@g^jfx z7*Ivm)wM4B$1nk1uUg_7QIe8al4_M)lnSI6j0_CTbqx)54b4IfjIE3ft&AcptHiA#fv-gmsDZ)L)z4*}Q$iB}KD$dG literal 0 HcmV?d00001 diff --git a/src/gui/resource.qrc b/src/gui/resource.qrc index fa931e16..6c7b880e 100644 --- a/src/gui/resource.qrc +++ b/src/gui/resource.qrc @@ -311,6 +311,7 @@ images/prevref.png images/bug.png images/donation_qr.png + images/breakpoint_memory_read.png images/lib.png