Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Aug 1999 17:24:26 -0400 (EDT)
From:      Zhihui Zhang <zzhang@cs.binghamton.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Need help with kernel trace
Message-ID:  <Pine.GSO.3.96.990814170018.8717A-100000@sol.cs.binghamton.edu>

next in thread | raw e-mail | index | archive | help

I think it helps to understand a routine in the kernel code if I know how
the routine is called and what parameters are being passed to it. To get
such information, I decide to simulate a panic whenever that routine is
called.  For example, I want know how link() in vfs_syscalls.c is called
and what parameters are being passed to it.  I add a sysctl variable named
"debug.link_panic" and at the very beginning of link(), I add the
following statement:

      if (link_panic) panic("link() is called");

The system panics whenever I set debug.link_panic to 1 and issue a ln
command at the prompt as expected.

Now the problem is how to use the coredump to get the information I am
interested. The following script records the process I tried: 

now5# cd /usr/crash
now5# gdb -k -s /usr/crash/kernel.gdb kernel.4 vmcore.4
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-unknown-freebsd"...
(no debugging symbols found)...
IdlePTD 3588096

kernel symbol `gd_curpcb' not found.
(kgdb) where
No stack.

I expected that I could have a stack to trace down how link() is called
step by step. But it seems to me that I can not do so. 

The kernel is configured with "config -g" and "make installed" after doing
"strip -g kernel".  The file kernel.gdb is copied from the directory
/usr/src/sys/compile/DDB to /usr/crash before being stripped.  The
/var/crash is too small, therefore I modified the file /etc/rc so that
savecore will save core dumps under /usr/crash.  The system is running
FreeBSD 3.2 - Release.

Any help is appreciated.

--------------------------------------------------
Zhihui Zhang.  Please visit http://www.freebsd.org
--------------------------------------------------



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.3.96.990814170018.8717A-100000>