mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Fix debug line number information.
This commit is contained in:
parent
5eff00fdeb
commit
681ded9375
6 changed files with 17 additions and 3 deletions
|
@ -41,4 +41,6 @@ pr_auxfunction_t *new_auxfunction (void);
|
|||
pr_lineno_t *new_lineno (void);
|
||||
struct ddef_s *new_local (void);
|
||||
|
||||
extern int lineno_base;
|
||||
|
||||
#endif//__debug_h
|
||||
|
|
|
@ -558,8 +558,6 @@ void init_elements (struct def_s *def, expr_t *eles);
|
|||
|
||||
const char *get_op_string (int op);
|
||||
|
||||
extern int lineno_base;
|
||||
|
||||
struct keywordarg_s;
|
||||
struct class_type_s;
|
||||
expr_t *selector_expr (struct keywordarg_s *selector);
|
||||
|
|
|
@ -52,6 +52,8 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "qfcc.h"
|
||||
#include "strpool.h"
|
||||
|
||||
int lineno_base;
|
||||
|
||||
static srcline_t *free_srclines;
|
||||
|
||||
void
|
||||
|
|
|
@ -162,6 +162,17 @@ emit_statement (statement_t *statement)
|
|||
|
||||
if (!op)
|
||||
internal_error (statement->expr, "ice ice baby");
|
||||
if (options.code.debug && current_func->aux) {
|
||||
expr_t *e = statement->expr;
|
||||
pr_uint_t line = (e ? e->line : pr.source_line) - lineno_base;
|
||||
|
||||
if (line != pr.linenos[pr.num_linenos - 1].line) {
|
||||
pr_lineno_t *lineno = new_lineno ();
|
||||
|
||||
lineno->line = line;
|
||||
lineno->fa.addr = pr.code->size;
|
||||
}
|
||||
}
|
||||
s = codespace_newstatement (pr.code);
|
||||
s->op = op->opcode;
|
||||
s->a = def_a ? def_a->offset : 0;
|
||||
|
|
|
@ -67,7 +67,6 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "qc-parse.h"
|
||||
|
||||
static expr_t *free_exprs;
|
||||
int lineno_base;
|
||||
|
||||
type_t *ev_types[ev_type_count] = {
|
||||
&type_void,
|
||||
|
|
|
@ -646,6 +646,8 @@ emit_function (function_t *f, expr_t *e)
|
|||
sblock_t *sblock;
|
||||
|
||||
f->code = pr.code->size;
|
||||
if (f->aux)
|
||||
lineno_base = f->aux->source_line;
|
||||
sblock = make_statements (e);
|
||||
emit_statements (sblock);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue