/* initialize frame pointers to top of call stack */
argp
= *(ADDR
*) (((ADDR
) &u
) + AP
);
frame
= *(ADDR
*) (((ADDR
) &u
) + FP
);
callpc
= *(ADDR
*) (((ADDR
) &u
) + PC
);
if ((frame
== 0) || (frame
& 0xf0000000 != 0x70000000))
return(adrtoproc(callpc
++)); /* ++ because UNIX backs up instrs */
callpc
= get(frame
+16, DSP
);
argp
= get(frame
+8, DSP
);
frame
= get(frame
+12, DSP
) & EVEN
;
if ((frame
== 0) || (frame
& 0xf0000000 != 0x70000000))
return(adrtoproc(callpc
-1));
if ((procp
= initframe()) == badproc
) return;
if (get(frame
+12, DSP
) == 0) return;
if (narg
& ~0xff) narg
= 0;
printf("%d", get(argp
+=4, DSP
));
if (--narg
!= 0) printf(",");
if (procp
->sfptr
!= badfile
)
printf(" [%s:%d]", adrtofilep(callpc
-1)->sfilename
,
} while ((procp
= nextframe()) != badproc
);
printf("%s", signals
[signo
]);
/* returns core image address for variable */
formaddr(proc
, class, addr
)
if (debug
) printf("formaddr(%s, %o, %d)\n", proc
,class & 0377,addr
);
switch(class & STABMASK
) {
if (getframe(proc
) < 0) return(-1);
if (getframe(proc
) < 0) return(-1);
if (getframe(proc
) < 0) return(-1);
printf("Bad class in formaddr: 0%o: (%d, %d)\n",
class & 0377, proc
, addr
);
/* sets frame pointers to procedure proc */
register struct proct
*procp
, *fprocp
;
printf("%s: Bad procedure name\n", proc
);
for (fprocp
= initframe(); fprocp
!= badproc
; fprocp
= nextframe()) {
if (procp
== fprocp
) return(0);
printf("%s: Not an active procedure\n", proc
);
/* returns address of proc:var. Sets externals class and subflag */
register struct proct
*procp
;
if (debug
) printf("varaddr(%s,%s)\n", proc
, var
);
if (eqstr(proc
, procp
->pname
)) goto found
;
} while ((procp
=nextframe()) != badproc
);
if (eqany(var
[0], ".->")) {
if (localflag
|| slookup(var
, adrtostoffset(callpc
-1)) == -1) {
if (globallookup(var
,findfile(curfile
)->stf_offset
) == -1) {
printf("%.8s not found\n", var
);
printf("%.8s:%s not found\n", proc
, var
);
class = sl_class
& STABMASK
;
addr
= (class == N_LSYM
) ? -sl_addr
: sl_addr
;
addr
= formaddr(proc
, class, addr
);
if (addr
== -1) return(-1);
if (*p
== '.' && *(p
+1) != '\0') {
error("Not with a register variable");
if (localflag
|| slookup(p
, adrtostoffset(callpc
-1)) == -1) {
if (globallookup(p
, findfile(curfile
)->stf_offset
) == -1) {
printf("%s not found\n", var
);
printf("%.8s:%s not found\n", proc
, var
);
if ((sl_class
& STABMASK
) != N_SSYM
) {
error("Not a structure element");
if (eqany(*p
, "->") != '\0') {
addr
= getindir(class, addr
, sl_type
);
if (debug
) printf("Address %d after getval\n", addr
);
for (; eqany(*p
, "->"); p
++) ;
slookup(p
, adrtostoffset(callpc
-1)) == -1) {
if (globallookup(p
, findfile(curfile
)->stf_offset
) == -1) {
printf("%s not found\n", var
);
printf("%.8s:%s not found\n", proc
, var
);
if (*p
== '[' && *(p
+1) != '\0') {
if (debug
) printf("Size %d\n", typetosize(sl_type
, sl_size
));
addr
= getindir(class, addr
, sl_type
);
addr
+= typetosize(sl_type
, sl_size
)*i
;
/* displays value of proc:var, returns its address */
char *proc
, *var
, *fmt
; {
addr
= varaddr(proc
, var
);
if (addr
== -1) return(-1);
prvar(sl_type
, addr
, fmt
, class, subflag
);
prvar(type
, addr
, fmt
, class, subflag
)
char *fmt
, class; short type
; {
dispf(addr
, fmt
, class, type
, subflag
);
register struct proct
*procp
;
register struct filet
*filep
;
printf("extstart = %d\n", extstart
);
for(filep
=files
;filep
->sfilename
[0];filep
++)
printf("%s offs %d @ %d flag %d addr %d\n", filep
->sfilename
, filep
->stf_offset
, filep
, filep
->lineflag
, filep
->faddr
);
for(procp
=procs
;procp
->pname
[0];procp
++)
printf("%8.8s addr %d; offs %d; sfptr %d; line %d\n",
procp
->pname
, procp
->paddr
, procp
->st_offset
, procp
->sfptr
,
/* display addr using format desc or class s */
dispf(addr
, desc
, class, type
, subflag
)
char *desc
; short type
; ADDR addr
; {
if (desc
[0] == '\0') desc
= typetodesc(type
, subflag
);
if (debug
) printf("dispf(%d,%s,0%o,0%o)\n", addr
,desc
,class,type
);
for (p
= desc
; *p
; p
++) {
printf("Illegal descriptor: %c\n", *p
);
if ((addr
> 0 && addr
< 6) || addr
> 11) {
printf("Bad register var %d\n", addr
);
value
= *(ADDR
*)(((ADDR
) &u
) + R0
+ (WORDSIZE
)*addr
);
value
= getval(addr
, dfmt
);
value
= (unsigned short) value
;
value
= (unsigned char) value
;
value
= (unsigned long) value
;
if (value
> 9 && dfmt
== 'x')
else if (value
> 7 && dfmt
== 'o')
if ((value
& 0177) < ' ')
printf("^%c\n", value
+ ('A' - 1));
else if ((value
& 0177) == 0177)
word
.w
= getval(addr
,dfmt
);
dbl
.w1
= getval(addr
, dfmt
);
dbl
.w2
= getval(addr
+WORDSIZE
, dfmt
);
addr
= getindir(class, addr
, type
);
word
.w
= getval(addr
, 'd');
for (i
=0; i
<WORDSIZE
; i
++) {
if (word
.c
[i
] == 0) goto l1
;
for (bkptr
= bkpthead
; bkptr
; bkptr
=bkptr
->nxtbkpt
)
printf("%.8s:%d\n", adrtoprocp(bkptr
->loc
)->pname
,
adrtolineno(bkptr
->loc
));
printf("No breakpoints set\n");
register int yesflg
, cnt
;
for (bkptr
= bkpthead
; bkptr
; bkptr
=bkptr
->nxtbkpt
)
printf("%.8s:%d ? ", adrtoprocp(bkptr
->loc
)->pname
,
adrtolineno(bkptr
->loc
));
if (c
== 'y' || c
== 'd') yesflg
++;
printf("No breakpoints set\n");
typetodesc(type
, subflag
)
register int ptr
, ftn
, ary
;
static char *typedesc
[] = {
for (;; type
= DECREF(type
)) {
else if (ISFTN(type
)) ftn
++;
else if (ISARY(type
)) ary
++;
if ((ptr
-subflag
== 1 || ary
-subflag
== 1) && desc
[0] == 'c') return("s");
if (debug
) printf ("PTR %d; FTN %d; ARY %d; DESC %s\n",ptr
,ftn
,ary
,desc
);
register int ptr
, ftn
, ary
;
static char typesize
[] = {
for (;; type
= DECREF(type
)) {
else if (ISFTN(type
)) ftn
++;
else if (ISARY(type
)) ary
++;
if (debug
) printf ("PTR %d; FTN %d; ARY %d; SIZE %d; STSIZE %d\n",ptr
,ftn
,ary
,size
,stsize
);
if (size
== 0) return(stsize
? stsize
: 1);