From d0288b673b5dfb2fbed2749afed4502a4abf8aa6 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 19 Dec 1995 09:30:48 +0000 Subject: [PATCH] Some improvements --- lang/m2/comp/stab.c | 32 ++++++++++++++++++-------------- lang/m2/comp/walk.c | 11 ++++++----- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lang/m2/comp/stab.c b/lang/m2/comp/stab.c index 7c1918cd3..54bf67408 100644 --- a/lang/m2/comp/stab.c +++ b/lang/m2/comp/stab.c @@ -223,6 +223,11 @@ stb_type(tp, assign_num) addc_db_str(';'); break; case T_PROCEDURE: + if (gdb_flag) { + addc_db_str('f'); + stb_type(tp->tp_next ? tp->tp_next : void_type, 0); + break; + } addc_db_str('Q'); stb_type(tp->tp_next ? tp->tp_next : void_type, 0); { @@ -281,12 +286,11 @@ stb_string(df, kind) if (gdb_flag) { addc_db_str('F'); stb_type(void_type, 0); - addc_db_str(';'); } else { adds_db_str(sprint(buf, "M%d;", df->mod_vis->sc_count)); } - C_ms_stb_pnam(db_str.base, N_FUN, proclevel, df->mod_vis->sc_scope->sc_name); + C_ms_stb_pnam(db_str.base, N_FUN, gdb_flag ? 0 : proclevel, df->mod_vis->sc_scope->sc_name); break; case D_PROCEDURE: if (gdb_flag) { @@ -307,15 +311,8 @@ stb_string(df, kind) sc = enclosing(sc); } } - addc_db_str(';'); - C_ms_stb_pnam(db_str.base, N_FUN, proclevel, df->prc_vis->sc_scope->sc_name); - { - register struct paramlist *p = tp->prc_params; - while (p) { - stb_string(p->par_def, D_VARIABLE); - p = p->par_next; - } - } + else addc_db_str(';'); + C_ms_stb_pnam(db_str.base, N_FUN, gdb_flag ? 0 : proclevel, df->prc_vis->sc_scope->sc_name); break; case D_END: if (gdb_flag) break; @@ -345,14 +342,21 @@ stb_string(df, kind) } else if (!proclevel || (df->df_flags & D_ADDRGIVEN)) { /* global */ - addc_db_str('G'); + int knd = N_LCSYM; + if (df->df_flags & D_EXPORTED) { + knd = N_GSYM; + addc_db_str('G'); + } + else { + addc_db_str('S'); + } stb_type(tp, 0); addc_db_str(';'); if (df->df_flags & D_ADDRGIVEN) { - C_ms_stb_cst(db_str.base, N_LCSYM, 0, df->var_off); + C_ms_stb_cst(db_str.base, knd, 0, df->var_off); } else { - C_ms_stb_dnam(db_str.base, N_LCSYM, 0, df->var_name, (arith) 0); + C_ms_stb_dnam(db_str.base, knd, 0, df->var_name, (arith) 0); } } else { /* local variable */ diff --git a/lang/m2/comp/walk.c b/lang/m2/comp/walk.c index 30f393028..f7bfa906f 100644 --- a/lang/m2/comp/walk.c +++ b/lang/m2/comp/walk.c @@ -48,6 +48,7 @@ extern arith NewInt(); extern arith TmpSpace(); extern int proclevel; +extern int gdb_flag; label text_label; label data_label = 1; @@ -247,7 +248,7 @@ WalkModule(module) proclevel++; #ifdef DBSYMTAB if (options['g']) { - C_ms_std((char *) 0, N_LBRAC, proclevel); + C_ms_std((char *) 0, N_LBRAC, gdb_flag ? 0 : proclevel); } #endif /* DBSYMTAB */ WalkNode(module->mod_body, NO_EXIT_LABEL, REACH_FLAG); @@ -257,7 +258,7 @@ WalkModule(module) C_ret((arith) 0); #ifdef DBSYMTAB if (options['g']) { - C_ms_std((char *) 0, N_RBRAC, proclevel); + C_ms_std((char *) 0, N_RBRAC, gdb_flag ? 0 : proclevel); } #endif /* DBSYMTAB */ C_end(-sc->sc_off); @@ -336,7 +337,7 @@ WalkProcedure(procedure) stb_string(procedure, D_PROCEDURE); WalkDefList(procscope->sc_def, stabdef); stb_string(procedure, D_PEND); - C_ms_std((char *) 0, N_LBRAC, proclevel); + C_ms_std((char *) 0, N_LBRAC, gdb_flag ? 0 : proclevel); } #endif /* DBSYMTAB */ C_ms_par(procedure->df_type->prc_nbpar @@ -509,7 +510,7 @@ WalkProcedure(procedure) stb_string(procedure, D_PROCEDURE); WalkDefList(procscope->sc_def, stabdef); stb_string(procedure, D_PEND); - C_ms_std((char *) 0, N_LBRAC, proclevel); + C_ms_std((char *) 0, N_LBRAC, gdb_flag ? 0 : proclevel); } #endif /* DBSYMTAB */ C_ms_par(procedure->df_type->prc_nbpar @@ -524,7 +525,7 @@ WalkProcedure(procedure) #endif #ifdef DBSYMTAB if (options['g']) { - C_ms_std((char *) 0, N_RBRAC, proclevel); + C_ms_std((char *) 0, N_RBRAC, gdb_flag ? 0 : proclevel); } #endif /* DBSYMTAB */ C_end(-procscope->sc_off);