Debugger: Print breakpoint/watchpoint number when inserting

This commit is contained in:
Vicki Pfau 2019-04-28 13:37:51 -07:00
parent 1d6d4a5377
commit 1deff07aa1
4 changed files with 23 additions and 6 deletions

View File

@ -45,6 +45,7 @@ Misc:
- 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:

View File

@ -15,6 +15,8 @@ CXX_GUARD_START
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;

View File

@ -147,21 +147,27 @@ static void _printStatus(struct CLIDebuggerSystem* debugger) {
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) {

View File

@ -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 @@ static void _setBreakpoint(struct CLIDebugger* debugger, struct CLIDebugVector*
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 @@ static void _setWatchpoint(struct CLIDebugger* debugger, struct CLIDebugVector*
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) {