X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=prvm_exec.c;h=2f8c97aeebc3d12de5e056dc07e4ed1261029017;hb=43cc4b0b887c9bae4437858fda3a5a398b49010b;hp=ab166f35bbe3b733864e290501a01a0f4b3b64bf;hpb=56561de0acdb9cf29d155992440ac3e0d32909dd;p=xonotic%2Fdarkplaces.git diff --git a/prvm_exec.c b/prvm_exec.c index ab166f35..2f8c97ae 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -123,7 +123,14 @@ PRVM_PrintStatement */ void PRVM_PrintStatement (dstatement_t *s) { - int i; + size_t i; + + if( prog->statement_linenums ) { + int opnum; + + opnum = s - prog->statements; + Con_Printf( "%s:%i: ", PRVM_GetString( prog->xfunction->s_file ), prog->statement_linenums[ opnum ] ); + } if ( (unsigned)s->op < sizeof(prvm_opnames)/sizeof(prvm_opnames[0])) { @@ -199,7 +206,7 @@ void PRVM_Profile_f (void) Con_Print("prvm_profile \n"); return; } - + PRVM_Begin; if(!PRVM_SetProgFromString(Cmd_Argv(1))) return; @@ -227,6 +234,7 @@ void PRVM_Profile_f (void) num++; best->profile = 0; best->builtinsprofile = 0; + best->callcount = 0; } } while (best); @@ -245,7 +253,7 @@ void PRVM_CrashAll() PRVM_SetProg(i); PRVM_Crash(); } - + prog = oldprog; } @@ -265,6 +273,9 @@ void PRVM_PrintState(void) void PRVM_Crash() { + if (prog == NULL) + return; + if( prog->depth > 0 ) { Con_Printf("QuakeC crash report for %s:\n", PRVM_NAME); @@ -299,7 +310,7 @@ int PRVM_EnterFunction (mfunction_t *f) int i, j, c, o; if (!f) - PRVM_ERROR ("PRVM_EnterFunction: NULL function in %s\n", PRVM_NAME); + PRVM_ERROR ("PRVM_EnterFunction: NULL function in %s", PRVM_NAME); prog->stack[prog->depth].s = prog->xstatement; prog->stack[prog->depth].f = prog->xfunction; @@ -310,7 +321,7 @@ int PRVM_EnterFunction (mfunction_t *f) // save off any locals that the new function steps on c = f->locals; if (prog->localstack_used + c > PRVM_LOCALSTACK_SIZE) - PRVM_ERROR ("PRVM_ExecuteProgram: locals stack overflow in %s\n", PRVM_NAME); + PRVM_ERROR ("PRVM_ExecuteProgram: locals stack overflow in %s", PRVM_NAME); for (i=0 ; i < c ; i++) prog->localstack[prog->localstack_used+i] = ((int *)prog->globals.generic)[f->parm_start + i]; @@ -344,12 +355,12 @@ int PRVM_LeaveFunction (void) PRVM_ERROR ("prog stack underflow in %s", PRVM_NAME); if (!prog->xfunction) - PRVM_ERROR ("PR_LeaveFunction: NULL function in %s\n", PRVM_NAME); + PRVM_ERROR ("PR_LeaveFunction: NULL function in %s", PRVM_NAME); // restore locals from the stack c = prog->xfunction->locals; prog->localstack_used -= c; if (prog->localstack_used < 0) - PRVM_ERROR ("PRVM_ExecuteProgram: locals stack underflow in %s\n", PRVM_NAME); + PRVM_ERROR ("PRVM_ExecuteProgram: locals stack underflow in %s", PRVM_NAME); for (i=0 ; i < c ; i++) ((int *)prog->globals.generic)[prog->xfunction->parm_start + i] = prog->localstack[prog->localstack_used+i]; @@ -381,7 +392,7 @@ PRVM_ExecuteProgram extern cvar_t prvm_boundscheck; extern cvar_t prvm_traceqc; extern int PRVM_ED_FindFieldOffset (const char *field); -extern ddef_t* PRVM_ED_FindGlobal(const char *name); +extern ddef_t* PRVM_ED_FindGlobal(const char *name); void PRVM_ExecuteProgram (func_t fnum, const char *errormessage) { dstatement_t *st;