Quellcode durchsuchen

Changed debugging information to also work for Solaris 2

ceriel vor 31 Jahren
Ursprung
Commit
c89c0d2c01
5 geänderte Dateien mit 42 neuen und 42 gelöschten Zeilen
  1. 0 10
      lang/m2/comp/declar.g
  2. 0 3
      lang/m2/comp/enter.c
  3. 2 0
      lang/m2/comp/main.c
  4. 4 29
      lang/m2/comp/program.g
  5. 36 0
      lang/m2/comp/walk.c

+ 0 - 10
lang/m2/comp/declar.g

@@ -18,7 +18,6 @@
 #include	<assert.h>
 
 #include	"strict3rd.h"
-#include	"dbsymtab.h"
 #include	"idf.h"
 #include	"LLlex.h"
 #include	"def.h"
@@ -114,17 +113,11 @@ declaration
 			{	++proclevel; }
 	ProcedureHeading(&df, D_PROCEDURE)
 			{	
-#ifdef DBSYMTAB
-				if (options['g']) stb_string(df, D_PROCEDURE);
-#endif /* DBSYMTAB */
 			}
 	';'
 	block(&(df->prc_body))
 	IDENT
 			{
-#ifdef DBSYMTAB
-				if (options['g']) stb_string(df, D_PEND);
-#endif /* DBSYMTAB */
 				EndProc(df, dot.TOK_IDF);
 				--proclevel;
 			}
@@ -540,9 +533,6 @@ 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 */
 			}
 ;
 

+ 0 - 3
lang/m2/comp/enter.c

@@ -183,9 +183,6 @@ EnterVarList(Idlist, type, local)
 				C_ina_dnam(df->var_name);
 			}
 		}
-#ifdef DBSYMTAB
-		if (options['g']) stb_string(df, D_VARIABLE);
-#endif /* DBSYMTAB */
 	}
 	FreeNode(Idlist);
 }

+ 2 - 0
lang/m2/comp/main.c

@@ -271,11 +271,13 @@ print("\nNumber of lines read: %d\n", cntlines);
 }
 #endif
 
+void
 No_Mem()
 {
 	fatal("out of memory");
 }
 
+void
 C_failed()
 {
 	fatal("write failed");

+ 4 - 29
lang/m2/comp/program.g

@@ -18,8 +18,8 @@
 #include	<em_code.h>
 #include	<stb.h>
 
-#include	"strict3rd.h"
 #include	"dbsymtab.h"
+#include	"strict3rd.h"
 #include	"main.h"
 #include	"idf.h"
 #include	"LLlex.h"
@@ -64,16 +64,8 @@ ModuleDeclaration
 	';'
 	import(1)*
 	export(&qualified, &exportlist)
-			{
-#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);
 			}
@@ -166,9 +158,6 @@ DefinitionModule
 			  DefinitionModule++;
 			  if (!Defined) {
 				Defined = df;
-#ifdef DBSYMTAB
-				if (options['g']) stb_string(df, D_MODULE);
-#endif /* DBSYMTAB */
 			  }
 			}
 	';'
@@ -219,12 +208,12 @@ definition
 			  df->df_type = construct_type(T_HIDDEN, NULLTYPE);
 			}
 	  ]
-	  ';'
 			{
 #ifdef DBSYMTAB
-			  if (options['g']) stb_string(df, D_TYPE);
-#endif /* DBSYMTAB */
+				if (options['g']) stb_string(df, D_TYPE);
+#endif
 			}
+	  ';'
 	]*
 |
 	VAR [ %persistent VariableDeclaration ';' ]*
@@ -254,26 +243,12 @@ 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
 		{
-#ifdef DBSYMTAB
-		  if (options['g']) {
-			if (state == PROGRAM) {
-				C_ms_stb_cst(df->df_idf->id_text,
-					     N_MAIN,
-					     0,
-					     (arith) 0);
-			}
-			stb_string(df, D_END);
-		  }
-#endif /* DBSYMTAB */
 		  close_scope(SC_CHKFORW|SC_CHKPROC|SC_REVERSE);
 		  match_id(df->df_idf, dot.TOK_IDF);
 		}

+ 36 - 0
lang/m2/comp/walk.c

@@ -60,6 +60,9 @@ static int		oldlineno;
 
 static int		RegisterMessage();
 static int		WalkDef();
+#ifdef DBSYMTAB
+static int		stabdef();
+#endif
 static int		MkCalls();
 static int		UseWarnings();
 
@@ -194,6 +197,19 @@ WalkModule(module)
 	text_label = 1;		/* label at end of initialization routine */
 	TmpOpen(sc);		/* Initialize for temporaries */
 	C_pro_narg(sc->sc_name);
+#ifdef DBSYMTAB
+	if (options['g']) {
+		stb_string(module, D_MODULE);
+		WalkDefList(sc->sc_def, stabdef);
+		if (state == PROGRAM && module == Defined) {
+			C_ms_stb_cst(module->df_idf->id_text,
+				     N_MAIN,
+				     0,
+				     (arith) 0);
+		}
+		stb_string(module, D_END);
+	}
+#endif
 	DoPriority();
 	if (module == Defined) {
 		/* Body of implementation or program module.
@@ -317,6 +333,9 @@ WalkProcedure(procedure)
 	C_pro_narg(procedure->prc_name);
 #ifdef DBSYMTAB
 	if (options['g']) {
+		stb_string(procedure, D_PROCEDURE);
+		WalkDefList(procscope->sc_def, stabdef);
+		stb_string(procedure, D_PEND);
 		C_ms_std((char *) 0, N_LBRAC, proclevel);
 	}
 #endif /* DBSYMTAB */
@@ -487,6 +506,9 @@ WalkProcedure(procedure)
 	C_pro(procedure->prc_name, -procscope->sc_off);
 #ifdef DBSYMTAB
 	if (options['g']) {
+		stb_string(procedure, D_PROCEDURE);
+		WalkDefList(procscope->sc_def, stabdef);
+		stb_string(procedure, D_PEND);
 		C_ms_std((char *) 0, N_LBRAC, proclevel);
 	}
 #endif /* DBSYMTAB */
@@ -1115,3 +1137,17 @@ WalkDefList(df, proc)
 		(*proc)(df);
 	}
 }
+
+#ifdef DBSYMTAB
+static int
+stabdef(df)
+	t_def	*df;
+{
+	switch(df->df_kind) {
+	case D_CONST:
+	case D_VARIABLE:
+		stb_string(df, df->df_kind);
+		break;
+	}
+}
+#endif