diff options
author | Martin Kiewitz | 2010-06-27 19:58:32 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-06-27 19:58:32 +0000 |
commit | 4653153910ee2186e914f5f4717e212053adef54 (patch) | |
tree | 40476be76bd234151f75331d5ad96b3120f6bf4d /engines/sci/engine/scriptdebug.cpp | |
parent | 303dc063883dab2dfe30b44d9fad9fe8e3948ec5 (diff) | |
download | scummvm-rg350-4653153910ee2186e914f5f4717e212053adef54.tar.gz scummvm-rg350-4653153910ee2186e914f5f4717e212053adef54.tar.bz2 scummvm-rg350-4653153910ee2186e914f5f4717e212053adef54.zip |
SCI: added new command "p" / "stepover" to execute one command, but skip send/calls processing. single-step is now "trace" (alias "s" and "t"), stepping till ret is "step_ret" (alias "pret"), removed unused kDebugSeek
svn-id: r50388
Diffstat (limited to 'engines/sci/engine/scriptdebug.cpp')
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 98 |
1 files changed, 51 insertions, 47 deletions
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index d829b01c31..b8a0987865 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -296,55 +296,59 @@ void script_debug(EngineState *s) { #endif if (g_debugState.seeking && !g_debugState.breakpointWasHit) { // Are we looking for something special? - SegmentObj *mobj = s->_segMan->getSegment(s->xs->addr.pc.segment, SEG_TYPE_SCRIPT); - - if (mobj) { - Script *scr = (Script *)mobj; - byte *code_buf = scr->_buf; - int code_buf_size = scr->getBufSize(); - int opcode = s->xs->addr.pc.offset >= code_buf_size ? 0 : code_buf[s->xs->addr.pc.offset]; - int op = opcode >> 1; - int paramb1 = s->xs->addr.pc.offset + 1 >= code_buf_size ? 0 : code_buf[s->xs->addr.pc.offset + 1]; - int paramf1 = (opcode & 1) ? paramb1 : (s->xs->addr.pc.offset + 2 >= code_buf_size ? 0 : (int16)READ_SCI11ENDIAN_UINT16(code_buf + s->xs->addr.pc.offset + 1)); - - switch (g_debugState.seeking) { - case kDebugSeekSpecialCallk: - if (paramb1 != g_debugState.seekSpecial) - return; - - case kDebugSeekCallk: - if (op != op_callk) - return; - break; - - case kDebugSeekLevelRet: - if ((op != op_ret) || (g_debugState.seekLevel < (int)s->_executionStack.size()-1)) - return; - break; - - case kDebugSeekGlobal: - if (op < op_sag) - return; - if ((op & 0x3) > 1) - return; // param or temp - if ((op & 0x3) && s->_executionStack.back().local_segment > 0) - return; // locals and not running in script.000 - if (paramf1 != g_debugState.seekSpecial) - return; // CORRECT global? - break; - - case kDebugSeekSO: - // FIXME: Unhandled? - break; - - case kDebugSeekNothing: - // We seek nothing, so just continue - break; - } - + if (g_debugState.seeking == kDebugSeekStepOver) { + // are we above seek-level? resume then + if (g_debugState.seekLevel < (int)s->_executionStack.size()) + return; g_debugState.seeking = kDebugSeekNothing; - // OK, found whatever we were looking for } + + if (g_debugState.seeking != kDebugSeekNothing) { + SegmentObj *mobj = s->_segMan->getSegment(s->xs->addr.pc.segment, SEG_TYPE_SCRIPT); + + if (mobj) { + Script *scr = (Script *)mobj; + byte *code_buf = scr->_buf; + int code_buf_size = scr->getBufSize(); + int opcode = s->xs->addr.pc.offset >= code_buf_size ? 0 : code_buf[s->xs->addr.pc.offset]; + int op = opcode >> 1; + int paramb1 = s->xs->addr.pc.offset + 1 >= code_buf_size ? 0 : code_buf[s->xs->addr.pc.offset + 1]; + int paramf1 = (opcode & 1) ? paramb1 : (s->xs->addr.pc.offset + 2 >= code_buf_size ? 0 : (int16)READ_SCI11ENDIAN_UINT16(code_buf + s->xs->addr.pc.offset + 1)); + + switch (g_debugState.seeking) { + case kDebugSeekSpecialCallk: + if (paramb1 != g_debugState.seekSpecial) + return; + + case kDebugSeekCallk: + if (op != op_callk) + return; + break; + + case kDebugSeekLevelRet: + if ((op != op_ret) || (g_debugState.seekLevel < (int)s->_executionStack.size()-1)) + return; + break; + + case kDebugSeekGlobal: + if (op < op_sag) + return; + if ((op & 0x3) > 1) + return; // param or temp + if ((op & 0x3) && s->_executionStack.back().local_segment > 0) + return; // locals and not running in script.000 + if (paramf1 != g_debugState.seekSpecial) + return; // CORRECT global? + break; + + default: + break; + } + + g_debugState.seeking = kDebugSeekNothing; + } + } + // OK, found whatever we were looking for } printf("Step #%d\n", s->scriptStepCounter); |