From: divverent Date: Mon, 6 Jan 2014 10:00:04 +0000 (+0000) Subject: Patch by graphitemaster to support column number enhanced lno format. X-Git-Tag: xonotic-v0.8.0~97 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a02138f9f6d849a29a792e6eb6cef100bd79360b;p=xonotic%2Fdarkplaces.git Patch by graphitemaster to support column number enhanced lno format. From: Dale Weiler git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12040 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=48dd658f8bbfa60efbd5f56d1c208727c4418078 --- diff --git a/progsvm.h b/progsvm.h index acaf6df0..e1fd5055 100644 --- a/progsvm.h +++ b/progsvm.h @@ -562,6 +562,7 @@ typedef struct prvm_prog_s int numglobals; int *statement_linenums; // NULL if not available + int *statement_columnnums; // NULL if not available double *statement_profile; // only incremented if prvm_statementprofiling is on diff --git a/prvm_edict.c b/prvm_edict.c index 12781fdc..882a558a 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1887,7 +1887,14 @@ static void PRVM_LoadLNO( prvm_prog_t *prog, const char *progname ) { (unsigned int)LittleLong( header[ 5 ] ) == (unsigned int)prog->progs_numstatements ) { prog->statement_linenums = (int *)Mem_Alloc(prog->progs_mempool, prog->progs_numstatements * sizeof( int ) ); - memcpy( prog->statement_linenums, (int *) lno + 6, prog->progs_numstatements * sizeof( int ) ); + memcpy( prog->statement_linenums, header + 6, prog->progs_numstatements * sizeof( int ) ); + + /* gmqcc suports columnums */ + if ((unsigned int)filesize > ((6 + 2 * prog->progs_numstatements) * sizeof( int ))) + { + prog->statement_columnnums = (int *)Mem_Alloc(prog->progs_mempool, prog->progs_numstatements * sizeof( int ) ); + memcpy( prog->statement_columnnums, header + 6 + prog->progs_numstatements, prog->progs_numstatements * sizeof( int ) ); + } } Mem_Free( lno ); } diff --git a/prvm_exec.c b/prvm_exec.c index fee9d829..40b19d44 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -129,7 +129,12 @@ static void PRVM_PrintStatement(prvm_prog_t *prog, mstatement_t *s) Con_Printf("s%i: ", opnum); if( prog->statement_linenums ) - Con_Printf( "%s:%i: ", PRVM_GetString( prog, prog->xfunction->s_file ), prog->statement_linenums[ opnum ] ); + { + if ( prog->statement_columnnums ) + Con_Printf( "%s:%i:%i: ", PRVM_GetString( prog, prog->xfunction->s_file ), prog->statement_linenums[ opnum ], prog->statement_columnnums[ opnum ] ); + else + Con_Printf( "%s:%i: ", PRVM_GetString( prog, prog->xfunction->s_file ), prog->statement_linenums[ opnum ] ); + } if (prvm_statementprofiling.integer) Con_Printf("%7.0f ", prog->statement_profile[s - prog->statements]); @@ -226,7 +231,12 @@ void PRVM_StackTrace (prvm_prog_t *prog) else { if (prog->statement_linenums) - Con_Printf("%12s:%i : %s : statement %i\n", PRVM_GetString(prog, f->s_file), prog->statement_linenums[prog->stack[i].s], PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement); + { + if (prog->statement_columnnums) + Con_Printf("%12s:%i:%i : %s : statement %i\n", PRVM_GetString(prog, f->s_file), prog->statement_linenums[prog->stack[i].s], prog->statement_columnnums[prog->stack[i].s], PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement); + else + Con_Printf("%12s:%i : %s : statement %i\n", PRVM_GetString(prog, f->s_file), prog->statement_linenums[prog->stack[i].s], PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement); + } else Con_Printf("%12s : %s : statement %i\n", PRVM_GetString(prog, f->s_file), PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement); }