all repos — mgba @ 21437e91f6d73c58f7980a12f1bc381be4f9471b

mGBA Game Boy Advance Emulator

Implement watchpoint removing
Jeffrey Pfau jeffrey@endrift.com
Mon, 01 Sep 2014 02:23:31 -0700
commit

21437e91f6d73c58f7980a12f1bc381be4f9471b

parent

98cb4698f8a8b221f4047a546745be63844cf65c

M src/debugger/debugger.csrc/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.hsrc/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.csrc/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.hsrc/debugger/memory-debugger.h

@@ -8,5 +8,6 @@

struct ARMDebugger; void ARMDebuggerInstallMemoryShim(struct ARMDebugger* debugger); +void ARMDebuggerRemoveMemoryShim(struct ARMDebugger* debugger); #endif