Implement watchpoint removing
Jeffrey Pfau jeffrey@endrift.com
Mon, 01 Sep 2014 02:23:31 -0700
4 files changed,
29 insertions(+),
0 deletions(-)
M
src/debugger/debugger.c
→
src/debugger/debugger.c
@@ -115,3 +115,17 @@ watchpoint->address = address;
watchpoint->next = debugger->watchpoints; debugger->watchpoints = watchpoint; } + +void ARMDebuggerClearWatchpoint(struct ARMDebugger* debugger, uint32_t address) { + struct DebugBreakpoint** previous = &debugger->watchpoints; + struct DebugBreakpoint* breakpoint; + for (; (breakpoint = *previous); previous = &breakpoint->next) { + if (breakpoint->address == address) { + *previous = breakpoint->next; + free(breakpoint); + } + } + if (!debugger->watchpoints) { + ARMDebuggerRemoveMemoryShim(debugger); + } +}
M
src/debugger/debugger.h
→
src/debugger/debugger.h
@@ -58,5 +58,6 @@ void ARMDebuggerEnter(struct ARMDebugger*, enum DebuggerEntryReason);
void ARMDebuggerSetBreakpoint(struct ARMDebugger* debugger, uint32_t address); void ARMDebuggerClearBreakpoint(struct ARMDebugger* debugger, uint32_t address); void ARMDebuggerSetWatchpoint(struct ARMDebugger* debugger, uint32_t address); +void ARMDebuggerClearWatchpoint(struct ARMDebugger* debugger, uint32_t address); #endif
M
src/debugger/memory-debugger.c
→
src/debugger/memory-debugger.c
@@ -69,3 +69,16 @@ debugger->cpu->memory.loadU8 = ARMDebuggerShim_loadU8;
debugger->cpu->memory.setActiveRegion = ARMDebuggerShim_setActiveRegion; debugger->cpu->memory.waitMultiple = ARMDebuggerShim_waitMultiple; } + +void ARMDebuggerRemoveMemoryShim(struct ARMDebugger* debugger) { + debugger->cpu->memory.store32 = debugger->originalMemory.store32; + debugger->cpu->memory.store16 = debugger->originalMemory.store16; + debugger->cpu->memory.store8 = debugger->originalMemory.store8; + debugger->cpu->memory.load32 = debugger->originalMemory.load32; + debugger->cpu->memory.load16 = debugger->originalMemory.load16; + debugger->cpu->memory.loadU16 = debugger->originalMemory.loadU16; + debugger->cpu->memory.load8 = debugger->originalMemory.load8; + debugger->cpu->memory.loadU8 = debugger->originalMemory.loadU8; + debugger->cpu->memory.setActiveRegion = debugger->originalMemory.setActiveRegion; + debugger->cpu->memory.waitMultiple = debugger->originalMemory.waitMultiple; +}
M
src/debugger/memory-debugger.h
→
src/debugger/memory-debugger.h
@@ -8,5 +8,6 @@
struct ARMDebugger; void ARMDebuggerInstallMemoryShim(struct ARMDebugger* debugger); +void ARMDebuggerRemoveMemoryShim(struct ARMDebugger* debugger); #endif