aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/scriptdebug.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2017-05-26 14:12:41 +0200
committerWillem Jan Palenstijn2017-06-10 21:32:35 +0200
commit8e683db72b280fbe4319d68466c7f3c61a6c107d (patch)
treef7d23f413eef10dabad968083696d87b2d83c7c3 /engines/sci/engine/scriptdebug.cpp
parentcb69d10e962e2cea604175fdd35189726f6a6436 (diff)
downloadscummvm-rg350-8e683db72b280fbe4319d68466c7f3c61a6c107d.tar.gz
scummvm-rg350-8e683db72b280fbe4319d68466c7f3c61a6c107d.tar.bz2
scummvm-rg350-8e683db72b280fbe4319d68466c7f3c61a6c107d.zip
SCI: Add break/log/backtrace actions for triggered breakpoints
The action can be set using the new console command bp_action/bpact.
Diffstat (limited to 'engines/sci/engine/scriptdebug.cpp')
-rw-r--r--engines/sci/engine/scriptdebug.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index a4392983a1..c5a617a17a 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -28,6 +28,7 @@
#include "sci/engine/state.h"
#include "sci/engine/kernel.h"
#include "sci/engine/script.h"
+#include "sci/engine/scriptdebug.h"
namespace Sci {
@@ -690,8 +691,12 @@ bool SciEngine::checkSelectorBreakpoint(BreakpointType breakpointType, reg_t sen
if (bpIter->_name == methodName ||
(bpIter->_name.hasSuffix("::") && methodName.hasPrefix(bpIter->_name))) {
_console->debugPrintf("Break on %s (in [%04x:%04x])\n", methodName.c_str(), PRINT_REG(send_obj));
- _debugState.debugging = true;
- _debugState.breakpointWasHit = true;
+ if (bpIter->_action == BREAK_BREAK) {
+ _debugState.debugging = true;
+ _debugState.breakpointWasHit = true;
+ } else if (bpIter->_action == BREAK_BACKTRACE) {
+ logBacktrace();
+ }
return true;
}
}
@@ -706,8 +711,12 @@ bool SciEngine::checkExportBreakpoint(uint16 script, uint16 pubfunct) {
for (bp = _debugState._breakpoints.begin(); bp != _debugState._breakpoints.end(); ++bp) {
if (bp->_type == BREAK_EXPORT && bp->_address == bpaddress) {
_console->debugPrintf("Break on script %d, export %d\n", script, pubfunct);
- _debugState.debugging = true;
- _debugState.breakpointWasHit = true;
+ if (bp->_action == BREAK_BREAK) {
+ _debugState.debugging = true;
+ _debugState.breakpointWasHit = true;
+ } else if (bp->_action == BREAK_BACKTRACE) {
+ logBacktrace();
+ }
return true;
}
}
@@ -722,8 +731,12 @@ bool SciEngine::checkAddressBreakpoint(const reg32_t &address) {
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;
+ if (bp->_action == BREAK_BREAK) {
+ _debugState.debugging = true;
+ _debugState.breakpointWasHit = true;
+ } else if (bp->_action == BREAK_BACKTRACE) {
+ logBacktrace();
+ }
return true;
}
}