Added some more support for debugger

This commit is contained in:
ceriel 1990-07-30 09:43:45 +00:00
parent f321062250
commit 5c0938d05b
3 changed files with 57 additions and 14 deletions

View file

@ -13,6 +13,8 @@
%{ %{
#include "comm0.h" #include "comm0.h"
#include "comm1.h" #include "comm1.h"
static item_t *last_it, *o_it;
%} %}
/* ========== Machine independent Yacc definitions ========== */ /* ========== Machine independent Yacc definitions ========== */
@ -49,6 +51,7 @@
%token COMMON %token COMMON
%token BASE %token BASE
%token SYMB %token SYMB
%token SYMD
%token ALIGN %token ALIGN
%token ASSERT %token ASSERT
%token SPACE %token SPACE
@ -164,7 +167,8 @@ operation
{ if ($2.val == 0 && pass == PASS_3) { if ($2.val == 0 && pass == PASS_3)
warning("assertion failed"); warning("assertion failed");
} }
| SYMB STRING ',' expr optabs2 optabs2 | SYMB STRING ',' expr { o_it = last_it; }
optabs2 optabs2
{ if ((sflag & SYM_SMB) && PASS_SYMB) { { if ((sflag & SYM_SMB) && PASS_SYMB) {
#ifndef ASLD #ifndef ASLD
if ( if (
@ -175,16 +179,45 @@ operation
serror("expression undefined"); serror("expression undefined");
relonami = -1; 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 #endif
newsymb( newsymb(
stringbuf+1, *(stringbuf+1) ? stringbuf+1 : (char *) 0,
(short)( (short)(
($4.typ & (S_EXT|S_TYP)) ($4.typ & (S_EXT|S_TYP))
| |
((ushort)$5<<8) ((ushort)$6<<8)
),
(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, (short)$6,
$4.val (valu_t)DOTVAL
); );
} }
} }
@ -258,6 +291,7 @@ expr : error
{ $$.val = $1; $$.typ = S_ABS;} { $$.val = $1; $$.typ = S_ABS;}
| id_fb | id_fb
{ $$.val = load($1); { $$.val = load($1);
last_it = $1;
$$.typ = $1->i_type & ~S_EXT; $$.typ = $1->i_type & ~S_EXT;
} }
| STRING | STRING

View file

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

View file

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