]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Patch by graphitemaster to support column number enhanced lno format.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 6 Jan 2014 10:00:04 +0000 (10:00 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 6 Jan 2014 10:14:28 +0000 (11:14 +0100)
From: Dale Weiler <killfieldengine@gmail.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12040 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=48dd658f8bbfa60efbd5f56d1c208727c4418078

progsvm.h
prvm_edict.c
prvm_exec.c

index acaf6df0e35f1ad9f5dfbe98f7676e2f9ada84c7..e1fd5055fe8b5b6d631f15cec0c4d4376d3a3eee 100644 (file)
--- 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
 
index 12781fdc10da743f51814dc2c34e07d371c45776..882a558a99b17b603ea2a6a244def2683120c552 100644 (file)
@@ -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 );
 }
index fee9d82995d7d67edb94313bf2176e50cb2521a5..40b19d44c9b3c91a4628134ec1963c660a094b93 100644 (file)
@@ -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);
                }