Garbage-collect regdump() and friends.

This commit is contained in:
thorpej 1997-04-09 20:31:39 +00:00
parent 63ed6b6c2f
commit d1ecda44c4
1 changed files with 1 additions and 92 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.17 1997/03/27 21:01:39 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.18 1997/04/09 20:31:39 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1049,97 +1049,6 @@ mvme68k_abort(cp)
#endif /* DDB */
}
regdump(fp, sbytes)
struct frame *fp; /* must not be register */
int sbytes;
{
static int doingdump = 0;
register int i;
int s;
extern char *hexstr();
if (doingdump)
return;
s = splhigh();
doingdump = 1;
printf("pid = %d, pc = %s, ",
curproc ? curproc->p_pid : -1, hexstr(fp->f_pc, 8));
printf("ps = %s, ", hexstr(fp->f_sr, 4));
printf("sfc = %s, ", hexstr(getsfc(), 4));
printf("dfc = %s\n", hexstr(getdfc(), 4));
printf("Registers:\n ");
for (i = 0; i < 8; i++)
printf(" %d", i);
printf("\ndreg:");
for (i = 0; i < 8; i++)
printf(" %s", hexstr(fp->f_regs[i], 8));
printf("\nareg:");
for (i = 0; i < 8; i++)
printf(" %s", hexstr(fp->f_regs[i+8], 8));
if (sbytes > 0) {
if (fp->f_sr & PSL_S) {
printf("\n\nKernel stack (%s):",
hexstr((int)(((int *)&fp)-1), 8));
dumpmem(((int *)&fp)-1, sbytes, 0);
} else {
printf("\n\nUser stack (%s):", hexstr(fp->f_regs[SP], 8));
dumpmem((int *)fp->f_regs[SP], sbytes, 1);
}
}
doingdump = 0;
splx(s);
}
#define KSADDR ((int *)((u_int)curproc->p_addr + USPACE - NBPG))
dumpmem(ptr, sz, ustack)
register int *ptr;
int sz, ustack;
{
register int i, val;
extern char *hexstr();
for (i = 0; i < sz; i++) {
if ((i & 7) == 0)
printf("\n%s: ", hexstr((int)ptr, 6));
else
printf(" ");
if (ustack == 1) {
if ((val = fuword(ptr++)) == -1)
break;
} else {
if (ustack == 0 &&
(ptr < KSADDR || ptr > KSADDR+(NBPG/4-1)))
break;
val = *ptr++;
}
printf("%s", hexstr(val, 8));
}
printf("\n");
}
char *
hexstr(val, len)
register int val;
int len;
{
static char nbuf[9];
register int x, i;
if (len > 8)
return("");
nbuf[len] = '\0';
for (i = len-1; i >= 0; --i) {
x = val & 0xF;
if (x > 9)
nbuf[i] = x - 10 + 'A';
else
nbuf[i] = x + '0';
val >>= 4;
}
return(nbuf);
}
/*
* cpu_exec_aout_makecmds():
* cpu-dependent a.out format hook for execve().