From 5e02cbd6f3701b111d3fc09ce0082cc9ce4927df Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Fri, 16 Sep 2016 11:47:12 -0700 Subject: [PATCH] Debugger: Turn off watchpoints if they aren't supported --- src/debugger/cli-debugger.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/debugger/cli-debugger.c b/src/debugger/cli-debugger.c index 19ea63671..06d895c20 100644 --- a/src/debugger/cli-debugger.c +++ b/src/debugger/cli-debugger.c @@ -378,6 +378,10 @@ static void _setWatchpoint(struct CLIDebugger* debugger, struct CLIDebugVector* printf("%s\n", ERROR_MISSING_ARGS); return; } + if (!debugger->d.platform->setWatchpoint) { + printf("Watchpoints are not supported by this platform.\n"); + return; + } uint32_t address = dv->intValue; debugger->d.platform->setWatchpoint(debugger->d.platform, address, WATCHPOINT_RW); // TODO: ro/wo } @@ -389,7 +393,9 @@ static void _clearBreakpoint(struct CLIDebugger* debugger, struct CLIDebugVector } uint32_t address = dv->intValue; debugger->d.platform->clearBreakpoint(debugger->d.platform, address); - debugger->d.platform->clearWatchpoint(debugger->d.platform, address); + if (debugger->d.platform->clearWatchpoint) { + debugger->d.platform->clearWatchpoint(debugger->d.platform, address); + } } static void _breakIntoDefault(int signal) {