all repos — mgba @ 1deff07aa1b0d3d4b6b15e875fbeb0cc8eff0926

mGBA Game Boy Advance Emulator

Debugger: Print breakpoint/watchpoint number when inserting
Vicki Pfau vi@endrift.com
Sun, 28 Apr 2019 13:37:51 -0700
commit

1deff07aa1b0d3d4b6b15e875fbeb0cc8eff0926

parent

1d6d4a5377ef0c9b1b1ed261e2ba852f082b0998

M CHANGESCHANGES

@@ -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.hinclude/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.csrc/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.csrc/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) {