From e2e3f7c4c51e64df05b3252379bcc56f52b576dc Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 27 May 2017 20:26:57 +0200 Subject: SCI: Move bpk/logkernel to main breakpoint infrastructure This changes the syntax for bpk and logkernel: Enable breakpoint on kernel call: bpk FrameOut Enable logging for kernel call: bpk FrameOut log For backward compatibility this has an alias: logkernel FrameOut Removing a kernel call breakpoint is done with bp_del/bc now. --- engines/sci/engine/scriptdebug.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'engines/sci/engine/scriptdebug.cpp') diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index e2522414e9..9f1b536fec 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -779,6 +779,44 @@ bool SciEngine::checkAddressBreakpoint(const reg32_t &address) { return found; } +bool SciEngine::checkKernelBreakpoint(const Common::String &name) { + bool found = false; + + if (_debugState._activeBreakpointTypes & BREAK_KERNEL) { + + Common::List::const_iterator bp; + for (bp = _debugState._breakpoints.begin(); bp != _debugState._breakpoints.end(); ++bp) { + if (bp->_action == BREAK_NONE) + continue; + if (bp->_type != BREAK_KERNEL) + continue; + + bool wildcard = bp->_name.lastChar() == '*'; + Common::String prefix = bp->_name; + if (wildcard) + prefix.deleteLastChar(); + if (bp->_name == name || (wildcard && name.hasPrefix(prefix))) { + if (bp->_action == BREAK_BREAK) { + if (!found) + _console->debugPrintf("Break on k%s\n", name.c_str()); + _debugState.debugging = true; + _debugState.breakpointWasHit = true; + } else if (bp->_action == BREAK_BACKTRACE) { + if (!found) + _console->debugPrintf("Break on k%s\n", name.c_str()); + logBacktrace(); + } else if (bp->_action == BREAK_INSPECT) { + // Ignoring this mode, to make it identical to BREAK_LOG + } + found = true; + } + } + } + + return found; +} + + void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr argp, ObjVarRef &varp, reg_t funcp, SegManager *segMan, SelectorType selectorType) { int activeBreakpointTypes = g_sci->_debugState._activeBreakpointTypes; const char *objectName = segMan->getObjectName(send_obj); -- cgit v1.2.3