From c9c9ff802c424c39a7b5be207789152553944e6d Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 8 Aug 2015 02:26:35 -0700 Subject: [PATCH] Debugger: Only support breaking into the external debugger in debug builds --- src/debugger/cli-debugger.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/debugger/cli-debugger.c b/src/debugger/cli-debugger.c index f7d1014d5..c3f0c9de1 100644 --- a/src/debugger/cli-debugger.c +++ b/src/debugger/cli-debugger.c @@ -18,7 +18,9 @@ static const char* ERROR_OVERFLOW = "Arguments overflow"; static struct CLIDebugger* _activeDebugger; +#ifndef NDEBUG static void _breakInto(struct CLIDebugger*, struct CLIDebugVector*); +#endif static void _continue(struct CLIDebugger*, struct CLIDebugVector*); static void _disassemble(struct CLIDebugger*, struct CLIDebugVector*); static void _disassembleArm(struct CLIDebugger*, struct CLIDebugVector*); @@ -99,7 +101,9 @@ static struct CLIDebuggerCommandSummary _debuggerCommands[] = { { "x/1", _dumpByte, CLIDVParse, "Examine bytes at a specified offset" }, { "x/2", _dumpHalfword, CLIDVParse, "Examine halfwords at a specified offset" }, { "x/4", _dumpWord, CLIDVParse, "Examine words at a specified offset" }, +#ifndef NDEBUG { "!", _breakInto, 0, "Break into attached debugger (for developers)" }, +#endif { 0, 0, 0, 0 } }; @@ -114,6 +118,7 @@ static inline void _printPSR(union PSR psr) { psr.t ? 'T' : '-'); } +#ifndef NDEBUG static void _handleDeath(int sig) { UNUSED(sig); printf("No debugger attached!\n"); @@ -135,6 +140,7 @@ static void _breakInto(struct CLIDebugger* debugger, struct CLIDebugVector* dv) #endif sigaction(SIGTRAP, &osa, 0); } +#endif static void _continue(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { UNUSED(dv);