GENGFILES= tokenfile.g
GENHFILES= Lpars.h debugcst.h density.h errout.h idfsize.h inputtype.h\
numsize.h strsize.h def.h type.h desig.h scope.h node.h\
- target_sizes.h nocross.h
+ target_sizes.h nocross.h dbsymtab.h
HFILES= LLlex.h chk_expr.h class.h const.h debug.h def.h desig.h\
f_info.h idf.h input.h main.h misc.h node.h required.h scope.h\
tokenname.h type.h $(GENHFILES)
!File: nocross.h
#undef NOCROSS 1 /* define when cross compiler not needed */
+
+
+!File: dbsymtab.h
+#define DBSYMTAB 1 /* ability to produce symbol table for debugger */
#include "node.h"
#include "scope.h"
#include "type.h"
+#include "dbsymtab.h"
#define offsetof(type, field) (int) &(((type *)0)->field)
#define PC_BUFSIZ (sizeof(struct file) - (int)((struct file *)0)->bufadr)
df->con_const = nd;
df->df_type = nd->nd_type;
df->df_flags |= D_SET;
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_CONST);
+#endif /* DBSYMTAB */
}
}
;
{ if( df = define(id, CurrentScope, D_TYPE) ) {
df->df_type = tp;
df->df_flags |= D_SET;
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_TYPE);
+#endif /* DBSYMTAB */
}
}
;
{ DoDirective(dot.TOK_IDF, nd, tp, scl, 0); }
|
{ df = DeclProc(nd, tp, scl);
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_PROCEDURE);
+#endif /* DBSYMTAB */
}
Block(df)
{ /* open_scope() is simulated in DeclProc() */
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_PEND);
+#endif /* DBSYMTAB */
close_scope();
}
]
df->prc_bool =
CurrentScope->sc_off =
df->prc_res - int_size;
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_FUNCTION);
+#endif /* DBSYMTAB */
}
}
Block(df)
{ if( df ) {
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_PEND);
+#endif /* DBSYMTAB */
EndFunc(df);
}
struct idf *df_idf; /* link back to the name */
struct scope *df_scope; /* scope in which this definition resides */
long df_kind; /* the kind of this definition: */
-#define D_PROCEDURE 0x000001 /* procedure */
-#define D_FUNCTION 0x000002 /* function */
-#define D_TYPE 0x000004 /* a type */
-#define D_CONST 0x000008 /* a constant */
-#define D_ENUM 0x000010 /* an enumeration literal */
-#define D_FIELD 0x000020 /* a field in a record */
-#define D_PROGRAM 0x000040 /* the program */
-#define D_VARIABLE 0x000080 /* a variable */
-#define D_PARAMETER 0x000100 /* program parameter */
-#define D_FORWTYPE 0x000200 /* forward type */
-#define D_FTYPE 0x000400 /* resolved forward type */
-#define D_FWPROCEDURE 0x000800 /* forward procedure */
-#define D_FWFUNCTION 0x001000 /* forward function */
-#define D_LABEL 0x002000 /* a label */
-#define D_LBOUND 0x004000 /* lower bound id. in conform. array */
-#define D_UBOUND 0x008000 /* upper bound id. in conform. array */
-#define D_FORWARD 0x010000 /* directive "forward" */
-#define D_EXTERN 0x020000 /* directive "extern" */
-#define D_ERROR 0x040000 /* a compiler generated definition
+#define D_PROCEDURE 0x000001L /* procedure */
+#define D_FUNCTION 0x000002L /* function */
+#define D_TYPE 0x000004L /* a type */
+#define D_CONST 0x000008L /* a constant */
+#define D_ENUM 0x000010L /* an enumeration literal */
+#define D_FIELD 0x000020L /* a field in a record */
+#define D_PROGRAM 0x000040L /* the program */
+#define D_VARIABLE 0x000080L /* a variable */
+#define D_PARAMETER 0x000100L /* program parameter */
+#define D_FORWTYPE 0x000200L /* forward type */
+#define D_FTYPE 0x000400L /* resolved forward type */
+#define D_FWPROCEDURE 0x000800L /* forward procedure */
+#define D_FWFUNCTION 0x001000L /* forward function */
+#define D_LABEL 0x002000L /* a label */
+#define D_LBOUND 0x004000L /* lower bound id. in conform. array */
+#define D_UBOUND 0x008000L /* upper bound id. in conform. array */
+#define D_FORWARD 0x010000L /* directive "forward" */
+#define D_EXTERN 0x020000L /* directive "extern" */
+#define D_ERROR 0x040000L /* a compiler generated definition
* for an undefined variable */
-#define D_MODULE 0x080000 /* the module */
-#define D_INUSE 0x100000 /* variable is in use */
+#define D_MODULE 0x080000L /* the module */
+#define D_INUSE 0x100000L /* variable is in use */
/* special values for stab.c */
-#define D_END (D_MODULE|D_PROCEDURE)
-#define D_PEND (D_MODULE|D_PROCEDURE|D_VARIABLE)
+#define D_END (D_PROGRAM|D_PROCEDURE)
+#define D_PEND (D_PROGRAM|D_PROCEDURE|D_VARIABLE)
#define D_VALUE (D_FUNCTION | D_CONST | D_ENUM | D_FIELD | D_VARIABLE\
| D_FWFUNCTION | D_LBOUND | D_UBOUND)
#include "node.h"
#include "scope.h"
#include "type.h"
+#include "dbsymtab.h"
extern int proclevel;
extern int parlevel;
Enter(name, kind, type, pnam)
char *name;
register struct type *type;
+ long kind;
{
/* Enter a definition for "name" with kind "kind" and type
"type" in the Current Scope. If it is a standard name, also
df->df_value.df_reqname = pnam;
df->df_flags |= D_SET;
}
+#ifdef DBSYMTAB
else if (options['g']) stb_string(df, kind);
+#endif /* DBSYMTAB */
return df;
}
df->var_name = output;
set_outp();
}
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_VARIABLE);
+#endif /* DBSYMTAB */
}
}
else {
df->var_name = df->df_idf->id_text;
df->df_flags |= D_NOREG;
}
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_VARIABLE);
+#endif /* DBSYMTAB */
}
FreeNode(Idlist);
}
#include "tokenname.h"
#include "type.h"
#include "scope.h"
+#include "dbsymtab.h"
char options[128];
char *ProgName;
fatal("couldn't open output file");
C_magic();
C_ms_emx(word_size, pointer_size);
+#ifdef DBSYMTAB
if (options['g']) {
C_ms_std(FileName, N_SO, 0);
}
+#endif /* DBSYMTAB */
AddRequired();
C_df_dlb(++data_label);
C_rom_scon(FileName,(arith) strlen(FileName) + 1);
df->df_type = int_type;
df->con_const = &maxintnode;
df->df_flags |= D_SET;
+#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_CONST);
+#endif /* DBSYMTAB */
}
#ifdef DEBUG
#include "main.h"
#include "node.h"
#include "scope.h"
+#include "dbsymtab.h"
}
%lexical LLlex;
}:
ProgramHeading(&df)
';' Block(df) '.'
- { if (options['g']) {
+ {
+#ifdef DBSYMTAB
+ if (options['g']) {
C_ms_stb_cst(df->df_idf->id_text, N_MAIN, 0, (arith) 0);
stb_string(df, D_END);
}
+#endif /* DBSYMTAB */
}
| { df = new_def();
df->df_idf = str2idf(FileName, 1);
open_scope();
GlobalScope = CurrentScope;
(*df)->prc_vis = CurrVis;
+#ifdef DBSYMTAB
if (options['g']) stb_string(*df, D_MODULE);
+#endif /* DBSYMTAB */
}
[
'('
/* $Header$ */
+#include "dbsymtab.h"
+
+#ifdef DBSYMTAB
+
#include <alloc.h>
#include <em_arith.h>
#include <em_label.h>
stb_string(df, kind)
register struct def *df;
+ long kind;
{
register struct type *tp = df->df_type;
char buf[64];
create_db_str();
adds_db_str(df->df_idf->id_text);
addc_db_str(':');
- switch(kind) {
- case D_MODULE:
+ if (kind == D_MODULE) {
adds_db_str(sprint(buf, "M%d;", df->prc_vis->sc_count));
C_ms_stb_pnam(db_str.base, N_FUN, proclevel, "m_a_i_n");
- break;
+ return;
+ }
+ switch((int)kind) {
case D_PROCEDURE:
case D_FUNCTION:
adds_db_str(sprint(buf, "Q%d;", df->prc_vis->sc_count));
}
}
+#endif /* DBSYMTAB */