Made ability for -g dependant on compile-time flag

This commit is contained in:
ceriel 1991-02-18 17:18:36 +00:00
parent b4f4a87846
commit c40ca6ebbd
11 changed files with 99 additions and 6 deletions

View file

@ -91,3 +91,7 @@
*/
!File: dbsymtab.h
#define DBSYMTAB 1 /* ability to produce symbol table for debugger */

View file

@ -50,7 +50,7 @@ INCLUDES = -I$(MHDIR) -I$(EMHOME)/h -I$(PKGDIR)
OPTIM = -O
CFLAGS = $(PROFILE) $(INCLUDES) $(COPTIONS) $(OPTIM)
LINTFLAGS =
LDFLAGS = -i $(PROFILE)
LDFLAGS = $(PROFILE)
LSRC = tokenfile.c program.c declar.c expression.c statement.c
LOBJ = tokenfile.o program.o declar.o expression.o statement.o
@ -212,6 +212,7 @@ LLlex.o: Lpars.h
LLlex.o: bigparam.h
LLlex.o: class.h
LLlex.o: const.h
LLlex.o: dbsymtab.h
LLlex.o: debug.h
LLlex.o: debugcst.h
LLlex.o: def.h
@ -248,6 +249,7 @@ main.o: LLlex.h
main.o: Lpars.h
main.o: SYSTEM.h
main.o: bigparam.h
main.o: dbsymtab.h
main.o: debug.h
main.o: debugcst.h
main.o: def.h
@ -276,6 +278,7 @@ type.o: LLlex.h
type.o: bigparam.h
type.o: chk_expr.h
type.o: const.h
type.o: dbsymtab.h
type.o: debug.h
type.o: debugcst.h
type.o: def.h
@ -293,6 +296,7 @@ type.o: warning.h
def.o: LLlex.h
def.o: Lpars.h
def.o: bigparam.h
def.o: dbsymtab.h
def.o: debug.h
def.o: debugcst.h
def.o: def.h
@ -313,6 +317,7 @@ misc.o: node.h
misc.o: real.h
enter.o: LLlex.h
enter.o: bigparam.h
enter.o: dbsymtab.h
enter.o: debug.h
enter.o: debugcst.h
enter.o: def.h
@ -329,6 +334,7 @@ enter.o: type.h
defmodule.o: LLlex.h
defmodule.o: Lpars.h
defmodule.o: bigparam.h
defmodule.o: dbsymtab.h
defmodule.o: debug.h
defmodule.o: debugcst.h
defmodule.o: def.h
@ -346,6 +352,7 @@ defmodule.o: target_sizes.h
defmodule.o: type.h
typequiv.o: LLlex.h
typequiv.o: bigparam.h
typequiv.o: dbsymtab.h
typequiv.o: debug.h
typequiv.o: debugcst.h
typequiv.o: def.h
@ -360,6 +367,7 @@ typequiv.o: type.h
typequiv.o: warning.h
node.o: LLlex.h
node.o: bigparam.h
node.o: dbsymtab.h
node.o: debug.h
node.o: debugcst.h
node.o: def.h
@ -373,6 +381,7 @@ cstoper.o: LLlex.h
cstoper.o: Lpars.h
cstoper.o: bigparam.h
cstoper.o: const.h
cstoper.o: dbsymtab.h
cstoper.o: debug.h
cstoper.o: debugcst.h
cstoper.o: idf.h
@ -388,6 +397,7 @@ chk_expr.o: Lpars.h
chk_expr.o: bigparam.h
chk_expr.o: chk_expr.h
chk_expr.o: const.h
chk_expr.o: dbsymtab.h
chk_expr.o: debug.h
chk_expr.o: debugcst.h
chk_expr.o: def.h
@ -406,6 +416,7 @@ chk_expr.o: type.h
chk_expr.o: warning.h
options.o: bigparam.h
options.o: class.h
options.o: dbsymtab.h
options.o: idfsize.h
options.o: main.h
options.o: nocross.h
@ -420,6 +431,7 @@ walk.o: Lpars.h
walk.o: bigparam.h
walk.o: bigresult.h
walk.o: chk_expr.h
walk.o: dbsymtab.h
walk.o: debug.h
walk.o: debugcst.h
walk.o: def.h
@ -440,6 +452,7 @@ walk.o: walk.h
walk.o: warning.h
desig.o: LLlex.h
desig.o: bigparam.h
desig.o: dbsymtab.h
desig.o: debug.h
desig.o: debugcst.h
desig.o: def.h
@ -457,6 +470,7 @@ code.o: LLlex.h
code.o: Lpars.h
code.o: bigparam.h
code.o: bigresult.h
code.o: dbsymtab.h
code.o: debug.h
code.o: debugcst.h
code.o: def.h
@ -472,6 +486,7 @@ code.o: type.h
code.o: walk.h
lookup.o: LLlex.h
lookup.o: bigparam.h
lookup.o: dbsymtab.h
lookup.o: debug.h
lookup.o: debugcst.h
lookup.o: def.h
@ -486,8 +501,10 @@ lookup.o: type.h
stab.o: LLlex.h
stab.o: bigparam.h
stab.o: const.h
stab.o: dbsymtab.h
stab.o: def.h
stab.o: idf.h
stab.o: main.h
stab.o: nocross.h
stab.o: real.h
stab.o: scope.h
@ -497,12 +514,14 @@ tokenfile.o: Lpars.h
program.o: LLlex.h
program.o: Lpars.h
program.o: bigparam.h
program.o: dbsymtab.h
program.o: debug.h
program.o: debugcst.h
program.o: def.h
program.o: f_info.h
program.o: idf.h
program.o: main.h
program.o: misc.h
program.o: nocross.h
program.o: node.h
program.o: real.h
@ -515,6 +534,7 @@ declar.o: LLlex.h
declar.o: Lpars.h
declar.o: bigparam.h
declar.o: chk_expr.h
declar.o: dbsymtab.h
declar.o: debug.h
declar.o: debugcst.h
declar.o: def.h
@ -535,6 +555,7 @@ expression.o: Lpars.h
expression.o: bigparam.h
expression.o: chk_expr.h
expression.o: const.h
expression.o: dbsymtab.h
expression.o: debug.h
expression.o: debugcst.h
expression.o: def.h
@ -548,6 +569,7 @@ expression.o: warning.h
statement.o: LLlex.h
statement.o: Lpars.h
statement.o: bigparam.h
statement.o: dbsymtab.h
statement.o: def.h
statement.o: idf.h
statement.o: nocross.h
@ -563,6 +585,7 @@ casestat.o: LLlex.h
casestat.o: Lpars.h
casestat.o: bigparam.h
casestat.o: chk_expr.h
casestat.o: dbsymtab.h
casestat.o: debug.h
casestat.o: debugcst.h
casestat.o: def.h
@ -577,6 +600,7 @@ casestat.o: type.h
casestat.o: walk.h
tmpvar.o: LLlex.h
tmpvar.o: bigparam.h
tmpvar.o: dbsymtab.h
tmpvar.o: debug.h
tmpvar.o: debugcst.h
tmpvar.o: def.h
@ -588,6 +612,7 @@ tmpvar.o: target_sizes.h
tmpvar.o: type.h
scope.o: LLlex.h
scope.o: bigparam.h
scope.o: dbsymtab.h
scope.o: debug.h
scope.o: debugcst.h
scope.o: def.h

