From eb1326e3eccaaf37d257261fba06bc69224ec0df Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 1 Oct 1990 11:44:27 +0000 Subject: [PATCH] some more changes and fixes --- util/grind/c.c | 3 ++- util/grind/commands.g | 4 ++++ util/grind/dbx_string.g | 24 +++++++++++++++++++----- util/grind/expr.c | 8 ++++++++ util/grind/run.c | 12 ++++++++++-- util/grind/tree.c | 1 - 6 files changed, 43 insertions(+), 9 deletions(-) diff --git a/util/grind/c.c b/util/grind/c.c index 7908e7236..894eecd9d 100644 --- a/util/grind/c.c +++ b/util/grind/c.c @@ -109,9 +109,10 @@ unop_prio(op) case E_NOT: case E_BNOT: case E_MIN: - case E_MUL: + case E_DEREF: case E_SELECT: case E_PLUS: + case E_ADDR: return 12; } return 1; diff --git a/util/grind/commands.g b/util/grind/commands.g index 84da6d5aa..628ed0dbc 100644 --- a/util/grind/commands.g +++ b/util/grind/commands.g @@ -439,6 +439,10 @@ LLlex() c = getc(db_in); } while (c != EOF && class(c) == STSKIP); if (c == EOF) return c; + if (extended_charset && in_ext(c)) { + TOK = get_name(c); + return TOK; + } switch(class(c)) { case STSTR: TOK = (*currlang->get_string)(c); diff --git a/util/grind/dbx_string.g b/util/grind/dbx_string.g index ce7aaa001..ccbee0a8f 100644 --- a/util/grind/dbx_string.g +++ b/util/grind/dbx_string.g @@ -329,6 +329,8 @@ type(p_type *ptp; int *type_index; p_symbol sy;) p_type t1, t2; long ic1, ic2; int A_used = 0; + int tclass; + char *str; } : { *ptp = 0; } [ @@ -336,16 +338,28 @@ type(p_type *ptp; int *type_index; p_symbol sy;) /* these are used in C for references to a struct, union or * enum that has not been declared (yet) */ - 'x' { tp = new_type(); tp->ty_flags = T_CROSS; } + 'x' [ 's' /* struct */ - { tp->ty_class = T_STRUCT; } + { tclass = T_STRUCT; } | 'u' /* union */ - { tp->ty_class = T_UNION; } + { tclass = T_UNION; } | 'e' /* enum */ - { tp->ty_class = T_ENUM; } + { tclass = T_ENUM; } ] { AllowName = 1; } - name(&(tp->ty_tag)) + name(&str) + { sy = Lookfromscope(str2idf(str,0),CurrentScope,TAG); + if (sy && sy->sy_type->ty_class == tclass) { + tp = sy->sy_type; + } + else { + tp = new_type(); + tp->ty_flags = T_CROSS; + tp->ty_class = tclass; + tp->ty_tag = str; + sy = NewSymbol(str, CurrentScope, TAG, (struct outname *) 0); + } + } | /* subrange */ /* the integer_const's represent the lower and the upper bound. diff --git a/util/grind/expr.c b/util/grind/expr.c index aa1c137bf..59c3c5a9c 100644 --- a/util/grind/expr.c +++ b/util/grind/expr.c @@ -871,6 +871,14 @@ array_addr(p, paddr, psize, ptp) free(buf); return 0; } + if ((*ptp)->ty_class == T_POINTER) { + if (! get_bytes(pointer_size, *paddr, (char *) paddr)) { + error("could not get value"); + free(buf); + return 0; + } + *paddr = get_int((char *) paddr, pointer_size, T_UNSIGNED); + } if (! convert(&buf, &size, &tp, int_type, int_size)) { free(buf); return 0; diff --git a/util/grind/run.c b/util/grind/run.c index e36a16789..060d44a86 100644 --- a/util/grind/run.c +++ b/util/grind/run.c @@ -40,6 +40,7 @@ t_lineno currline, listline; static int catch_sigpipe(); static int stopped(); static int uputm(), ugetm(); +static t_addr curr_stop; int init_run() @@ -169,7 +170,13 @@ start_child(p) return 0; } do_items(); - if (! restoring) send_cont(1); + if (! restoring && ! item_addr_actions(curr_stop)) { + send_cont(1); + } + else if (! restoring) { + stopped("stopped", curr_stop); + handle_displays(); + } return 1; } @@ -294,10 +301,11 @@ stopped(s, a) if (s) { fprintf(db_out, "%s ", s); - pos = print_position((t_addr) a, 1); + pos = print_position(a, 1); fputs("\n", db_out); list_position(pos); } + curr_stop = a; return 1; } diff --git a/util/grind/tree.c b/util/grind/tree.c index aba0bc5ce..af76c08b6 100644 --- a/util/grind/tree.c +++ b/util/grind/tree.c @@ -368,7 +368,6 @@ do_list(p) p_position pos; if (a == ILL_ADDR) { - error("could not determine address"); return; } pos = get_position_from_addr(a);