mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
local defs for debug info now work
This commit is contained in:
parent
17cd41883e
commit
b0d568d85f
6 changed files with 31 additions and 17 deletions
|
@ -124,4 +124,6 @@ void def_initialized (def_t *d);
|
||||||
|
|
||||||
void clear_defs (void);
|
void clear_defs (void);
|
||||||
|
|
||||||
|
void def_to_ddef (def_t *def, ddef_t *ddef, int aux);
|
||||||
|
|
||||||
#endif//__def_h
|
#endif//__def_h
|
||||||
|
|
|
@ -37,6 +37,7 @@ static const char rcsid[] =
|
||||||
#include "qfcc.h"
|
#include "qfcc.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
#include "immediate.h"
|
||||||
#include "reloc.h"
|
#include "reloc.h"
|
||||||
#include "strpool.h"
|
#include "strpool.h"
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
|
@ -480,3 +481,15 @@ clear_defs (void)
|
||||||
if (defs_by_name)
|
if (defs_by_name)
|
||||||
Hash_FlushTable (defs_by_name);
|
Hash_FlushTable (defs_by_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
def_to_ddef (def_t *def, ddef_t *ddef, int aux)
|
||||||
|
{
|
||||||
|
type_t *type = def->type;
|
||||||
|
|
||||||
|
if (aux)
|
||||||
|
type = type->aux_type;
|
||||||
|
ddef->type = type->type;
|
||||||
|
ddef->ofs = def->ofs;
|
||||||
|
ddef->s_name = ReuseString (def->name);
|
||||||
|
}
|
||||||
|
|
|
@ -230,11 +230,7 @@ finish_function (function_t *f)
|
||||||
if (f->scope) {
|
if (f->scope) {
|
||||||
for (def = f->scope->head; def; def = def->def_next) {
|
for (def = f->scope->head; def; def = def->def_next) {
|
||||||
if (def->name) {
|
if (def->name) {
|
||||||
ddef_t *d = new_local ();
|
def_to_ddef (def, new_local (), 0);
|
||||||
d->type = def->type->type;
|
|
||||||
d->ofs = def->ofs;
|
|
||||||
d->s_name = ReuseString (def->name);
|
|
||||||
|
|
||||||
f->aux->num_locals++;
|
f->aux->num_locals++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,8 +521,8 @@ qfo_to_progs (qfo_t *qfo, pr_info_t *pr)
|
||||||
pf->aux->function = i + 1;
|
pf->aux->function = i + 1;
|
||||||
pf->aux->source_line = qf->line;
|
pf->aux->source_line = qf->line;
|
||||||
pf->aux->line_info = qf->line_info;
|
pf->aux->line_info = qf->line_info;
|
||||||
pf->aux->local_defs = qf->local_defs;
|
pf->aux->local_defs = 0;
|
||||||
pf->aux->num_locals = qf->num_local_defs;
|
pf->aux->num_locals = 0;
|
||||||
pf->builtin = qf->builtin;
|
pf->builtin = qf->builtin;
|
||||||
pf->code = qf->code;
|
pf->code = qf->code;
|
||||||
pf->function_num = i + 1;
|
pf->function_num = i + 1;
|
||||||
|
@ -536,6 +536,13 @@ qfo_to_progs (qfo_t *qfo, pr_info_t *pr)
|
||||||
pf->scope->head = pr->scope->head + qf->local_defs;
|
pf->scope->head = pr->scope->head + qf->local_defs;
|
||||||
pf->scope->tail = &pf->scope->head[qf->num_local_defs - 1].def_next;
|
pf->scope->tail = &pf->scope->head[qf->num_local_defs - 1].def_next;
|
||||||
*pf->scope->tail = 0;
|
*pf->scope->tail = 0;
|
||||||
|
pf->aux->local_defs = pr->num_locals;
|
||||||
|
for (pd = pf->scope->head; pd; pd = pd->def_next) {
|
||||||
|
if (pd->name) {
|
||||||
|
def_to_ddef (pd, new_local (), 0);
|
||||||
|
pf->aux->num_locals++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (qf->num_relocs) {
|
if (qf->num_relocs) {
|
||||||
pf->refs = relocs + qf->relocs;
|
pf->refs = relocs + qf->relocs;
|
||||||
|
|
|
@ -173,23 +173,17 @@ WriteData (int crc)
|
||||||
continue;
|
continue;
|
||||||
if (def->type->type == ev_func) {
|
if (def->type->type == ev_func) {
|
||||||
} else if (def->type->type == ev_field) {
|
} else if (def->type->type == ev_field) {
|
||||||
dd = &fields[numfielddefs];
|
dd = &fields[numfielddefs++];
|
||||||
numfielddefs++;
|
def_to_ddef (def, dd, 1);
|
||||||
dd->type = def->type->aux_type->type;
|
|
||||||
dd->s_name = ReuseString (def->name);
|
|
||||||
dd->ofs = G_INT (def->ofs);
|
dd->ofs = G_INT (def->ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
dd = &globals[numglobaldefs];
|
dd = &globals[numglobaldefs++];
|
||||||
numglobaldefs++;
|
def_to_ddef (def, dd, 0);
|
||||||
dd->type = def->type->type;
|
|
||||||
|
|
||||||
if (!def->constant
|
if (!def->constant
|
||||||
&& def->type->type != ev_func
|
&& def->type->type != ev_func
|
||||||
&& def->type->type != ev_field && def->global)
|
&& def->type->type != ev_field && def->global)
|
||||||
dd->type |= DEF_SAVEGLOBAL;
|
dd->type |= DEF_SAVEGLOBAL;
|
||||||
dd->s_name = ReuseString (def->name);
|
|
||||||
dd->ofs = def->ofs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pr.strings->size = (pr.strings->size + 3) & ~3;
|
pr.strings->size = (pr.strings->size + 3) & ~3;
|
||||||
|
|
|
@ -67,6 +67,8 @@ void codespace_addcode (codespace_t *codespace, struct statement_s *code, int si
|
||||||
type_t *parse_type (const char *str) {return 0;}
|
type_t *parse_type (const char *str) {return 0;}
|
||||||
int function_parms (function_t *f, byte *parm_size) {return 0;}
|
int function_parms (function_t *f, byte *parm_size) {return 0;}
|
||||||
pr_auxfunction_t *new_auxfunction (void) {return 0;}
|
pr_auxfunction_t *new_auxfunction (void) {return 0;}
|
||||||
|
ddef_t *new_local (void) {return 0;}
|
||||||
|
void def_to_ddef (def_t *def, ddef_t *ddef, int aux) {}
|
||||||
|
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{NULL, 0, NULL, 0},
|
{NULL, 0, NULL, 0},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue