kgdb - problem obtaining a backtrace

Mike Clarke jmc-freebsd2 at
Wed Dec 31 15:42:06 UTC 2008

Every time I plug my camera into the USB port on my 7.1-RC2 system I get 
a kernel panic. The camera causes no problem with 6.4-RELEASE on the 
same PC.

I have submitted a PR for this problem 
( and attached kgdb 
output with a backtrace. Unfortunately the backtrace was of no use as 
the fault occurs in a loaded module and I was asked to use asf(8) 
output to load the modules into kgdb and create a more useful 

Unfortunately when I did this I still got the same backtrace shown 

This is the first time I've needed to submit a PR and do things with 
crash dumps so I'm very much out of my depth in uncharted waters but 
willing to learn. Have I done something wrong with kgdb or is there 
some other problem with the dump file?

curlew#	kgdb /boot/kernel/kernel /var/crash/vmcore.0
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you 
welcome to change it and/or distribute copies of it under certain 
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for 
This GDB was configured as "i386-marcel-freebsd"...

Unread portion of the kernel message buffer:

Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address	= 0x0
fault code		= supervisor read, page not present
instruction pointer	= 0x20:0x0
stack pointer	        = 0x28:0xe55ed698
frame pointer	        = 0x28:0xe55ed6d8
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 14 (swi4: clock sio)
trap number		= 12
panic: page fault
cpuid = 0
Uptime: 2m50s
Physical memory: 1971 MB
Dumping 70 MB: 55 39 23 7

Reading symbols from /boot/kernel/acpi.ko...Reading symbols 
from /boot/kernel/acpi.ko.symbols...done.
Loaded symbols for /boot/kernel/acpi.ko
Reading symbols from /boot/kernel/linux.ko...Reading symbols 
from /boot/kernel/linux.ko.symbols...done.
Loaded symbols for /boot/kernel/linux.ko
#0  doadump () at pcpu.h:196
196	pcpu.h: No such file or directory.
	in pcpu.h
(kgdb) source /root/.asf
add symbol table from file "/boot/kernel/acpi.ko.symbols" at
	.text_addr = 0xc0db4350
	.data_addr = 0xc0df5000
	.bss_addr = 0xc0df73a0
add symbol table from file "/boot/kernel/linux.ko.symbols" at
	.text_addr = 0xc55a9080
	.data_addr = 0xc55bf080
	.bss_addr = 0xc55c16e0
(kgdb) backtrace
#0  doadump () at pcpu.h:196
#1  0xc0795627 in boot (howto=260) 
at /usr/src/sys/kern/kern_shutdown.c:418
#2  0xc07958f9 in panic (fmt=Variable "fmt" is not available.
) at /usr/src/sys/kern/kern_shutdown.c:574
#3  0xc0aa7b0c in trap_fatal (frame=0xe55ed658, eva=0)
    at /usr/src/sys/i386/i386/trap.c:939
#4  0xc0aa7d90 in trap_pfault (frame=0xe55ed658, usermode=0, eva=0)
    at /usr/src/sys/i386/i386/trap.c:852
#5  0xc0aa874c in trap (frame=0xe55ed658) 
at /usr/src/sys/i386/i386/trap.c:530
#6  0xc0a8e5bb in calltrap () at /usr/src/sys/i386/i386/exception.s:159
#7  0x00000000 in ?? ()
Previous frame inner to this frame (corrupt stack?)
(kgdb) q

I don't know if I did things the right way but here's the procedure I 
followed to get the backtrace:

The output of kldstat was:

Id Refs Address    Size     Name
 1    7 0xc0400000 9a1f68   kernel
 2    1 0xc0da2000 6a2c4    acpi.ko
 3    1 0xc5599000 22000    linux.ko

... and I ran the following command:

asf -N /boot/kernel/kernel -M /var/crash/vmcore.0 -s /boot/kernel

... which produced the following .asf file:

add-symbol-file /boot/kernel/acpi.ko.symbols 0xc0db4350 -s .data 
0xc0df5000 -s .bss 0xc0df73a0
add-symbol-file /boot/kernel/linux.ko.symbols 0xc55a9080 -s .data 
0xc55bf080 -s .bss 0xc55c16e0

... which I specified in a source command in kgdb

Mike Clarke

More information about the freebsd-questions mailing list