Browse Source

Added some more support for debugger

ceriel 34 years ago
parent
commit
28f52822c9
3 changed files with 57 additions and 14 deletions
  1. 38 4
      mach/proto/as/comm2.y
  2. 1 0
      mach/proto/as/comm3.c
  3. 18 10
      mach/proto/as/comm6.c

+ 38 - 4
mach/proto/as/comm2.y

@@ -13,6 +13,8 @@
 %{
 #include	"comm0.h"
 #include	"comm1.h"
+
+static item_t	*last_it, *o_it;
 %}
 
 /* ========== Machine independent Yacc definitions ========== */
@@ -49,6 +51,7 @@
 %token COMMON
 %token BASE
 %token SYMB
+%token SYMD
 %token ALIGN
 %token ASSERT
 %token SPACE
@@ -164,7 +167,8 @@ operation
 			{	if ($2.val == 0 && pass == PASS_3)
 					warning("assertion failed");
 			}
-	|	SYMB STRING ',' expr optabs2 optabs2
+	|	SYMB STRING ',' expr	{ o_it = last_it; }
+		optabs2 optabs2
 			{	if ((sflag & SYM_SMB) && PASS_SYMB) {
 #ifndef ASLD
 					if (
@@ -175,19 +179,48 @@ operation
 						serror("expression undefined");
 						relonami = -1;
 					}
+					if (
+						PASS_SYMB
+						&&
+						($4.typ & S_COM)
+					   ) {
+						/* No value is known at
+						   assembler time.
+						   Generate reference to other
+						   entry in name table
+						*/
+						$4.typ = S_CRS;
+						$4.val = new_string(o_it->i_name);
+						relonami = 0;
+					}
 #endif
+					    
 					newsymb(
-						stringbuf+1,
+						*(stringbuf+1) ? stringbuf+1 : (char *) 0,
 						(short)(
 							($4.typ & (S_EXT|S_TYP))
 							|
-							((ushort)$5<<8)
+							((ushort)$6<<8)
 						),
-						(short)$6,
+						(short)$7,
 						$4.val
 					);
 				}
 			}
+	|	SYMD STRING ','  absexp ',' absexp
+			{	if ((sflag & SYM_SMB) && PASS_SYMB) {
+					newsymb(
+						*(stringbuf+1) ? stringbuf+1 : (char *) 0,
+						(short)(
+							(DOTTYP & (S_EXT|S_TYP))
+							|
+							((ushort)$4<<8)
+						),
+						(short)$6,
+						(valu_t)DOTVAL
+					);
+				}
+			}
 	|	LINE optabs1
 			{	if ((sflag & SYM_LIN) && PASS_SYMB) {
 					if ($2)
@@ -258,6 +291,7 @@ expr	:	error
 			{	$$.val = $1; $$.typ = S_ABS;}
 	|	id_fb
 			{	$$.val = load($1); 
+				last_it = $1;
 				$$.typ = $1->i_type & ~S_EXT;
 			}
 	|	STRING

+ 1 - 0
mach/proto/as/comm3.c

@@ -38,6 +38,7 @@ item_t	keytab[] = {
 	0,	SECTION,	0,		".sect",
 	0,	BASE,		0,		".base",
 	0,	SYMB,		0,		".symb",
+	0,	SYMD,		0,		".symd",
 	0,	LINE,		0,		".line",
 	0,	FILe,		0,		".file",
 #ifdef LISTING

+ 18 - 10
mach/proto/as/comm6.c

@@ -310,6 +310,22 @@ short s;
 }
 #endif
 
+long
+new_string(s)
+	char	*s;
+{
+	long	r = 0;
+
+	if (s) {
+		long len = strlen(s) + 1;
+
+		r = outhead.oh_nchar;
+		if (pass == PASS_3) wr_string(s, len);
+		outhead.oh_nchar += len;
+	}
+	return r;
+}
+
 newsymb(name, type, desc, valu)
 register char *name;
 short type;
@@ -322,20 +338,12 @@ valu_t valu;
 		name = 0;
 	assert(PASS_SYMB);
 	if (pass != PASS_3) {
-		if (name)
-			outhead.oh_nchar += strlen(name)+1;
+		new_string(name);
 		outhead.oh_nname++;
 		return;
 	}
 	nname++;
-	if (name) {
-		long len = strlen(name) + 1;
-
-		wr_string(name, len);
-		outname.on_foff = outhead.oh_nchar;
-		outhead.oh_nchar += len;
-	} else
-		outname.on_foff = 0;
+	outname.on_foff = new_string(name);
 	outname.on_type = type;
 	outname.on_desc = desc;
 	outname.on_valu = valu & ~(((0xFFFFFFFF)<<(4*sizeof(valu_t)))<<(4*sizeof(valu_t)));