Browse Source

some more changes and fixes

ceriel 34 years ago
parent
commit
eb1326e3ec
6 changed files with 43 additions and 9 deletions
  1. 2 1
      util/grind/c.c
  2. 4 0
      util/grind/commands.g
  3. 19 5
      util/grind/dbx_string.g
  4. 8 0
      util/grind/expr.c
  5. 10 2
      util/grind/run.c
  6. 0 1
      util/grind/tree.c

+ 2 - 1
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;

+ 4 - 0
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);

+ 19 - 5
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.

+ 8 - 0
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;

+ 10 - 2
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;
 }
 

+ 0 - 1
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);