From 5ee060675df10a2f5da3a00fe2c9e7b9e4c5a067 Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Tue, 18 Sep 2001 01:51:55 +0000 Subject: Improve the panic message, print symbol and offset, of where fault occurs instead of just address. Managed to test this out a few times today. --- sys/arch/powerpc/powerpc/trap.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'sys/arch/powerpc') diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 9944452efb8..97d7b677fa5 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.30 2001/09/14 14:58:44 art Exp $ */ +/* $OpenBSD: trap.c,v 1.31 2001/09/18 01:51:54 drahn Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -55,6 +55,7 @@ #include #include +#include static int fix_unaligned __P((struct proc *p, struct trapframe *frame)); int badaddr __P((char *addr, u_int32_t len)); @@ -91,6 +92,8 @@ trap(frame) int type = frame->exc; u_quad_t sticks; union sigval sv; + char *name; + db_expr_t offset; if (frame->srr1 & PSL_PR) { type |= EXC_USER; @@ -346,8 +349,13 @@ mpc_print_pci_stat(); /* set up registers */ db_save_regs(frame); #endif - panic ("trap type %x at %x lr %x\n", - type, frame->srr0, frame->lr); + db_find_sym_and_offset(frame->srr0, &name, &offset); + if (!name) { + name = "0"; + offset = frame->srr0; + } + panic ("trap type %x at %x (%s+0x%x) lr %x\n", + type, frame->srr0, name, offset, frame->lr); case EXC_PGM|EXC_USER: -- cgit v1.2.3