From ecdd61d7b243eb83354ce07232ed5247e5075ec3 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 23 Mar 2009 18:11:30 +0000 Subject: [PATCH] in PRVM state dumps, also dump a special extra string if prvm_backtraceforwarnings = 1 that can be specified by other code currently, this is used to be able to track down the invalid tempstrings in savegame saving git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8824 d7cf8633-e32d-0410-b094-e92efae38249 --- progsvm.h | 4 +++- prvm_edict.c | 4 ++++ prvm_exec.c | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/progsvm.h b/progsvm.h index d53c6f42..4a13dd56 100644 --- a/progsvm.h +++ b/progsvm.h @@ -431,6 +431,9 @@ typedef struct prvm_prog_s qboolean loaded; qboolean leaktest_active; + // printed together with backtraces + const char *statestring; + // prvm_builtin_mem_t *mem_list; // now passed as parameter of PRVM_LoadProgs @@ -458,7 +461,6 @@ typedef struct prvm_prog_s void (*reset_cmd)(void); // [INIT] used by PRVM_ResetProg void (*error_cmd)(const char *format, ...) DP_FUNC_PRINTF(1); // [INIT] - } prvm_prog_t; extern prvm_prog_t * prog; diff --git a/prvm_edict.c b/prvm_edict.c index f0ae041d..cb1509cb 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -732,7 +732,9 @@ void PRVM_ED_Write (qfile_t *f, prvm_edict_t *ed) continue; FS_Printf(f,"\"%s\" ",name); + prog->statestring = va("PRVM_ED_Write, ent=%d, name=%s", i, name); FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString((etype_t)d->type, (prvm_eval_t *)v)); + prog->statestring = NULL; } FS_Print(f, "}\n"); @@ -900,8 +902,10 @@ void PRVM_ED_WriteGlobals (qfile_t *f) if(developer_entityparsing.integer) Con_Printf("PRVM_ED_WriteGlobals: at global %s\n", name); + prog->statestring = va("PRVM_ED_WriteGlobals, name=%s", name); FS_Printf(f,"\"%s\" ", name); FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString((etype_t)type, (prvm_eval_t *)&prog->globals.generic[def->ofs])); + prog->statestring = NULL; } FS_Print(f,"}\n"); } diff --git a/prvm_exec.c b/prvm_exec.c index ae340eec..8bb0d77a 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -452,6 +452,10 @@ void PRVM_PrintState(void) else Con_Print("null function executing??\n"); PRVM_StackTrace (); + if(prog->statestring) + { + Con_Printf("Additional information: %s\n", prog->statestring); + } } extern sizebuf_t vm_tempstringsbuf; -- 2.39.2