View file

@ -90,4 +90,7 @@
returns a pointer to it
*/
!File: dbsymtab.h
#undef DBSYMTAB 1 /* ability to produce symbol table for debugger */

View file

@ -18,6 +18,7 @@
#include <assert.h>
#include "strict3rd.h"
#include "dbsymtab.h"
#include "idf.h"
#include "LLlex.h"
#include "def.h"
@ -112,11 +113,18 @@ declaration
|
{ ++proclevel; }
ProcedureHeading(&df, D_PROCEDURE)
{ if (options['g']) stb_string(df, D_PROCEDURE); }
{
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_PROCEDURE);
#endif /* DBSYMTAB */
}
';'
block(&(df->prc_body))
IDENT
{ if (options['g']) stb_string(df, D_PEND);
{
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_PEND);
#endif /* DBSYMTAB */
EndProc(df, dot.TOK_IDF);
--proclevel;
}
@ -180,7 +188,9 @@ TypeDeclaration
'=' type(&tp)
{ DeclareType(nd, df, tp);
FreeNode(nd);
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_TYPE);
#endif /* DBSYMTAB */
}
;
@ -534,7 +544,9 @@ ConstantDeclaration
df->con_const = nd->nd_token;
df->df_type = nd->nd_type;
FreeNode(nd);
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_CONST);
#endif /* DBSYMTAB */
}
;

