[Scummvm-cvs-logs] SF.net SVN: scummvm:[44473] scummvm/trunk/engines/sci/engine
wjpalenstijn at users.sourceforge.net
wjpalenstijn at users.sourceforge.net
Wed Sep 30 02:14:00 CEST 2009
Revision: 44473
http://scummvm.svn.sourceforge.net/scummvm/?rev=44473&view=rev
Author: wjpalenstijn
Date: 2009-09-30 00:13:59 +0000 (Wed, 30 Sep 2009)
Log Message:
-----------
SCI: Add callk stackframe directly in run_vm
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/selector.cpp
scummvm/trunk/engines/sci/engine/vm.cpp
Modified: scummvm/trunk/engines/sci/engine/selector.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.cpp 2009-09-29 22:43:30 UTC (rev 44472)
+++ scummvm/trunk/engines/sci/engine/selector.cpp 2009-09-30 00:13:59 UTC (rev 44473)
@@ -84,15 +84,7 @@
}
va_end(argp);
- // Write "kernel" call to the stack, for debugging:
ExecStack *xstack;
- xstack = add_exec_stack_entry(s, NULL_REG, NULL, NULL_REG, k_argc, k_argp - 1, 0, NULL_REG,
- s->_executionStack.size()-1, SCI_XS_CALLEE_LOCALS);
- // FIXME: With this hack, selector was set to -42 - kfunct, which has been changed, as we
- // no longer pass the function number to each function (commit #44461). Therefore, this no
- // longer works. A better alternative needs to be done to restore the previous functionality
- xstack->selector = -42 + 1; // Evil debugging hack to identify kernel function
- xstack->type = EXEC_STACK_TYPE_KERNEL;
// Now commit the actual function:
xstack = send_selector(s, object, object, stackframe, framesize, stackframe);
@@ -102,8 +94,6 @@
run_vm(s, 0); // Start a new vm
- s->_executionStack.pop_back(); // Get rid of the extra stack entry
-
return 0;
}
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2009-09-29 22:43:30 UTC (rev 44472)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2009-09-30 00:13:59 UTC (rev 44473)
@@ -946,7 +946,21 @@
reg_t *argv = scriptState.xs->sp + 1;
if (!kfun.isDummy) {
+ // Add stack frame to indicate we're executing a callk.
+ // This is useful in debugger backtraces if this
+ // kernel function calls a script itself.
+ ExecStack *xstack;
+ xstack = add_exec_stack_entry(s, NULL_REG, NULL, NULL_REG, argc, argv - 1, 0, NULL_REG,
+ s->_executionStack.size()-1, SCI_XS_CALLEE_LOCALS);
+ // Debugging hack to identify kernel function
+ xstack->selector = -42 - opparams[0];
+ xstack->type = EXEC_STACK_TYPE_KERNEL;
+
+ // Call kernel function
s->r_acc = kfun.fun(s, argc, argv);
+
+ // Remove callk stack frame again
+ s->_executionStack.pop_back();
} else {
Common::String warningMsg = "Dummy function " + kfun.orig_name + "[";
warningMsg += warningMsg.printf("0x%x", opparams[0]);
@@ -962,7 +976,6 @@
warning(warningMsg.c_str());
}
}
- // Call kernel function
// Calculate xs again: The kernel function might
// have spawned a new VM
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list