static char sccsid
[] = "@(#)display.c 4.3 %G%";
#define bread(a,b,c) stread(b,c)
#define blseek(a,b,c) stseek(b,c)
/* 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(adrtoprocp(callpc
++)); /* ++ because UNIX backs up instrs */
callpc
= get(frame
+16, DSP
);
argp
= get(frame
+8, DSP
);
frame
= get(frame
+12, DSP
) & EVEN
;
if (callpc
> 0x70000000) {
/* error handler kludge */
callpc
= get(frame
+64, DSP
);
argp
= get(frame
+8, DSP
);
frame
= get(frame
+12, DSP
) & EVEN
;
if ((frame
== 0) || (frame
& 0xf0000000 != 0x70000000))
return(adrtoprocp(callpc
-1));
/* returns core image address for variable */
if (debug
) printf("formaddr(%o, %d)\n", class & 0377, addr
);
switch(class & STABMASK
) {
printf("Bad class in formaddr: 0%o",
* If the register for the current frame is somewhere on the stack
* then return the address of where it is, otherwise its still in
* the register so return the register number.
* We distinguish the two by noting that register numbers are less
* than 16 and that stack addresses are greater.
register int curframe
, regfl
, mask
, i
;
for (procp
=initframe(); frame
!=curframe
; procp
=nextframe()) {
error("Stackreg error: frame");
mask
= get(frame
+4, DSP
);
error("Stackreg error: contents");
/* returns address of proc:var. Sets externals class and subflag */
return(findvar(proc
, var
, "", 0));
* displays values of variables matching proc:var,
char *proc
, *var
, *fmt
; {
return(findvar(proc
, var
, fmt
, 1));
* Find and print values of all variables matching proc:var
* using specified format.
* Returns address of last matching variable.
* prvar==1 => output value,
* prvar==2 => output addr
findvar(proc
, var
, fmt
, prvar
)
char *proc
, *var
, *fmt
; {
int metaflag
= 0, match
=0, nullflag
=0, depthcnt
= -1;
register struct proct
*procp
;
if (percentflag
) { /* kludge for register names */
return(regout(var
, prvar
, fmt
));
error("Unexpected null variable name");
metaflag
= eqany('*', proc
) || eqany('?', proc
) ||
eqany('*', var
) || eqany('?', var
);
comblk
= colonflag
? "" : "*";
if (integ
&& !eqany(var
[0], "->.[")) {
if (eqany(var
[0], "->.["))
if (!eqany(var
[0], "->.[") && !(nullflag
&& colonflag
)) {
if (eqpat(proc
, procp
->pname
)) {
if (--depthcnt
==0 || integ
==0) {
a
= outvar(procp
->pname
, var
, fmt
,
0, prname
, comblk
, prvar
);
} while ((procp
=nextframe()) != badproc
);
if ((colonflag
|| metaflag
|| a
== -1) &&
(nullflag
|| eqpat(proc
, ""))) {
a
= outvar("", var
, fmt
, metaflag
, integ
,
N_GSYM
, 0, prname
, comblk
, prvar
);
if (match
==0 && colonflag
) {
if (eqstr(curproc()->pname
, procp
->pname
))
} while ((procp
=nextframe()) != badproc
);
a
= outvar(curproc()->pname
, var
, fmt
, metaflag
,
integ
, N_GSYM
, 0, prname
,
nullflag
? "_BLNK_" : proc
, prvar
);
if (addr
== -1 && match
== 0) {
addr
= extoutvar(var
, fmt
, metaflag
, prvar
);
printf("%s not an active procedure\n", proc
);
printf("%.16s:%s not found\n", proc
, var
);
printf("%s:%s not found\n", proc
, var
);
printf("%s not found\n", var
);
typetodesc(type
, subflag
)
register int ptr
, ftn
, ary
;
static char *typedesc
[] = {
desc
= typedesc
[type
&BTMASK
];
for (; type
& TMASK
; type
= DECREF(type
)) {
else if (ISFTN(type
)) ftn
++;
else if (ISARY(type
)) ary
++;
if ((ptr
-subflag
== 1 || ary
-subflag
== 1) && desc
[0] == 'c')
printf ("PTR %d; FTN %d; ARY %d; DESC %s\n",ptr
,ftn
,ary
,desc
);
if (ptr
+ ary
== subflag
)
if (ptr
==1 && ftn
==1) return("p");
register int ptr
, ftn
, ary
;
static char typesize
[] = {
size
= typesize
[type
&BTMASK
];
for (; type
& TMASK
; type
= DECREF(type
)) {
else if (ISFTN(type
)) ftn
++;
else if (ISARY(type
)) ary
++;
printf ("PTR %d; FTN %d; ARY %d; SIZE %d; STSIZE %d\n",
ptr
,ftn
,ary
,size
,stsize
);
if (size
== 0) return(stsize
);
for (bkptr
= bkpthead
; bkptr
; bkptr
=bkptr
->nxtbkpt
)
printbkpt("", adrtoprocp(bkptr
->loc
), bkptr
->loc
);
printf("No breakpoints set\n");
/* interactively delete breakpoints */
register int yesflg
, cnt
;
for (bkptr
= bkpthead
; bkptr
; bkptr
=bkptr
->nxtbkpt
)
printbkpt(" ? ", adrtoprocp(bkptr
->loc
), bkptr
->loc
);
if (c
== 'y' || c
== 'd') yesflg
++;
printf("No breakpoints set\n");
/* delete all breakpoints */
for (bkptr
= bkpthead
; bkptr
; bkptr
=bkptr
->nxtbkpt
)
* Print name of breakpoint for a, b, d commands:
char *s
; struct proct
*procp
; ADDR dot
; {
/* set top to print just the top procedure */
if ((procp
= initframe()) == badproc
) return;
if (get(frame
+12, DSP
) == 0) return;
if (eqstr("__dbsubc", p
)) return;
offset
= procp
->st_offset
;
blseek(&sbuf
, offset
, 0);
if (bread(&sbuf
, &stentry
, sizeof stentry
) <
class = stentry
.n_type
& STABMASK
;
} while (class == N_FUN
);
while (class != N_PSYM
) {
if (bread(&sbuf
, &stentry
, sizeof stentry
) <
class = stentry
.n_type
& STABMASK
;
if (narg
& ~0xff) narg
= 0;
printf("%d", get(argp
, DSP
));
printf("%.16s=", stentry
.n_name
);
printf("%s=", stentry
.n_un
.n_name
);
dispx(argp
, "", N_GSYM
, stentry
.n_desc
,
length
= typetosize(stentry
.n_desc
, 0);
if (bread(&sbuf
, &stentry
, sizeof stentry
) <
class = stentry
.n_type
& STABMASK
;
} while (class != N_PSYM
);
l1
: if (--narg
!= 0) printf(",");
if (debug
) printf(" @ 0x%x ", callpc
);
if (procp
->sfptr
!= badfile
)
printf(" [%s:%d]", adrtofilep(callpc
-1)->sfilename
,
} while (((procp
= nextframe()) != badproc
) && !top
);
printf("%s", signals
[signo
]);
printf("signal %d???", signals
[signo
]);