View file

@ -17,6 +17,7 @@
#include <em_code.h>
#include <assert.h>
#include "dbsymtab.h"
#include "idf.h"
#include "LLlex.h"
#include "def.h"
@ -41,7 +42,9 @@ Enter(name, kind, type, pnam)
df = define(str2idf(name, 0), CurrentScope, kind);
df->df_type = type;
if (pnam) df->df_value.df_stdname = pnam;
#ifdef DBSYMTAB
else if (options['g']) stb_string(df, kind);
#endif /* DBSYMTAB */
return df;
}
@ -180,7 +183,9 @@ EnterVarList(Idlist, type, local)
C_ina_dnam(df->var_name);
}
}
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_VARIABLE);
#endif /* DBSYMTAB */
}
FreeNode(Idlist);
}

View file

@ -20,6 +20,7 @@
#include <stb.h>
#include "strict3rd.h"
#include "dbsymtab.h"
#include "input.h"
#include "f_info.h"
#include "idf.h"
@ -87,9 +88,11 @@ Compile(src, dst)
if (! C_open(dst)) fatal("could not 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 */
init_idf();
InitCst();
reserve(tkidf);

View file

@ -16,6 +16,7 @@
#include <alloc.h>
#include "strict3rd.h"
#include "dbsymtab.h"
#include "type.h"
#include "main.h"
#include "warning.h"
@ -60,10 +61,12 @@ DoOption(text)
options[text[-1]]++;
break;
#ifdef DBSYMTAB
case 'g': /* generate symbol table for debugger */
options['g']++;
options['n']++; /* no register vars ??? */
break;
#endif /* DBSYMTAB */
case 'w':
if (*text) {

View file

@ -19,6 +19,7 @@
#include <stb.h>
#include "strict3rd.h"
#include "dbsymtab.h"
#include "main.h"
#include "idf.h"
#include "LLlex.h"
@ -63,10 +64,16 @@ ModuleDeclaration
';'
import(1)*
export(&qualified, &exportlist)
{ if (options['g']) stb_string(df, D_MODULE); }
{
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_MODULE);
#endif /* DBSYMTAB */
}
block(&(df->mod_body))
IDENT { EnterExportList(exportlist, qualified);
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_END);
#endif /* DBSYMTAB */
close_scope(SC_CHKFORW|SC_CHKPROC|SC_REVERSE);
match_id(df->df_idf, dot.TOK_IDF);
}
@ -159,7 +166,9 @@ DefinitionModule
DefinitionModule++;
if (!Defined) {
Defined = df;
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_MODULE);
#endif /* DBSYMTAB */
}
}
';'
@ -211,7 +220,11 @@ definition
}
]
';'
{ if (options['g']) stb_string(df, D_TYPE); }
{
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_TYPE);
#endif /* DBSYMTAB */
}
]*
|
VAR [ %persistent VariableDeclaration ';' ]*
@ -234,13 +247,17 @@ ProgramModule
df->mod_vis = CurrVis;
CurrentScope->sc_name = "__M2M_";
CurrentScope->sc_definedby = df;
#ifdef DBSYMTAB
if (options['g']) stb_string(df, D_MODULE);
#endif /* DBSYMTAB */
}
}
priority(&(df->mod_priority))
';' import(0)*
block(&(df->mod_body)) IDENT
{ if (options['g']) {
{
#ifdef DBSYMTAB
if (options['g']) {
if (state == PROGRAM) {
C_ms_stb_cst(df->df_idf->id_text,
N_MAIN,
@ -249,6 +266,7 @@ ProgramModule
}
stb_string(df, D_END);
}
#endif /* DBSYMTAB */
close_scope(SC_CHKFORW|SC_CHKPROC|SC_REVERSE);
match_id(df->df_idf, dot.TOK_IDF);
}

View file

@ -9,6 +9,10 @@
/* $Header$ */
#include "dbsymtab.h"
#ifdef DBSYMTAB
#include <alloc.h>
#include <em_arith.h>
#include <em_label.h>
@ -391,3 +395,4 @@ stb_string(df, kind)
}
}
#endif /* DBSYMTAB */

View file

@ -9,6 +9,8 @@
/* $Header$ */
#include "dbsymtab.h"
struct paramlist { /* structure for parameterlist of a PROCEDURE */
struct paramlist *par_next;
struct def *par_def; /* "df" of parameter */
@ -102,7 +104,9 @@ struct type {
#define T_INDEX (T_ENUMERATION|T_CHAR|T_SUBRANGE)
#define T_DISCRETE (T_INDEX|T_INTORCARD)
#define T_CONSTRUCTED (T_ARRAY|T_SET|T_RECORD)
#ifdef DBSYMTAB
short tp_dbindex; /* index in debugger symbol table */
#endif
int tp_align; /* alignment requirement of this type */
arith tp_size; /* size of this type */
union {

View file

@ -25,6 +25,7 @@
#include <stb.h>
#include "strict3rd.h"
#include "dbsymtab.h"
#include "LLlex.h"
#include "def.h"
#include "type.h"
@ -127,6 +128,7 @@ DoLineno(nd)
nd->nd_lineno != oldlineno) {
oldlineno = nd->nd_lineno;
if (! options['L']) C_lin((arith) nd->nd_lineno);
#ifdef DBSYMTAB
if ( options['g']) {
static int ms_lineno;
@ -135,6 +137,7 @@ DoLineno(nd)
ms_lineno = nd->nd_lineno;
}
}
#endif /* DBSYMTAB */
}
}
@ -221,17 +224,21 @@ WalkModule(module)
}
WalkDefList(sc->sc_def, MkCalls);
proclevel++;
#ifdef DBSYMTAB
if (options['g']) {
C_ms_std((char *) 0, N_LBRAC, proclevel);
}
#endif /* DBSYMTAB */
WalkNode(module->mod_body, NO_EXIT_LABEL, REACH_FLAG);
DO_DEBUG(options['X'], PrNode(module->mod_body, 0));
def_ilb(RETURN_LABEL);
EndPriority();
C_ret((arith) 0);
#ifdef DBSYMTAB
if (options['g']) {
C_ms_std((char *) 0, N_RBRAC, proclevel);
}
#endif /* DBSYMTAB */
C_end(-sc->sc_off);
proclevel--;
TmpClose();
@ -449,9 +456,11 @@ WalkProcedure(procedure)
C_ret(func_res_size);
C_beginpart(partno2);
C_pro(procscope->sc_name, -procscope->sc_off);
#ifdef DBSYMTAB
if (options['g']) {
C_ms_std((char *) 0, N_LBRAC, proclevel);
}
#endif /* DBSYMTAB */
C_ms_par(procedure->df_type->prc_nbpar
#ifdef BIG_RESULT_ON_STACK
+ (too_big ? func_res_size : 0)
@ -459,9 +468,11 @@ WalkProcedure(procedure)
);
if (! options['n']) WalkDefList(procscope->sc_def, RegisterMessage);
C_endpart(partno2);
#ifdef DBSYMTAB
if (options['g']) {
C_ms_std((char *) 0, N_RBRAC, proclevel);
}
#endif /* DBSYMTAB */
C_end(-procscope->sc_off);
if (! fit(procscope->sc_off, (int) word_size)) {
node_error(procedure->prc_body,