Debugger: Print break-/watchpoint ID when breaking in CLI
Vicki Pfau vi@endrift.com
Sat, 21 Dec 2019 14:05:22 -0800
8 files changed,
19 insertions(+),
7 deletions(-)
M
CHANGES
→
CHANGES
@@ -107,8 +107,9 @@ - Qt: Fix undesired screen filtering when paused (fixes mgba.io/i/1602)
- Qt: Fix sprite view using wrong base address (fixes mgba.io/i/1603) Misc: - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) + - Debugger: Separate aliases from main commands + - Debugger: Print break-/watchpoint ID when breaking in CLI - SDL: Use controller GUID instead of name - - Debugger: Separate aliases from main commands 0.8 beta 1: (2019-10-20) - Initial beta for 0.8
M
include/mgba/debugger/debugger.h
→
include/mgba/debugger/debugger.h
@@ -69,6 +69,7 @@ uint32_t opcode;
enum mBreakpointType breakType; } bp; } type; + ssize_t pointId; }; struct mBreakpoint {
M
src/arm/debugger/debugger.c
→
src/arm/debugger/debugger.c
@@ -60,7 +60,8 @@ }
} struct mDebuggerEntryInfo info = { .address = breakpoint->d.address, - .type.bp.breakType = BREAKPOINT_HARDWARE + .type.bp.breakType = BREAKPOINT_HARDWARE, + .pointId = breakpoint->d.id }; mDebuggerEnter(d->p, DEBUGGER_ENTER_BREAKPOINT, &info); }@@ -142,6 +143,7 @@ if (reason == DEBUGGER_ENTER_BREAKPOINT) {
struct ARMDebugBreakpoint* breakpoint = _lookupBreakpoint(&debugger->swBreakpoints, _ARMPCAddress(cpu)); if (breakpoint && breakpoint->d.type == BREAKPOINT_SOFTWARE) { info->address = breakpoint->d.address; + info->pointId = breakpoint->d.id; if (debugger->clearSoftwareBreakpoint) { debugger->clearSoftwareBreakpoint(debugger, breakpoint); }
M
src/arm/debugger/memory-debugger.c
→
src/arm/debugger/memory-debugger.c
@@ -121,6 +121,7 @@ info->type.wp.newValue = newValue;
info->address = address; info->type.wp.watchType = watchpoint->type; info->type.wp.accessType = type; + info->pointId = watchpoint->id; return true; } }
M
src/debugger/cli-debugger.c
→
src/debugger/cli-debugger.c
@@ -976,7 +976,11 @@ case DEBUGGER_ENTER_ATTACHED:
break; case DEBUGGER_ENTER_BREAKPOINT: if (info) { - cliDebugger->backend->printf(cliDebugger->backend, "Hit breakpoint at 0x%08X\n", info->address); + if (info->pointId > 0) { + cliDebugger->backend->printf(cliDebugger->backend, "Hit breakpoint %zi at 0x%08X\n", info->pointId, info->address); + } else { + cliDebugger->backend->printf(cliDebugger->backend, "Hit unknown breakpoint at 0x%08X\n", info->address); + } } else { cliDebugger->backend->printf(cliDebugger->backend, "Hit breakpoint\n"); }@@ -984,9 +988,9 @@ break;
case DEBUGGER_ENTER_WATCHPOINT: if (info) { if (info->type.wp.accessType & WATCHPOINT_WRITE) { - cliDebugger->backend->printf(cliDebugger->backend, "Hit watchpoint at 0x%08X: (new value = 0x%08X, old value = 0x%08X)\n", info->address, info->type.wp.newValue, info->type.wp.oldValue); + cliDebugger->backend->printf(cliDebugger->backend, "Hit watchpoint %zi at 0x%08X: (new value = 0x%08X, old value = 0x%08X)\n", info->pointId, info->address, info->type.wp.newValue, info->type.wp.oldValue); } else { - cliDebugger->backend->printf(cliDebugger->backend, "Hit watchpoint at 0x%08X: (value = 0x%08X)\n", info->address, info->type.wp.oldValue); + cliDebugger->backend->printf(cliDebugger->backend, "Hit watchpoint %zi at 0x%08X: (value = 0x%08X)\n", info->pointId, info->address, info->type.wp.oldValue); } } else { cliDebugger->backend->printf(cliDebugger->backend, "Hit watchpoint\n");
M
src/gba/gba.c
→
src/gba/gba.c
@@ -748,7 +748,8 @@ case CPU_COMPONENT_DEBUGGER:
if (gba->debugger) { struct mDebuggerEntryInfo info = { .address = _ARMPCAddress(cpu), - .type.bp.breakType = BREAKPOINT_SOFTWARE + .type.bp.breakType = BREAKPOINT_SOFTWARE, + .pointId = -1 }; mDebuggerEnter(gba->debugger->d.p, DEBUGGER_ENTER_BREAKPOINT, &info); }
M
src/lr35902/debugger/debugger.c
→
src/lr35902/debugger/debugger.c
@@ -53,7 +53,8 @@ return;
} } struct mDebuggerEntryInfo info = { - .address = breakpoint->address + .address = breakpoint->address, + .pointId = breakpoint->id }; mDebuggerEnter(d->p, DEBUGGER_ENTER_BREAKPOINT, &info); }
M
src/lr35902/debugger/memory-debugger.c
→
src/lr35902/debugger/memory-debugger.c
@@ -60,6 +60,7 @@ info->type.wp.newValue = newValue;
info->address = address; info->type.wp.watchType = watchpoint->type; info->type.wp.accessType = type; + info->pointId = watchpoint->id; return true; } }