static void _setBreakpoint(struct GDBStub* stub, const char* message) { const char* readAddress = &message[2]; unsigned i = 0; uint32_t address = _readHex(readAddress, &i); readAddress += i + 1; uint32_t kind = _readHex(readAddress, &i); switch (message[0]) { case '0': ARMDebuggerSetSoftwareBreakpoint(stub->d.platform, address, kind == 2 ? MODE_THUMB : MODE_ARM); break; case '1': stub->d.platform->setBreakpoint(stub->d.platform, address); break; case '2': stub->d.platform->setWatchpoint(stub->d.platform, address, WATCHPOINT_WRITE); break; case '3': stub->d.platform->setWatchpoint(stub->d.platform, address, WATCHPOINT_READ); break; case '4': stub->d.platform->setWatchpoint(stub->d.platform, address, WATCHPOINT_RW); break; default: stub->outgoing[0] = '\0'; _sendMessage(stub); return; } strncpy(stub->outgoing, "OK", GDB_STUB_MAX_LINE - 4); _sendMessage(stub); }
static void _setBreakpointThumb(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { if (!dv || dv->type != CLIDV_INT_TYPE) { printf("%s\n", ERROR_MISSING_ARGS); return; } uint32_t address = dv->intValue; ARMDebuggerSetSoftwareBreakpoint(&debugger->d, address, MODE_THUMB); }
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); return; } uint32_t address = dv->intValue; ARMDebuggerSetSoftwareBreakpoint(debugger->d.platform, address, MODE_THUMB); }