From 042d7b227565df289a185ce1670e4c733c7c729f Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 9 Jun 1993 14:18:43 +0000 Subject: [PATCH] Improved 'stop in' mechanism, and prevent core dump ir currlang is not set --- util/grind/db_symtab.g | 10 ++++++---- util/grind/main.c | 4 ++++ util/grind/scope.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/util/grind/db_symtab.g b/util/grind/db_symtab.g index 80bb4cd28..d25ad58dc 100644 --- a/util/grind/db_symtab.g +++ b/util/grind/db_symtab.g @@ -837,12 +837,14 @@ DbRead(f) if (sc) CurrentScope = sc; } - if (! saw_code && !CurrentScope->sc_bp_opp) { - CurrentScope->sc_bp_opp = n->on_valu; - if (! CurrentScope->sc_start) { + else if (! saw_code) { CurrentScope->sc_start = n->on_valu; add_scope_addr(CurrentScope); - } + } + if (!CurrentScope->sc_bp_opp + || CurrentScope->sc_bp_lineno > n->on_desc) { + CurrentScope->sc_bp_opp = n->on_valu; + CurrentScope->sc_bp_lineno = n->on_desc; } saw_code = 1; add_position_addr(line_file->on_mptr, n); diff --git a/util/grind/main.c b/util/grind/main.c index 2ff63ef2d..bdedac56f 100644 --- a/util/grind/main.c +++ b/util/grind/main.c @@ -11,6 +11,7 @@ #include "scope.h" #include "Lpars.h" #include "type.h" +#include "langdep.h" static char *usage = "Usage: %s [] []"; char *progname; @@ -95,6 +96,9 @@ main(argc, argv) reserve(tkidf); reserve(shorts); init_run(); + if (! currlang) { + fatal("could not determine source language. Recompile with -g?"); + } prompt(); Commands(); signal_child(SIGKILL); diff --git a/util/grind/scope.h b/util/grind/scope.h index 5a661d263..b92f49056 100644 --- a/util/grind/scope.h +++ b/util/grind/scope.h @@ -8,6 +8,7 @@ typedef struct scope { struct symbol *sc_definedby; /* symbol defining this scope */ long sc_start; /* start address of code of this scope */ long sc_bp_opp; /* first breakpoint opportunity */ + int sc_bp_lineno; /* linenumber belonging to this bp. */ short sc_proclevel; /* proc level of this scope */ char sc_has_activation_record; } t_scope, *p_scope; -- 2.34.1