SCI: Stop getCurrentCallOrigin from mutating stack frames
This fixes incorrect backtraces after a workaround failure or other call to getCurrentCallOrigin when one or more stack frames are calls to local procedures.
This commit is contained in:
parent
5723f2f5fe
commit
a1153661c4
2 changed files with 11 additions and 8 deletions
|
@ -390,26 +390,29 @@ SciCallOrigin EngineState::getCurrentCallOrigin() const {
|
|||
const Script *localScript = _segMan->getScriptIfLoaded(xs->local_segment);
|
||||
int curScriptNr = localScript->getScriptNumber();
|
||||
|
||||
Selector debugSelector = xs->debugSelector;
|
||||
int debugExportId = xs->debugExportId;
|
||||
|
||||
if (xs->debugLocalCallOffset != -1) {
|
||||
// if lastcall was actually a local call search back for a real call
|
||||
Common::List<ExecStack>::const_iterator callIterator = _executionStack.end();
|
||||
while (callIterator != _executionStack.begin()) {
|
||||
callIterator--;
|
||||
const ExecStack &loopCall = *callIterator;
|
||||
if ((loopCall.debugSelector != -1) || (loopCall.debugExportId != -1)) {
|
||||
xs->debugSelector = loopCall.debugSelector;
|
||||
xs->debugExportId = loopCall.debugExportId;
|
||||
if (loopCall.debugSelector != -1 || loopCall.debugExportId != -1) {
|
||||
debugSelector = loopCall.debugSelector;
|
||||
debugExportId = loopCall.debugExportId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (xs->type == EXEC_STACK_TYPE_CALL) {
|
||||
if (xs->debugSelector != -1) {
|
||||
curMethodName = g_sci->getKernel()->getSelectorName(xs->debugSelector);
|
||||
} else if (xs->debugExportId != -1) {
|
||||
if (debugSelector != -1) {
|
||||
curMethodName = g_sci->getKernel()->getSelectorName(debugSelector);
|
||||
} else if (debugExportId != -1) {
|
||||
curObjectName = "";
|
||||
curMethodName = Common::String::format("export %d", xs->debugExportId);
|
||||
curMethodName = Common::String::format("export %d", debugExportId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -876,7 +876,7 @@ const SciWorkaroundEntry kScrollWindowAdd_workarounds[] = {
|
|||
|
||||
SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciCallOrigin *trackOrigin) {
|
||||
const EngineState *state = g_sci->getEngineState();
|
||||
ExecStack *lastCall = state->xs;
|
||||
const ExecStack *lastCall = state->xs;
|
||||
const SciGameId gameId = g_sci->getGameId();
|
||||
|
||||
*trackOrigin = state->getCurrentCallOrigin();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue