Added better script interpreter logging.

This commit is contained in:
Jeff Hutchinson 2018-04-14 10:59:09 -04:00
parent 188fba2049
commit babe32ae7b

View file

@ -2132,12 +2132,27 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
{
if (!mExec.noCalls && !(routingId == MethodOnComponent))
{
Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName);
if (callType == FuncCallExprNode::MethodCall && gEvalState.thisObject != NULL)
if (callType == FuncCallExprNode::MethodCall)
{
Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s",
gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "",
gEvalState.thisObject->getId(), Con::getNamespaceList(ns));
if (gEvalState.thisObject != NULL)
{
// Try to use the name instead of the id
StringTableEntry name = gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : gEvalState.thisObject->getIdString();
Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns));
}
else
{
// NULL.
Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName);
}
}
else if (callType == FuncCallExprNode::ParentCall)
{
Con::warnf(ConsoleLogEntry::General, "%s: Unknown parent call %s.", mCodeBlock->getFileLine(ip - 6), fnName);
}
else
{
Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName);
}
}
STR.popFrame();
@ -2328,7 +2343,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip)
{
if (!mExec.noCalls)
{
Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName);
Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName);
}
STR.popFrame();
CSTK.popFrame();
@ -2521,17 +2536,16 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip)
{
if (!mExec.noCalls)
{
Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName);
if (mThisObject)
{
Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s",
mThisObject->getName() ? mThisObject->getName() : "",
mThisObject->getId(), Con::getNamespaceList(ns));
// Try to use the name instead of the id
StringTableEntry name = mThisObject->getName() ? mThisObject->getName() : mThisObject->getIdString();
Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns));
}
else
{
// At least let the scripter know that they access the object.
Con::warnf(ConsoleLogEntry::General, " Object is NULL.");
Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName);
}
}
STR.popFrame();