Debugger: Print breakpoint/watchpoint number when inserting
Vicki Pfau vi@endrift.com
Sun, 28 Apr 2019 13:37:51 -0700
4 files changed,
23 insertions(+),
6 deletions(-)
M
CHANGES
→
CHANGES
@@ -45,6 +45,7 @@ - Vita: Improved frame drawing speed
- Qt: Cap window size on start to monitor size - GBA BIOS: Add timings for HLE BIOS math functions (fixes mgba.io/i/1396) - Debugger: Make tracing compatible with breakpoints/watchpoints + - Debugger: Print breakpoint/watchpoint number when inserting 0.7.1: (2019-02-24) Bugfixes:
M
include/mgba/internal/debugger/cli-debugger.h
→
include/mgba/internal/debugger/cli-debugger.h
@@ -15,6 +15,8 @@
extern const char* ERROR_MISSING_ARGS; extern const char* ERROR_OVERFLOW; extern const char* ERROR_INVALID_ARGS; +extern const char* INFO_BREAKPOINT_ADDED; +extern const char* INFO_WATCHPOINT_ADDED; struct CLIDebugger; struct VFile;
M
src/arm/debugger/cli-debugger.c
→
src/arm/debugger/cli-debugger.c
@@ -147,21 +147,27 @@
static void _setBreakpointARM(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { struct CLIDebuggerBackend* be = debugger->backend; if (!dv || dv->type != CLIDV_INT_TYPE) { - be->printf(be, "%s\n", ERROR_MISSING_ARGS); + be->printf(be, "%s", ERROR_MISSING_ARGS); return; } uint32_t address = dv->intValue; - ARMDebuggerSetSoftwareBreakpoint(debugger->d.platform, address, MODE_ARM); + ssize_t id = ARMDebuggerSetSoftwareBreakpoint(debugger->d.platform, address, MODE_ARM); + if (id > 0) { + debugger->backend->printf(debugger->backend, INFO_BREAKPOINT_ADDED, id); + } } static void _setBreakpointThumb(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { struct CLIDebuggerBackend* be = debugger->backend; if (!dv || dv->type != CLIDV_INT_TYPE) { - be->printf(be, "%s\n", ERROR_MISSING_ARGS); + be->printf(be, "%s", ERROR_MISSING_ARGS); return; } uint32_t address = dv->intValue; - ARMDebuggerSetSoftwareBreakpoint(debugger->d.platform, address, MODE_THUMB); + ssize_t id = ARMDebuggerSetSoftwareBreakpoint(debugger->d.platform, address, MODE_THUMB); + if (id > 0) { + debugger->backend->printf(debugger->backend, INFO_BREAKPOINT_ADDED, id); + } } void ARMCLIDebuggerCreate(struct CLIDebuggerSystem* debugger) {
M
src/debugger/cli-debugger.c
→
src/debugger/cli-debugger.c
@@ -28,6 +28,8 @@
const char* ERROR_MISSING_ARGS = "Arguments missing"; // TODO: share const char* ERROR_OVERFLOW = "Arguments overflow"; const char* ERROR_INVALID_ARGS = "Invalid arguments"; +const char* INFO_BREAKPOINT_ADDED = "Added breakpoint #%" PRIz "i\n"; +const char* INFO_WATCHPOINT_ADDED = "Added watchpoint #%" PRIz "i\n"; static struct ParseTree* _parseTree(const char** string); static bool _doTrace(struct CLIDebugger* debugger);@@ -553,7 +555,10 @@ debugger->backend->printf(debugger->backend, "%s\n", ERROR_INVALID_ARGS);
return; } } - debugger->d.platform->setBreakpoint(debugger->d.platform, &breakpoint); + ssize_t id = debugger->d.platform->setBreakpoint(debugger->d.platform, &breakpoint); + if (id > 0) { + debugger->backend->printf(debugger->backend, INFO_BREAKPOINT_ADDED, id); + } } static void _setWatchpoint(struct CLIDebugger* debugger, struct CLIDebugVector* dv, enum mWatchpointType type) {@@ -579,7 +584,10 @@ debugger->backend->printf(debugger->backend, "%s\n", ERROR_INVALID_ARGS);
return; } } - debugger->d.platform->setWatchpoint(debugger->d.platform, &watchpoint); + ssize_t id = debugger->d.platform->setWatchpoint(debugger->d.platform, &watchpoint); + if (id > 0) { + debugger->backend->printf(debugger->backend, INFO_WATCHPOINT_ADDED, id); + } } static void _setReadWriteWatchpoint(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {