Subject: port-next68k/6688: ddb backtrace after address trap skips faulting address
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dbj@netbsd.org>
List: netbsd-bugs
Date: 12/30/1998 04:42:54
>Number:         6688
>Category:       port-next68k
>Synopsis:       ddb backtrace after address trap skips faulting address
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-next68k-maintainer (NetBSD/next68k Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 30 01:50:01 1998
>Last-Modified:
>Originator:     Darrin B. Jewell
>Organization:
	
>Release:        -current, as of Wed Dec 30 09:36:24 UTC 1998
>Environment:

NetBSD/next68k.

NetBSD 1.3I (GENERIC) #124: Wed Dec 30 04:11:59 EST 1998
    dbj@dbj.ne.mediaone.net:/usr/incoming/cvs.netbsd.org/src/sys/arch/next68k/compile/GENERIC

Problem may be shared with other m68k ports.

>Description:
When I use ddb to trace after a kernel trap, it skips
the name of the routine in which the trap actually occurred.

>How-To-Repeat:

I made the following temporary change to the next68k's
cpu_startup routine:

$ cvs diff -u -C 5 machdep.c
Index: machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/next68k/next68k/machdep.c,v
retrieving revision 1.10
diff -u -u -C5 -r1.10 machdep.c
cvs server: conflicting specifications of output style
*** machdep.c   1998/11/14 04:32:50     1.10
--- machdep.c   1998/12/30 09:14:53
***************
*** 505,514 ****
--- 505,517 ----
        /*
         * Set up buffers, so they can be used to read disk labels.
         */
        bufinit();
  
+       printf("Forcing jump to page zero at address 0x33\n");
+       (*((void (*)(void))0x33))();    /* test seg fault */
+ 
        /*
         * Configure the system.
         */
        configure();
  }


Here's a log of the boot sequence:

Copyright (c) 1996, 1997, 1998
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 1.3I (GENERIC) #124: Wed Dec 30 04:11:59 EST 1998
    dbj@dbj.ne.mediaone.net:/usr/incoming/cvs.netbsd.org/src/sys/arch/next68k/compile/GENERIC
NeXT/MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches
real mem  = 33546240
avail mem = 28401664
using 409 buffers containing 1675264 bytes of memory
Forcing jump to page zero at address 0x33
trap type 1, code = 0, v = 32
kernel: Address error trap
pid = 0, pc = 000E0B00, ps = 2700, sfc = 1, dfc = 1
Registers:
             0        1        2        3        4        5        6        7
dreg: 00002704 00000051 00000000 00001240 00000001 00000000 00002000 0000000C
areg: 000D8C3E 00000000 0002CBBE 0012C784 000C933C 04000000 00174F78 FFEFFFFC

Kernel stack (00174EA8):
174EA8: 000DAA72 00174EF8 00000080 00000000 00001240 00000001 00000000 00002000
174EC8: 0000000C 0002CBBE 0012C784 000C933C 04000000 04000000 00000001 00174F78
174EE8: 00001370 00000001 00000000 00000032 00002704 00000051 00000000 00001240
174F08: 00000001 00000000 00002000 0000000C 000D8C3E 00000000 0002CBBE 0012C784
174F28: 000C933C 04000000 00174F78 FFEFFFFC 00000000 2700000E 0B00200C 00000032
174F48: 000E07EB 04001000 00000000 0000006E 00169000 00000000 0000000D FFEFFFFC
174F68: 0011BE6C 04169000 03290000 02D90000 00174FAC 0001C220 001024D8 04001000
174F88: 00000000 0000006E FFEFFFFC 05FFFC96 04169000 00178000 00169000 00000000
174FA8: 0000000D 00000000 00000011 0002B2D4 00178000 00000000 00001000 00001000
174FC8: 0012CEDC 0012CEE0 00174FF4 000E0668 00178000 00001000 04001000 00000000
174FE8: 0000006E FFEFFFFC 00000000 00000000 00000000 00000000 
panic: Address error
Stopped in  at  _Debugger+0x6:  unlk    a6
db> t
_Debugger(0,174ef8,12c784,174ee4,daa92) + 6
_panic(da716,0,1240,1,0) + 52
_trap(1,0,32) + 1c8
faultstkadj(1024d8,4001000,0,6e,ffeffffc) + 0
_main(2b2d4,178000,0,1000,1000) + 50
db> 


If I use addr2line to examine the kernel at the program counter
listed in the trap printout, I get the correct address:

0$ m68k-unknown-netbsd1.3E-addr2line -e ./netbsd.gdb 000E0B00
/usr/incoming/cvs.netbsd.org/src/sys/arch/next68k/compile/GENERIC/../../../../arch/next68k/next68k/machdep.c:511

>Fix:
        Examine addrerr4060 in locore.s to see if the stack is getting
saved correctly.  I thought I fixed this once before, but I can't
find any evidence of a fix in cvs logs.
>Audit-Trail:
>Unformatted: