Subject: Better ddb backtraces (Was: CVS commit: src/sys/arch/sh3/sh3)
To: None <port-sh3@NetBSD.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sh3
Date: 04/20/2005 06:14:57
On Wed, Apr 20, 2005 at 01:56:17 +0000, Valeriy E. Ushakov wrote:

> Module Name:	src
> Committed By:	uwe
> Date:		Wed Apr 20 01:56:17 UTC 2005
> 
> Modified Files:
> 	src/sys/arch/sh3/sh3: db_trace.c
> 
> Log Message:
> Teach db_stack_trace_print() to step through trap frames so that
> backtraces on kernel exceptions are actually useful.  Stop tracing at
> traps from user mode for now.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -r1.14 -r1.15 src/sys/arch/sh3/sh3/db_trace.c

So now, instead of 

    db> t
    cpu_Debugger() at netbsd:panic+0x98
    panic() at netbsd:tlb_exception+0x3ec
    tlb_exception() at 0x8c0004ba
    () at 0

it prints more meaningful

    db> t      
    cpu_Debugger() at netbsd:panic+0x98
    panic() at netbsd:tlb_exception+0x3ec
    tlb_exception() at 0x8c0004ba
    <EXPEVT 040; SSR=400001f0> at netbsd:pmap_extract+0x32
    pmap_extract() at netbsd:dmac_attach+0x20
    dmac_attach() at netbsd:config_attach_loc+0x2c0
    config_attach_loc() at netbsd:shb_search+0x2a
    shb_search() at netbsd:mapply+0x68
    mapply() at netbsd:config_search+0x74
    config_search() at netbsd:shb_attach+0x1a
    shb_attach() at netbsd:config_attach_loc+0x2c0
    config_attach_loc() at netbsd:mainbus_search+0x68
    mainbus_search() at netbsd:mapply+0x68
    mapply() at netbsd:config_search+0x74
    config_search() at netbsd:mainbus_attach+0x3e
    mainbus_attach() at netbsd:config_attach_loc+0x2c0
    config_attach_loc() at netbsd:config_rootfound+0x2e
    config_rootfound() at netbsd:cpu_configure+0x38
    cpu_configure() at netbsd:configure+0x48
    configure() at netbsd:main+0x1e8
    main() at netbsd:machine_startup+0x2a6
    machine_startup() at 0
    () at 0    

Trap frames are detected by a call coming from within a page from VBR.
For now the trace stops at exceptions coming from user mode.

I'd appreciate if you can give it a try and report any problems, as I
really only tested it on this one particular panic :)

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen