From 0f0ecff0b8b095205a3a1c9b9a133f283d1ad39b Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 27 May 2017 13:08:21 +0200 Subject: SCI: Print breakpoint info on creation --- engines/sci/console.cpp | 91 +++++++++++++++++++++++++++---------------------- engines/sci/console.h | 2 ++ 2 files changed, 52 insertions(+), 41 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 1fab99be67..3840e33548 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -3722,54 +3722,55 @@ bool Console::cmdLogKernel(int argc, const char **argv) { return true; } +void Console::printBreakpoint(int index, const Breakpoint &bp) { + debugPrintf(" #%i: ", index); + const char *bpaction; + + switch (bp._action) { + case BREAK_LOG: + bpaction = " (action: log only)"; + break; + case BREAK_BACKTRACE: + bpaction = " (action: show backtrace)"; + break; + case BREAK_INSPECT: + bpaction = " (action: show object)"; + break; + case BREAK_NONE: + bpaction = " (action: ignore)"; + break; + default: + bpaction = ""; + } + switch (bp._type) { + case BREAK_SELECTOREXEC: + debugPrintf("Execute %s%s\n", bp._name.c_str(), bpaction); + break; + case BREAK_SELECTORREAD: + debugPrintf("Read %s%s\n", bp._name.c_str(), bpaction); + break; + case BREAK_SELECTORWRITE: + debugPrintf("Write %s%s\n", bp._name.c_str(), bpaction); + break; + case BREAK_EXPORT: { + int bpdata = bp._address; + debugPrintf("Execute script %d, export %d%s\n", bpdata >> 16, bpdata & 0xFFFF, bpaction); + break; + } + case BREAK_ADDRESS: + debugPrintf("Execute address %04x:%04x%s\n", PRINT_REG(bp._regAddress), bpaction); + } +} + bool Console::cmdBreakpointList(int argc, const char **argv) { int i = 0; - int bpdata; debugPrintf("Breakpoint list:\n"); Common::List::const_iterator bp = _debugState._breakpoints.begin(); Common::List::const_iterator end = _debugState._breakpoints.end(); - for (; bp != end; ++bp) { - debugPrintf(" #%i: ", i); - const char *bpaction; - - switch (bp->_action) { - case BREAK_LOG: - bpaction = " (action: log only)"; - break; - case BREAK_BACKTRACE: - bpaction = " (action: show backtrace)"; - break; - case BREAK_INSPECT: - bpaction = " (action: show object)"; - break; - case BREAK_NONE: - bpaction = " (action: ignore)"; - break; - default: - bpaction = ""; - } - switch (bp->_type) { - case BREAK_SELECTOREXEC: - debugPrintf("Execute %s%s\n", bp->_name.c_str(), bpaction); - break; - case BREAK_SELECTORREAD: - debugPrintf("Read %s%s\n", bp->_name.c_str(), bpaction); - break; - case BREAK_SELECTORWRITE: - debugPrintf("Write %s%s\n", bp->_name.c_str(), bpaction); - break; - case BREAK_EXPORT: - bpdata = bp->_address; - debugPrintf("Execute script %d, export %d%s\n", bpdata >> 16, bpdata & 0xFFFF, bpaction); - break; - case BREAK_ADDRESS: - debugPrintf("Execute address %04x:%04x%s\n", PRINT_REG(bp->_regAddress), bpaction); - } - - i++; - } + for (; bp != end; ++bp) + printBreakpoint(i++, *bp); if (!i) debugPrintf(" No breakpoints defined.\n"); @@ -3881,6 +3882,8 @@ bool Console::cmdBreakpointAction(int argc, const char **argv) { _debugState.updateActiveBreakpointTypes(); + printBreakpoint(idx, *bp); + return true; } @@ -3919,6 +3922,8 @@ bool Console::cmdBreakpointMethod(int argc, const char **argv) { if (action != BREAK_NONE) _debugState._activeBreakpointTypes |= BREAK_SELECTOREXEC; + printBreakpoint(_debugState._breakpoints.size() - 1, bp); + return true; } @@ -3951,6 +3956,8 @@ bool Console::cmdBreakpointRead(int argc, const char **argv) { if (action != BREAK_NONE) _debugState._activeBreakpointTypes |= BREAK_SELECTORREAD; + printBreakpoint(_debugState._breakpoints.size() - 1, bp); + return true; } @@ -3983,6 +3990,8 @@ bool Console::cmdBreakpointWrite(int argc, const char **argv) { if (action != BREAK_NONE) _debugState._activeBreakpointTypes |= BREAK_SELECTORWRITE; + printBreakpoint(_debugState._breakpoints.size() - 1, bp); + return true; } diff --git a/engines/sci/console.h b/engines/sci/console.h index 75243e52b3..0b8cd938ae 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -191,6 +191,8 @@ private: */ void printKernelCallsFound(int kernelFuncNum, bool showFoundScripts); + void printBreakpoint(int index, const Breakpoint &bp); + SciEngine *_engine; DebugState &_debugState; Common::String _videoFile; -- cgit v1.2.3