From f4cae8c9b7f3a71b1ae5c691d5bdb9a038b12f3d Mon Sep 17 00:00:00 2001 From: John Peterson Date: Sat, 29 Nov 2008 08:38:03 +0000 Subject: [PATCH] Debugger: Made Insert blr toggle between blr and old value git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1326 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DebuggerWX/Src/CodeView.cpp | 29 +++++++++++++++++++++++-- Source/Core/DebuggerWX/Src/CodeView.h | 8 +++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Source/Core/DebuggerWX/Src/CodeView.cpp b/Source/Core/DebuggerWX/Src/CodeView.cpp index c7bafae1e1..79cbd1be7d 100644 --- a/Source/Core/DebuggerWX/Src/CodeView.cpp +++ b/Source/Core/DebuggerWX/Src/CodeView.cpp @@ -18,6 +18,7 @@ #include "Debugger.h" #include "Debugger/PPCDebugInterface.h" #include "PowerPC/SymbolDB.h" +#include "HW/Memmap.h" // for Write_U32 #include "Common.h" #include "StringUtil.h" @@ -238,9 +239,33 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) redraw(); break; + // Insert blr or restore old value case IDM_INSERTBLR: - debugger->insertBLR(selection); - redraw(); + { + // Check if this address has been modified + int find = -1; + for(int i = 0; i < BlrList.size(); i++) + { + if(BlrList.at(i).Address == selection) + { find = i; break; } + } + + // Save the old value + if(find >= 0) + { + Memory::Write_U32(BlrList.at(find).OldValue, selection); + BlrList.erase(BlrList.begin() + find); + } + else + { + BlrStruct Temp; + Temp.Address = selection; + Temp.OldValue = debugger->readMemory(selection); + BlrList.push_back(Temp); + debugger->insertBLR(selection); + } + redraw(); + } break; case IDM_JITRESULTS: diff --git a/Source/Core/DebuggerWX/Src/CodeView.h b/Source/Core/DebuggerWX/Src/CodeView.h index 612fa0ccd9..c270ad1fdb 100644 --- a/Source/Core/DebuggerWX/Src/CodeView.h +++ b/Source/Core/DebuggerWX/Src/CodeView.h @@ -22,6 +22,7 @@ #include "Common.h" #include "Debugger/DebugInterface.h" +#include #include DECLARE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE, -1); @@ -42,6 +43,13 @@ class CCodeView u32 GetSelection() {return(selection);} + struct BlrStruct // for IDM_INSERTBLR + { + u32 Address; + u32 OldValue; + }; + std::vector BlrList; + void Center(u32 addr) { curAddress = addr;