crashinfo: print the content of ddb capture budder

Mikolaj Golub to.my.trociny at gmail.com
Fri Oct 9 21:25:15 UTC 2009


On Fri, 9 Oct 2009 11:28:11 -0400 John Baldwin wrote:

 JB> On Monday 05 October 2009 1:48:06 am Mikolaj Golub wrote:
 >> Hi,
 >> 
 >> It would be nice if crashinfo(8) were also trying to output the content of ddb
 >> capture buffer. Something like in this patch:
 >> 
 >> --- crashinfo.sh.orig        2009-10-05 08:26:26.000000000 +0300
 >> +++ crashinfo.sh        2009-10-05 08:43:56.000000000 +0300
 >> @@ -304,3 +304,18 @@
 >>  echo "kernel config"
 >>  echo
 >>  config -x $KERNEL
 >> +
 >> +file=`mktemp /tmp/crashinfo.XXXXXX`
 >> +if [ $? -eq 0 ]; then
 >> +        ddb capture -M $VMCORE -N $KERNEL print > $file 2>/dev/null
 >> +        if [ -s $file ]; then
 >> +                echo "------------------------------------------------------------------------"
 >> +                echo "ddb capture buffer"
 >> +                echo
 >> +                cat $file |
 >> +                sed -e 's/p\{10\}p*//' # XXX: this removes the unfilled part of a capture buffer
 >> +                echo
 >> +        fi
 >> +        rm -f $file
 >> +fi
 >> +
 >> 

 JB> I'm definitely in favor of this.  I assume you have tested it locally?  Do you have a sample
 JB> crash.X.txt file with it enabled?

I have tested it on 8.0.

zhuzha:~% ls -l /var/crash/vmcore.23                               
-rw------- 1 root wheel 166703104 2009-10-05 08:03 /var/crash/vmcore.23
zhuzha:~% sudo crashinfo 
Writing crash summary to /var/crash/core.txt.23.
zhuzha:~% grep -B5 -A30 'ddb capture buffer' /var/crash/core.txt.23
------------------------------------------------------------------------
kernel config

config: File /boot/kernel.old/kernel doesn't contain configuration file. Either unsupported, or not compiled with INCLUDE_CONFIG_FILE
------------------------------------------------------------------------
ddb capture buffer

db:0:kdb.enter.panic>  show pcpu
cpuid        = 0
dynamic pcpu    = 0x68ee80
curthread    = 0xc4a1ad80: pid 2276 "sysctl"
curpcb       = 0xe6d44d90
fpcurthread  = none
idlethread   = 0xc4576900: pid 11 "idle: cpu0"
APIC ID      = 0
currentldt   = 0x50
spin locks held:
db:0:kdb.enter.panic>  show allpcpu
Current CPU: 0

cpuid        = 0
dynamic pcpu    = 0x68ee80
curthread    = 0xc4a1ad80: pid 2276 "sysctl"
curpcb       = 0xe6d44d90
fpcurthread  = none
idlethread   = 0xc4576900: pid 11 "idle: cpu0"
APIC ID      = 0
currentldt   = 0x50
spin locks held:

cpuid        = 1
dynamic pcpu    = 0x34ffe80
curthread    = 0xc5837480: pid 2191 "screen"
curpcb       = 0xe6e5ed90
fpcurthread  = none
idlethread   = 0xc4576b40: pid 11 "idle: cpu1"
zhuzha:~% tail /var/crash/core.txt.23 
mi_switch(104,0,c0c798d3,1d6,44,...) at mi_switch+0x200
sleepq_switch(c0dc8190,0,c0c798d3,26e,0,...) at sleepq_switch+0x15f
sleepq_timedwait(c0dc7ee0,44,c0c7793c,0,0,...) at sleepq_timedwait+0x6b
_sleep(c0dc7ee0,0,44,c0c7793c,2710,...) at _sleep+0x339
scheduler(0,141ec00,141ec00,141e000,1425000,...) at scheduler+0x23e
mi_startup() at mi_startup+0x96
begin() at begin+0x2c
db:0:kdb.enter.panic>  call doadump


zhuzha:~% 

Actually the last echo in the patch looks like is not necessary.

Do you want the whole crash.23.txt file for review?

Also, I remember I tested it on crashdump of a kernel without ddb support and
no issues were noticed too.

-- 
Mikolaj Golub


More information about the freebsd-hackers mailing list