diff options
author | Willem Jan Palenstijn | 2017-05-27 20:26:57 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2017-06-10 21:32:35 +0200 |
commit | e2e3f7c4c51e64df05b3252379bcc56f52b576dc (patch) | |
tree | 7ba3bb19a5309402e5fa0c218bffe4f4f7ced252 /engines/sci/engine/scriptdebug.cpp | |
parent | 0f0ecff0b8b095205a3a1c9b9a133f283d1ad39b (diff) | |
download | scummvm-rg350-e2e3f7c4c51e64df05b3252379bcc56f52b576dc.tar.gz scummvm-rg350-e2e3f7c4c51e64df05b3252379bcc56f52b576dc.tar.bz2 scummvm-rg350-e2e3f7c4c51e64df05b3252379bcc56f52b576dc.zip |
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.
Diffstat (limited to 'engines/sci/engine/scriptdebug.cpp')
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
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<Breakpoint>::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); |