mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
Alter VM_ScriptInfo() to take a ptr to the script to disassemble, and dump disassembly to the log at startup when an internal compiler error occurs.
git-svn-id: https://svn.eduke32.com/eduke32@5513 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
085333a5fb
commit
748d9ac22f
5 changed files with 16 additions and 12 deletions
|
@ -4937,7 +4937,7 @@ static void G_DumpDebugInfo(void)
|
||||||
int32_t i,j,x;
|
int32_t i,j,x;
|
||||||
// FILE * fp=fopen("condebug.log","w");
|
// FILE * fp=fopen("condebug.log","w");
|
||||||
|
|
||||||
VM_ScriptInfo();
|
VM_ScriptInfo(insptr, 64);
|
||||||
OSD_Printf("\n");
|
OSD_Printf("\n");
|
||||||
|
|
||||||
OSD_Printf("Current gamevar values:\n");
|
OSD_Printf("Current gamevar values:\n");
|
||||||
|
@ -11417,7 +11417,7 @@ static int32_t G_EndOfLevel(void)
|
||||||
void app_crashhandler(void)
|
void app_crashhandler(void)
|
||||||
{
|
{
|
||||||
G_CloseDemoWrite();
|
G_CloseDemoWrite();
|
||||||
VM_ScriptInfo();
|
VM_ScriptInfo(insptr, 64);
|
||||||
G_GameQuit();
|
G_GameQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1388,6 +1388,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
|
||||||
{
|
{
|
||||||
g_numCompilerErrors++;
|
g_numCompilerErrors++;
|
||||||
initprintf("Internal compiler error at %" PRIdPTR " (0x%" PRIxPTR ")\n",i,i);
|
initprintf("Internal compiler error at %" PRIdPTR " (0x%" PRIxPTR ")\n",i,i);
|
||||||
|
VM_ScriptInfo(&script[i], 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptptrs[i] = 1;
|
scriptptrs[i] = 1;
|
||||||
|
|
|
@ -39,6 +39,8 @@ extern "C" {
|
||||||
#define NUMCHEATCODES (int32_t)ARRAY_SIZE(CheatStrings)
|
#define NUMCHEATCODES (int32_t)ARRAY_SIZE(CheatStrings)
|
||||||
|
|
||||||
extern intptr_t const * insptr;
|
extern intptr_t const * insptr;
|
||||||
|
extern void VM_ScriptInfo(intptr_t const *ptr, int32_t range);
|
||||||
|
|
||||||
extern hashtable_t h_gamefuncs;
|
extern hashtable_t h_gamefuncs;
|
||||||
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
|
|
|
@ -94,22 +94,22 @@ GAMEEXEC_STATIC void VM_Execute(int32_t loop);
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
void VM_ScriptInfo(void)
|
extern void VM_ScriptInfo(intptr_t const *ptr, int32_t range)
|
||||||
{
|
{
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
if (!script)
|
if (!script)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (insptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
initprintf("\n");
|
initprintf("\n");
|
||||||
|
|
||||||
for (intptr_t const *p = insptr - 32; p < insptr + 32; p++)
|
for (intptr_t const *p = ptr - (range>>1); p < ptr + (range>>1); p++)
|
||||||
{
|
{
|
||||||
if ((int32_t)(p - script) >= g_scriptSize)
|
if ((int32_t)(p - script) >= g_scriptSize)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
initprintf("%5d: %3d: ", (int32_t) (p - script), (int32_t) (p - insptr));
|
initprintf("%5d: %3d: ", (int32_t) (p - script), (int32_t) (p - ptr));
|
||||||
|
|
||||||
if (*p >> 12 && (*p & VM_INSTMASK) < CON_END)
|
if (*p >> 12 && (*p & VM_INSTMASK) < CON_END)
|
||||||
initprintf("%5d %s\n", (int32_t) (*p >> 12), keyw[*p & VM_INSTMASK]);
|
initprintf("%5d %s\n", (int32_t) (*p >> 12), keyw[*p & VM_INSTMASK]);
|
||||||
|
@ -120,10 +120,13 @@ void VM_ScriptInfo(void)
|
||||||
initprintf("\n");
|
initprintf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.g_i)
|
if (ptr == insptr)
|
||||||
initprintf("current actor: %d (%d)\n", vm.g_i, TrackerCast(vm.g_sp->picnum));
|
{
|
||||||
|
if (vm.g_i)
|
||||||
|
initprintf("current actor: %d (%d)\n", vm.g_i, TrackerCast(vm.g_sp->picnum));
|
||||||
|
|
||||||
initprintf("g_errorLineNum: %d, g_tw: %d\n", g_errorLineNum, g_tw);
|
initprintf("g_errorLineNum: %d, g_tw: %d\n", g_errorLineNum, g_tw);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5471,7 +5474,7 @@ finish_qsprintf:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
VM_ScriptInfo();
|
VM_ScriptInfo(insptr, 64);
|
||||||
|
|
||||||
G_GameExit("An error has occurred in the EDuke32 virtual machine.\n\n"
|
G_GameExit("An error has occurred in the EDuke32 virtual machine.\n\n"
|
||||||
"If you are an end user, please e-mail the file eduke32.log\n"
|
"If you are an end user, please e-mail the file eduke32.log\n"
|
||||||
|
|
|
@ -90,8 +90,6 @@ static inline int32_t VM_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlay
|
||||||
return VM_HaveEvent(iEventID) ? VM_OnEvent_(iEventID, iActor, iPlayer) : 0;
|
return VM_HaveEvent(iEventID) ? VM_OnEvent_(iEventID, iActor, iPlayer) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VM_ScriptInfo(void);
|
|
||||||
|
|
||||||
#define CON_ERRPRINTF(Text, ...) do { \
|
#define CON_ERRPRINTF(Text, ...) do { \
|
||||||
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
|
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
Loading…
Reference in a new issue