fixed bug with undefined structs
ceriel changed debugging information
This commit is contained in:
parent
c3f305bea1
commit
b4f97588b7
6 changed files with 66 additions and 44 deletions
|
@ -26,6 +26,11 @@
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
#include "macbuf.h"
|
#include "macbuf.h"
|
||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
|
#include "dbsymtab.h"
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
#include <stb.h>
|
||||||
|
int IncludeLevel = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char options[];
|
extern char options[];
|
||||||
extern char **inctable; /* list of include directories */
|
extern char **inctable; /* list of include directories */
|
||||||
|
@ -313,6 +318,12 @@ do_include()
|
||||||
FileName = result;
|
FileName = result;
|
||||||
LineNumber = 0;
|
LineNumber = 0;
|
||||||
nestlow = nestlevel;
|
nestlow = nestlevel;
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
IncludeLevel++;
|
||||||
|
if (options['g']) {
|
||||||
|
C_ms_std(FileName, N_BINCL, 0);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -777,24 +788,14 @@ do_line(l)
|
||||||
{
|
{
|
||||||
struct token tk;
|
struct token tk;
|
||||||
int t = GetToken(&tk);
|
int t = GetToken(&tk);
|
||||||
static char *saved_name = (char *)0;
|
|
||||||
|
|
||||||
if (t != EOI) SkipToNewLine();
|
if (t != EOI) SkipToNewLine();
|
||||||
LineNumber = l; /* the number of the next input line */
|
LineNumber = l; /* the number of the next input line */
|
||||||
if (t == STRING) { /* is there a filespecifier? */
|
if (t == STRING) { /* is there a filespecifier? */
|
||||||
extern char *source; /* defined in main.c */
|
/*
|
||||||
|
* Do not attempt to free the old string, since it might
|
||||||
if (FileName != source) { /* source points into argv */
|
* be used in a def structure.
|
||||||
/* Since we are looking one token ahead, we can't
|
*/
|
||||||
* free the string when it is mentioned in dot.
|
|
||||||
*/
|
|
||||||
if (dot.tok_file != FileName) {
|
|
||||||
free(FileName);
|
|
||||||
} else if (dot.tok_file != saved_name) {
|
|
||||||
if (saved_name) free(saved_name);
|
|
||||||
saved_name = dot.tok_file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FileName = tk.tk_bts;
|
FileName = tk.tk_bts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,10 +205,11 @@ declare_idf(ds, dc, lvl)
|
||||||
but it has to be:
|
but it has to be:
|
||||||
*/
|
*/
|
||||||
extern char *symbol2str();
|
extern char *symbol2str();
|
||||||
if (type->tp_fund != VOID)
|
if (type->tp_fund != VOID) {
|
||||||
|
if (level != L_GLOBAL)
|
||||||
error("unknown %s-type",
|
error("unknown %s-type",
|
||||||
symbol2str(type->tp_fund));
|
symbol2str(type->tp_fund));
|
||||||
else error("void is not a complete type");
|
} else error("void is not a complete type");
|
||||||
}
|
}
|
||||||
else if (type->tp_fund != LABEL) {
|
else if (type->tp_fund != LABEL) {
|
||||||
/* CJ */
|
/* CJ */
|
||||||
|
|
|
@ -15,7 +15,14 @@ struct file_info finfo;
|
||||||
#include "nopp.h"
|
#include "nopp.h"
|
||||||
#include <inp_pkg.body>
|
#include <inp_pkg.body>
|
||||||
|
|
||||||
|
#include "dbsymtab.h"
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
#include <stb.h>
|
||||||
|
extern int IncludeLevel;
|
||||||
|
extern char options[];
|
||||||
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getwdir(fn)
|
getwdir(fn)
|
||||||
register char *fn;
|
register char *fn;
|
||||||
|
@ -65,6 +72,12 @@ AtEoIF()
|
||||||
if (NoUnstack) lexerror("unexpected EOF");
|
if (NoUnstack) lexerror("unexpected EOF");
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
nestlevel = nestlow;
|
nestlevel = nestlow;
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g'] && IncludeLevel > 0) {
|
||||||
|
C_ms_std(FileName, N_EINCL, 0);
|
||||||
|
}
|
||||||
|
IncludeLevel--;
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* NOPP */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ gen_simple_exp(tpp, expp)
|
||||||
check_and_pad(expp, tpp);
|
check_and_pad(expp, tpp);
|
||||||
break;
|
break;
|
||||||
case ERRONEOUS:
|
case ERRONEOUS:
|
||||||
|
case FUNCTION:
|
||||||
case VOID:
|
case VOID:
|
||||||
gen_error = pack_level;
|
gen_error = pack_level;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -177,7 +177,7 @@ add_dependency(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
register struct idf *p = str2idf(s);
|
register struct idf *p = str2idf(s);
|
||||||
|
|
||||||
if (! p->id_resmac) {
|
if (! p->id_resmac) {
|
||||||
p->id_resmac = K_FILE;
|
p->id_resmac = K_FILE;
|
||||||
p->id_file = (char *) file_head;
|
p->id_file = (char *) file_head;
|
||||||
|
@ -269,6 +269,14 @@ compile(argc, argv)
|
||||||
init();
|
init();
|
||||||
LineNumber = 0;
|
LineNumber = 0;
|
||||||
nestlow = -1;
|
nestlow = -1;
|
||||||
|
|
||||||
|
#ifndef LINT
|
||||||
|
init_code(destination
|
||||||
|
&& strcmp(destination, "-") != 0
|
||||||
|
? destination
|
||||||
|
: 0);
|
||||||
|
#endif LINT
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
WorkingDir = getwdir(source);
|
WorkingDir = getwdir(source);
|
||||||
PushLex(); /* initialize lex machine */
|
PushLex(); /* initialize lex machine */
|
||||||
|
@ -284,11 +292,6 @@ compile(argc, argv)
|
||||||
#endif NOPP
|
#endif NOPP
|
||||||
#endif DEBUG
|
#endif DEBUG
|
||||||
{
|
{
|
||||||
#ifndef LINT
|
|
||||||
init_code(destination && strcmp(destination, "-") != 0 ?
|
|
||||||
destination : 0);
|
|
||||||
#endif LINT
|
|
||||||
|
|
||||||
/* compile the source text */
|
/* compile the source text */
|
||||||
C_program();
|
C_program();
|
||||||
|
|
||||||
|
@ -380,7 +383,7 @@ init_specials(si)
|
||||||
{
|
{
|
||||||
while (si->si_identifier) {
|
while (si->si_identifier) {
|
||||||
struct idf *idf = str2idf(si->si_identifier);
|
struct idf *idf = str2idf(si->si_identifier);
|
||||||
|
|
||||||
if (idf->id_special)
|
if (idf->id_special)
|
||||||
fatal("maximum identifier length insufficient");
|
fatal("maximum identifier length insufficient");
|
||||||
idf->id_special = si->si_flag;
|
idf->id_special = si->si_flag;
|
||||||
|
|
|
@ -73,7 +73,7 @@ adds_db_str(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
stb_type(tp, assign_num)
|
stb_type(tp)
|
||||||
register struct type *tp;
|
register struct type *tp;
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
@ -84,18 +84,19 @@ stb_type(tp, assign_num)
|
||||||
adds_db_str(sprint(buf, "%d", tp->tp_dbindex));
|
adds_db_str(sprint(buf, "%d", tp->tp_dbindex));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tp->tp_dbindex == 0 && assign_num) {
|
if (tp->tp_dbindex < 0 && tp->tp_size < 0) {
|
||||||
tp->tp_dbindex = ++stb_count;
|
adds_db_str(sprint(buf, "%d", -tp->tp_dbindex));
|
||||||
}
|
|
||||||
if (tp->tp_dbindex > 0) {
|
|
||||||
adds_db_str(sprint(buf, "%d=", tp->tp_dbindex));
|
|
||||||
}
|
|
||||||
if (tp == void_type) {
|
|
||||||
adds_db_str(sprint(buf, "%d", tp->tp_dbindex));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (tp->tp_dbindex <= 0) {
|
||||||
|
tp->tp_dbindex = ++stb_count;
|
||||||
|
}
|
||||||
|
adds_db_str(sprint(buf, "%d=", tp->tp_dbindex));
|
||||||
switch(tp->tp_fund) {
|
switch(tp->tp_fund) {
|
||||||
/* simple types ... */
|
/* simple types ... */
|
||||||
|
case VOID:
|
||||||
|
adds_db_str(sprint(buf, "%d", void_type->tp_dbindex));
|
||||||
|
break;
|
||||||
case INT:
|
case INT:
|
||||||
case LONG:
|
case LONG:
|
||||||
case CHAR:
|
case CHAR:
|
||||||
|
@ -128,14 +129,14 @@ stb_type(tp, assign_num)
|
||||||
/* constructed types ... */
|
/* constructed types ... */
|
||||||
case POINTER:
|
case POINTER:
|
||||||
addc_db_str('*');
|
addc_db_str('*');
|
||||||
stb_type(tp->tp_up, 0);
|
stb_type(tp->tp_up);
|
||||||
break;
|
break;
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
if (tp->tp_size > 0) {
|
if (tp->tp_size > 0) {
|
||||||
adds_db_str("ar");
|
adds_db_str("ar");
|
||||||
stb_type(int_type, 0);
|
stb_type(int_type);
|
||||||
adds_db_str(sprint(buf, ";0;%ld;", tp->tp_size / tp->tp_up->tp_size - 1));
|
adds_db_str(sprint(buf, ";0;%ld;", tp->tp_size / tp->tp_up->tp_size - 1));
|
||||||
stb_type(tp->tp_up, 0);
|
stb_type(tp->tp_up);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENUM:
|
case ENUM:
|
||||||
|
@ -143,6 +144,7 @@ stb_type(tp, assign_num)
|
||||||
adds_db_str(sprint(buf,
|
adds_db_str(sprint(buf,
|
||||||
"xe%s:",
|
"xe%s:",
|
||||||
tp->tp_idf->id_text));
|
tp->tp_idf->id_text));
|
||||||
|
tp->tp_dbindex = -tp->tp_dbindex;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
addc_db_str('e');
|
addc_db_str('e');
|
||||||
|
@ -173,6 +175,7 @@ stb_type(tp, assign_num)
|
||||||
"x%c%s:",
|
"x%c%s:",
|
||||||
tp->tp_fund == STRUCT ? 's' : 'u',
|
tp->tp_fund == STRUCT ? 's' : 'u',
|
||||||
tp->tp_idf->id_text));
|
tp->tp_idf->id_text));
|
||||||
|
tp->tp_dbindex = -tp->tp_dbindex;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
adds_db_str(sprint(buf,
|
adds_db_str(sprint(buf,
|
||||||
|
@ -186,14 +189,14 @@ stb_type(tp, assign_num)
|
||||||
adds_db_str(sdef->sd_idf->id_text);
|
adds_db_str(sdef->sd_idf->id_text);
|
||||||
addc_db_str(':');
|
addc_db_str(':');
|
||||||
if (sdef->sd_type->tp_fund == FIELD) {
|
if (sdef->sd_type->tp_fund == FIELD) {
|
||||||
stb_type(sdef->sd_type->tp_up, 0);
|
stb_type(sdef->sd_type->tp_up);
|
||||||
adds_db_str(sprint(buf,
|
adds_db_str(sprint(buf,
|
||||||
",%ld,%ld;",
|
",%ld,%ld;",
|
||||||
sdef->sd_offset*8+sdef->sd_type->tp_field->fd_shift,
|
sdef->sd_offset*8+sdef->sd_type->tp_field->fd_shift,
|
||||||
sdef->sd_type->tp_field->fd_width));
|
sdef->sd_type->tp_field->fd_width));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stb_type(sdef->sd_type, 0);
|
stb_type(sdef->sd_type);
|
||||||
adds_db_str(sprint(buf,
|
adds_db_str(sprint(buf,
|
||||||
",%ld,%ld;",
|
",%ld,%ld;",
|
||||||
sdef->sd_offset*8,
|
sdef->sd_offset*8,
|
||||||
|
@ -206,7 +209,7 @@ stb_type(tp, assign_num)
|
||||||
break;
|
break;
|
||||||
case FUNCTION:
|
case FUNCTION:
|
||||||
addc_db_str('f');
|
addc_db_str('f');
|
||||||
stb_type(tp->tp_up, 0);
|
stb_type(tp->tp_up);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +220,7 @@ stb_tag(tg, str)
|
||||||
create_db_str();
|
create_db_str();
|
||||||
adds_db_str(str);
|
adds_db_str(str);
|
||||||
adds_db_str(":T");
|
adds_db_str(":T");
|
||||||
stb_type(tg->tg_type, 1);
|
stb_type(tg->tg_type);
|
||||||
addc_db_str(';');
|
addc_db_str(';');
|
||||||
C_ms_stb_cst(db_str.base,
|
C_ms_stb_cst(db_str.base,
|
||||||
N_LSYM,
|
N_LSYM,
|
||||||
|
@ -234,7 +237,7 @@ stb_typedef(tp, str)
|
||||||
create_db_str();
|
create_db_str();
|
||||||
adds_db_str(str);
|
adds_db_str(str);
|
||||||
adds_db_str(":t");
|
adds_db_str(":t");
|
||||||
stb_type(tp, 1);
|
stb_type(tp);
|
||||||
addc_db_str(';');
|
addc_db_str(';');
|
||||||
C_ms_stb_cst(db_str.base,
|
C_ms_stb_cst(db_str.base,
|
||||||
N_LSYM,
|
N_LSYM,
|
||||||
|
@ -256,7 +259,7 @@ stb_string(df, kind, str)
|
||||||
switch(kind) {
|
switch(kind) {
|
||||||
case FUNCTION:
|
case FUNCTION:
|
||||||
addc_db_str(df->df_sc == STATIC ? 'f' : 'F');
|
addc_db_str(df->df_sc == STATIC ? 'f' : 'F');
|
||||||
stb_type(tp->tp_up, 0);
|
stb_type(tp->tp_up);
|
||||||
addc_db_str(';');
|
addc_db_str(';');
|
||||||
C_ms_stb_pnam(db_str.base, N_FUN, 1 /* proclevel */, str);
|
C_ms_stb_pnam(db_str.base, N_FUN, 1 /* proclevel */, str);
|
||||||
break;
|
break;
|
||||||
|
@ -265,7 +268,7 @@ stb_string(df, kind, str)
|
||||||
(df->df_sc == REGISTER && df->df_address >= 0)) {
|
(df->df_sc == REGISTER && df->df_address >= 0)) {
|
||||||
/* value parameter */
|
/* value parameter */
|
||||||
addc_db_str('p');
|
addc_db_str('p');
|
||||||
stb_type(tp, 0);
|
stb_type(tp);
|
||||||
addc_db_str(';');
|
addc_db_str(';');
|
||||||
C_ms_stb_cst(db_str.base, N_PSYM, 0, df->df_address);
|
C_ms_stb_cst(db_str.base, N_PSYM, 0, df->df_address);
|
||||||
}
|
}
|
||||||
|
@ -282,7 +285,7 @@ stb_string(df, kind, str)
|
||||||
else {
|
else {
|
||||||
addc_db_str('G');
|
addc_db_str('G');
|
||||||
}
|
}
|
||||||
stb_type(tp, 0);
|
stb_type(tp);
|
||||||
addc_db_str(';');
|
addc_db_str(';');
|
||||||
if (df->df_sc == STATIC && df->df_level >= L_LOCAL) {
|
if (df->df_sc == STATIC && df->df_level >= L_LOCAL) {
|
||||||
C_ms_stb_dlb(db_str.base, N_LCSYM, 0, (label) df->df_address, (arith) 0);
|
C_ms_stb_dlb(db_str.base, N_LCSYM, 0, (label) df->df_address, (arith) 0);
|
||||||
|
@ -292,7 +295,7 @@ stb_string(df, kind, str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* local variable */
|
else { /* local variable */
|
||||||
stb_type(tp, 1); /* assign type num to avoid
|
stb_type(tp); /* assign type num to avoid
|
||||||
difficult to parse string */
|
difficult to parse string */
|
||||||
addc_db_str(';');
|
addc_db_str(';');
|
||||||
C_ms_stb_cst(db_str.base, N_LSYM, 0, df->df_address);
|
C_ms_stb_cst(db_str.base, N_LSYM, 0, df->df_address);
|
||||||
|
|
Loading…
Reference in a new issue