cvs commit: src/sys/i386/i386 db_trace.c

John Baldwin jhb at FreeBSD.org
Thu Sep 9 13:44:38 PDT 2004


On Thursday 09 September 2004 04:39 pm, John Baldwin wrote:
> jhb         2004-09-09 20:39:31 UTC
>
>   FreeBSD src repository
>
>   Modified files:
>     sys/i386/i386        db_trace.c
>   Log:
>   Teach the stack trace code how to step across a double fault when
>   stepping across frames.  Basically, if the current frame is for the
>   'dblfault_handler' function, then get the next %eip and %ebp values to
>   use from the original TSS of the thread that has the saved state when the
>   double fault triggered.
>
>   MFC after:      4 days

Example output:

Enter full pathname of shell or RETURN for /bin/sh:
# kldload crash
# sysctl debug.crash
debug.crash.test: 0
# sysctl debug.crash.test=20
debug.crash.test: 0crash: blow the kernel stack on purpose

Fatal double fault:
eip = 0xc217c859
esp = 0xdfe52e80
ebp = 0xdfe53080
cpuid = 2; apic id = 02
panic: double fault
cpuid = 2
KDB: enter: panic
[thread 100096]
Stopped at      kdb_enter+0x30: leave
db> tra
kdb_enter(c0715078,2,c0730329,c07c3928,c215ab00) at kdb_enter+0x30
panic(c0730329,2,0,0,0) at panic+0x150
dblfault_handler() at dblfault_handler+0x8c
--- trap 0x17, eip = 0xc217c859, esp = 0xdfe52e80, ebp = 0xdfe53080 ---
blow_stack(0,0,0,0,0) at blow_stack+0x9
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(0,0,0,0,0) at blow_stack+0xe
blow_stack(c0711a9c,1b3,0,c215ab00,1c200) at blow_stack+0xe
blow_stack(c217dbb5,c217db60,c217db94,88,c2159c40) at blow_stack+0xe
crash_thread(0,dfe54d48,c07127ef,328,c215ab00) at crash_thread+0xd86
fork_exit(c217c870,0,dfe54d48) at fork_exit+0xc6
fork_trampoline() at fork_trampoline+0x8
--- trap 0x1, eip = 0, esp = 0xdfe54d7c, ebp = 0 ---
db>

Previously the stack trace would have just stopped at the 'dblfault_handler' 
line.  This should help with debugging double faults (which are usually due 
to an exhausted kernel stack) which have been a pain in the past.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the cvs-src mailing list