From b4defb722aac438430d075eb955fd2c569249dea Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 6 Dec 2008 02:08:07 +0000 Subject: [PATCH] Print line numbers in stack traces, if we know them. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3090 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/pr_exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/qclib/pr_exec.c b/engine/qclib/pr_exec.c index 1262def8a..360868511 100644 --- a/engine/qclib/pr_exec.c +++ b/engine/qclib/pr_exec.c @@ -96,6 +96,7 @@ void PR_StackTrace (progfuncs_t *progfuncs) #endif pr_stack[pr_depth].f = pr_xfunction; + pr_stack[pr_depth].s = pr_xstatement; for (i=pr_depth ; i>0 ; i--) { f = pr_stack[i].f; @@ -115,7 +116,12 @@ void PR_StackTrace (progfuncs_t *progfuncs) if (!f->s_file) printf ("stripped : %s\n", f->s_name+progfuncs->stringtable); else - printf ("%12s : %s\n", f->s_file+progfuncs->stringtable, f->s_name+progfuncs->stringtable); + { + if (pr_progstate[progs].linenums) + printf ("%12s %i : %s\n", f->s_file+progfuncs->stringtable, pr_progstate[progs].linenums[pr_stack[i].s], f->s_name+progfuncs->stringtable); + else + printf ("%12s : %s\n", f->s_file+progfuncs->stringtable, f->s_name+progfuncs->stringtable); + } #ifdef STACKTRACE