try to give line numbers in the traceback

This commit is contained in:
Bill Currie 2003-02-19 06:26:49 +00:00
parent a53dba93b2
commit b6a3bc8d1c
1 changed files with 26 additions and 3 deletions

View File

@ -479,10 +479,33 @@ PR_StackTrace (progs_t * pr)
if (!f) { if (!f) {
Sys_Printf ("<NO FUNCTION>\n"); Sys_Printf ("<NO FUNCTION>\n");
} else } else {
if (pr_debug->int_val && pr->debug) {
pr_lineno_t *lineno = PR_Find_Lineno (pr, pr->pr_stack[i].s);
pr_auxfunction_t *func = PR_Get_Lineno_Func (pr, lineno);
unsigned int line = PR_Get_Lineno_Line (pr, lineno);
int addr = PR_Get_Lineno_Addr (pr, lineno);
line += func->source_line;
if (addr == pr->pr_stack[i].s) {
Sys_Printf ("%12s:%d : %s: %x\n",
PR_GetString (pr, f->s_file),
line,
PR_GetString (pr, f->s_name),
pr->pr_stack[i].s);
} else {
Sys_Printf ("%12s:%d+%d : %s: %x\n",
PR_GetString (pr, f->s_file),
line, pr->pr_stack[i].s - addr,
PR_GetString (pr, f->s_name),
pr->pr_stack[i].s);
}
} else {
Sys_Printf ("%12s : %s: %x\n", PR_GetString (pr, f->s_file), Sys_Printf ("%12s : %s: %x\n", PR_GetString (pr, f->s_file),
PR_GetString (pr, f->s_name), pr->pr_stack[i].s); PR_GetString (pr, f->s_name), pr->pr_stack[i].s);
} }
}
}
} }
void void