diff options
author | Colin Snover | 2016-11-05 17:56:15 -0500 |
---|---|---|
committer | Colin Snover | 2016-11-20 12:31:43 -0600 |
commit | 9380b541204e2ec446d75627b8fad1b78850f356 (patch) | |
tree | 16340e97cc926cd44332c7bad5b1cb74c9467055 /engines/sci/engine | |
parent | 1af7fe8b9616c5ade0af00b7720db0b4967471ff (diff) | |
download | scummvm-rg350-9380b541204e2ec446d75627b8fad1b78850f356.tar.gz scummvm-rg350-9380b541204e2ec446d75627b8fad1b78850f356.tar.bz2 scummvm-rg350-9380b541204e2ec446d75627b8fad1b78850f356.zip |
SCI: Add code-address breakpoints to debugger
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 16 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index b017e62df7..47b360d13b 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -631,6 +631,22 @@ bool SciEngine::checkExportBreakpoint(uint16 script, uint16 pubfunct) { return false; } +bool SciEngine::checkAddressBreakpoint(const reg32_t &address) { + if (_debugState._activeBreakpointTypes & BREAK_ADDRESS) { + Common::List<Breakpoint>::const_iterator bp; + for (bp = _debugState._breakpoints.begin(); bp != _debugState._breakpoints.end(); ++bp) { + if (bp->type == BREAK_ADDRESS && bp->regAddress == address) { + _console->debugPrintf("Break at %04x:%04x\n", PRINT_REG(address)); + _debugState.debugging = true; + _debugState.breakpointWasHit = true; + return true; + } + } + } + + return false; +} + 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); diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index ac15aebf3a..e82128ebad 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -634,6 +634,8 @@ void run_vm(EngineState *s) { if (s->abortScriptProcessing != kAbortNone) return; // Stop processing + g_sci->checkAddressBreakpoint(s->xs->addr.pc); + // Debug if this has been requested: // TODO: re-implement sci_debug_flags if (g_sci->_debugState.debugging /* sci_debug_flags*/) { |