Debugger: Print break-/watchpoint ID when breaking in CLI

This commit is contained in:
Vicki Pfau 2019-12-21 14:05:22 -08:00
parent f213488089
commit bb1ce789d2
8 changed files with 19 additions and 7 deletions

View File

@ -107,8 +107,9 @@ Other fixes:
- Qt: Fix sprite view using wrong base address (fixes mgba.io/i/1603) - Qt: Fix sprite view using wrong base address (fixes mgba.io/i/1603)
Misc: Misc:
- GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580)
- SDL: Use controller GUID instead of name
- Debugger: Separate aliases from main commands - Debugger: Separate aliases from main commands
- Debugger: Print break-/watchpoint ID when breaking in CLI
- SDL: Use controller GUID instead of name
0.8 beta 1: (2019-10-20) 0.8 beta 1: (2019-10-20)
- Initial beta for 0.8 - Initial beta for 0.8

View File

@ -69,6 +69,7 @@ struct mDebuggerEntryInfo {
enum mBreakpointType breakType; enum mBreakpointType breakType;
} bp; } bp;
} type; } type;
ssize_t pointId;
}; };
struct mBreakpoint { struct mBreakpoint {

View File

@ -60,7 +60,8 @@ static void ARMDebuggerCheckBreakpoints(struct mDebuggerPlatform* d) {
} }
struct mDebuggerEntryInfo info = { struct mDebuggerEntryInfo info = {
.address = breakpoint->d.address, .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); mDebuggerEnter(d->p, DEBUGGER_ENTER_BREAKPOINT, &info);
} }
@ -142,6 +143,7 @@ static void ARMDebuggerEnter(struct mDebuggerPlatform* platform, enum mDebuggerE
struct ARMDebugBreakpoint* breakpoint = _lookupBreakpoint(&debugger->swBreakpoints, _ARMPCAddress(cpu)); struct ARMDebugBreakpoint* breakpoint = _lookupBreakpoint(&debugger->swBreakpoints, _ARMPCAddress(cpu));
if (breakpoint && breakpoint->d.type == BREAKPOINT_SOFTWARE) { if (breakpoint && breakpoint->d.type == BREAKPOINT_SOFTWARE) {
info->address = breakpoint->d.address; info->address = breakpoint->d.address;
info->pointId = breakpoint->d.id;
if (debugger->clearSoftwareBreakpoint) { if (debugger->clearSoftwareBreakpoint) {
debugger->clearSoftwareBreakpoint(debugger, breakpoint); debugger->clearSoftwareBreakpoint(debugger, breakpoint);
} }

View File

@ -121,6 +121,7 @@ static bool _checkWatchpoints(struct ARMDebugger* debugger, uint32_t address, st
info->address = address; info->address = address;
info->type.wp.watchType = watchpoint->type; info->type.wp.watchType = watchpoint->type;
info->type.wp.accessType = type; info->type.wp.accessType = type;
info->pointId = watchpoint->id;
return true; return true;
} }
} }

View File

@ -976,7 +976,11 @@ static void _reportEntry(struct mDebugger* debugger, enum mDebuggerEntryReason r
break; break;
case DEBUGGER_ENTER_BREAKPOINT: case DEBUGGER_ENTER_BREAKPOINT:
if (info) { 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 { } else {
cliDebugger->backend->printf(cliDebugger->backend, "Hit breakpoint\n"); cliDebugger->backend->printf(cliDebugger->backend, "Hit breakpoint\n");
} }
@ -984,9 +988,9 @@ static void _reportEntry(struct mDebugger* debugger, enum mDebuggerEntryReason r
case DEBUGGER_ENTER_WATCHPOINT: case DEBUGGER_ENTER_WATCHPOINT:
if (info) { if (info) {
if (info->type.wp.accessType & WATCHPOINT_WRITE) { 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 { } 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 { } else {
cliDebugger->backend->printf(cliDebugger->backend, "Hit watchpoint\n"); cliDebugger->backend->printf(cliDebugger->backend, "Hit watchpoint\n");

View File

@ -748,7 +748,8 @@ void GBABreakpoint(struct ARMCore* cpu, int immediate) {
if (gba->debugger) { if (gba->debugger) {
struct mDebuggerEntryInfo info = { struct mDebuggerEntryInfo info = {
.address = _ARMPCAddress(cpu), .address = _ARMPCAddress(cpu),
.type.bp.breakType = BREAKPOINT_SOFTWARE .type.bp.breakType = BREAKPOINT_SOFTWARE,
.pointId = -1
}; };
mDebuggerEnter(gba->debugger->d.p, DEBUGGER_ENTER_BREAKPOINT, &info); mDebuggerEnter(gba->debugger->d.p, DEBUGGER_ENTER_BREAKPOINT, &info);
} }

View File

@ -53,7 +53,8 @@ static void LR35902DebuggerCheckBreakpoints(struct mDebuggerPlatform* d) {
} }
} }
struct mDebuggerEntryInfo info = { struct mDebuggerEntryInfo info = {
.address = breakpoint->address .address = breakpoint->address,
.pointId = breakpoint->id
}; };
mDebuggerEnter(d->p, DEBUGGER_ENTER_BREAKPOINT, &info); mDebuggerEnter(d->p, DEBUGGER_ENTER_BREAKPOINT, &info);
} }

View File

@ -60,6 +60,7 @@ static bool _checkWatchpoints(struct LR35902Debugger* debugger, uint16_t address
info->address = address; info->address = address;
info->type.wp.watchType = watchpoint->type; info->type.wp.watchType = watchpoint->type;
info->type.wp.accessType = type; info->type.wp.accessType = type;
info->pointId = watchpoint->id;
return true; return true;
} }
} }