- Add a name to VMFunction so that the disassembly can be more informative.

SVN r3768 (scripting)
This commit is contained in:
Randy Heit 2012-07-17 03:35:03 +00:00
commit 644f0c0e05
7 changed files with 53 additions and 23 deletions

View file

@ -173,6 +173,8 @@ void VMDumpConstants(FILE *out, const VMScriptFunction *func)
void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction *func)
{
VMFunction *callfunc;
const char *callname;
const char *name;
int col;
int mode;
@ -212,6 +214,12 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
col = printf_wrapper(out, "%d", code[i].i24);
break;
case OP_CALL_K:
callfunc = (VMFunction *)func->KonstA[code[i].a].o;
callname = callfunc->Name != NAME_None ? callfunc->Name : "[anonfunc]";
col = printf_wrapper(out, "%.23s,%d,%d", callname, code[i].b, code[i].c);
break;
case OP_RET:
if (code[i].b != REGT_NIL)
{
@ -308,6 +316,10 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
{
printf_wrapper(out, "%d\n", code[i].i24);
}
else if (code[i].op == OP_CALL_K)
{
printf_wrapper(out, "%d,%d,%d [%p]\n", code[i].a, code[i].b, code[i].c, callfunc);
}
else
{
printf_wrapper(out, "%d,%d,%d\n", code[i].a, code[i].b, code[i].c);