stack trace on crash

This commit is contained in:
deraadt 1994-11-23 07:00:00 +00:00
parent e99ed4c957
commit ef31ebbf26
2 changed files with 33 additions and 3 deletions

View File

@ -2906,6 +2906,13 @@ _esigcode:
#endif
#define ALTENTRY(x) .globl _##x; _##x:
/*
* getfp() - get stack frame pointer
*/
ENTRY(getfp)
retl
mov %fp, %o0
/*
* copyinstr(fromaddr, toaddr, maxlength, &lencopied)
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.34 1994/11/20 20:54:29 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.35 1994/11/23 07:00:10 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
@ -791,10 +791,13 @@ dumpsys()
register int (*dump) __P((dev_t, daddr_t, caddr_t, int));
int error = 0;
if (dumpdev == NODEV)
return;
/* copy registers to memory */
snapshot(cpcb);
stackdump();
if (dumpdev == NODEV)
return;
/*
* For dumps during autoconfiguration,
* if dump device has already configured...
@ -863,6 +866,26 @@ dumpsys()
}
}
/*
* get the fp and dump the stack as best we can. don't leave the
* current stack page
*/
stackdump()
{
struct frame *fp = (struct frame *)getfp(), *sfp;
sfp = fp;
printf("Frame pointer is at 0x%x\n", fp);
printf("Call traceback:\n");
while (fp && ((u_long)fp >> PGSHIFT) == ((u_long)sfp >> PGSHIFT)) {
printf(" pc = %x args = (%x, %x, %x, %x, %x, %x) fp = %x\n",
fp->fr_pc, fp->fr_arg[0], fp->fr_arg[1], fp->fr_arg[2],
fp->fr_arg[3], fp->fr_arg[4], fp->fr_arg[5], fp->fr_arg[6],
fp->fr_fp);
fp = fp->fr_fp;
}
}
int bt2pmt[] = {
PMAP_OBIO,
PMAP_OBIO,