[Scummvm-cvs-logs] SF.net SVN: scummvm:[50792] scummvm/trunk/engines/sci/engine/vm.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sat Jul 10 22:50:53 CEST 2010
Revision: 50792
http://scummvm.svn.sourceforge.net/scummvm/?rev=50792&view=rev
Author: m_kiewitz
Date: 2010-07-10 20:50:52 +0000 (Sat, 10 Jul 2010)
Log Message:
-----------
SCI: adding to execstack only right before executing kernel call, otherwise it wouldnt be possible to skip over sub-function kernel calls via workarounds
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/vm.cpp
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-10 20:45:59 UTC (rev 50791)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-10 20:50:52 UTC (rev 50792)
@@ -776,6 +776,17 @@
}
}
+static void addKernelCallToExecStack(EngineState *s, int kernelCallNr, int argc, reg_t *argv) {
+ // 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->_executionStack, NULL_REG, NULL, NULL_REG, argc, argv - 1, 0, -1, -1, NULL_REG,
+ s->_executionStack.size()-1, SCI_XS_CALLEE_LOCALS);
+ xstack->debugSelector = kernelCallNr;
+ xstack->type = EXEC_STACK_TYPE_KERNEL;
+}
+
static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
Kernel *kernel = g_sci->getKernel();
@@ -802,17 +813,10 @@
return;
}
- // 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->_executionStack, NULL_REG, NULL, NULL_REG, argc, argv - 1, 0, -1, -1, NULL_REG,
- s->_executionStack.size()-1, SCI_XS_CALLEE_LOCALS);
- xstack->debugSelector = kernelCallNr;
- xstack->type = EXEC_STACK_TYPE_KERNEL;
// Call kernel function
if (!kernelCall.subFunctionCount) {
+ addKernelCallToExecStack(s, kernelCallNr, argc, argv);
s->r_acc = kernelCall.function(s, argc, argv);
} else {
// Sub-functions available, check signature and call that one directly
@@ -847,6 +851,7 @@
}
if (!kernelSubCall.function)
error("[VM] k%s: subfunction-id %d requested, but not available", kernelCall.name, subId);
+ addKernelCallToExecStack(s, kernelCallNr, argc, argv);
s->r_acc = kernelSubCall.function(s, argc, argv);
}
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