aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorColin Snover2016-09-07 21:09:31 -0500
committerColin Snover2016-09-29 19:39:16 -0500
commit1de74fa514a59fbc41fa9024d91b94ee2cc1ebb7 (patch)
treeac58caf9fe5ce651165b50421266bec93aea99e9 /engines/sci/engine
parent3201440d11dde487e0ef5434cfa30066f261660f (diff)
downloadscummvm-rg350-1de74fa514a59fbc41fa9024d91b94ee2cc1ebb7.tar.gz
scummvm-rg350-1de74fa514a59fbc41fa9024d91b94ee2cc1ebb7.tar.bz2
scummvm-rg350-1de74fa514a59fbc41fa9024d91b94ee2cc1ebb7.zip
SCI: Improve debugging output for selector failures
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/selector.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index ac621f58ae..79126553d9 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -226,15 +226,14 @@ void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t
ObjVarRef address;
if ((selectorId < 0) || (selectorId > (int)g_sci->getKernel()->getSelectorNamesSize())) {
- error("Attempt to write to invalid selector %d of"
- " object at %04x:%04x.", selectorId, PRINT_REG(object));
- return;
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("Attempt to write to invalid selector %d. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", selectorId, PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
}
- if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable)
- error("Selector '%s' of object at %04x:%04x could not be"
- " written to", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
- else {
+ if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable) {
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("Selector '%s' of object could not be written to. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
+ } else {
*address.getPointer(segMan) = value;
#ifdef ENABLE_SCI32
updateInfoFlagViewVisible(segMan->getObject(object), selectorId);
@@ -255,12 +254,12 @@ void invokeSelector(EngineState *s, reg_t object, int selectorId,
slc_type = lookupSelector(s->_segMan, object, selectorId, NULL, NULL);
if (slc_type == kSelectorNone) {
- error("Selector '%s' of object at %04x:%04x could not be invoked",
- g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("invokeSelector: Selector '%s' could not be invoked. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
}
if (slc_type == kSelectorVariable) {
- error("Attempting to invoke variable selector %s of object %04x:%04x",
- g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("invokeSelector: Attempting to invoke variable selector %s. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
}
for (i = 0; i < argc; i++)
@@ -288,8 +287,8 @@ SelectorType lookupSelector(SegManager *segMan, reg_t obj_location, Selector sel
selectorId &= ~1;
if (!obj) {
- error("lookupSelector(): Attempt to send to non-object or invalid script. Address was %04x:%04x",
- PRINT_REG(obj_location));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("lookupSelector: Attempt to send to non-object or invalid script. Address %04x:%04x, method %s::%s (room %d, script %d, localCall %x)", PRINT_REG(obj_location), origin.objectName.c_str(), origin.methodName.c_str(), origin.roomNr, origin.scriptNr, origin.localCallOffset);
}
index = obj->locateVarSelector(segMan, selectorId);