From owner-freebsd-doc Thu Nov 2 1:36: 7 2000 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2941737B479; Thu, 2 Nov 2000 01:36:01 -0800 (PST) Received: (from jkoshy@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA50414; Thu, 2 Nov 2000 01:36:00 -0800 (PST) (envelope-from jkoshy@FreeBSD.org) Date: Thu, 2 Nov 2000 01:36:00 -0800 (PST) From: Message-Id: <200011020936.BAA50414@freefall.freebsd.org> X-Mailer: exmh version 2.0.2 2/24/98 To: nik@FreeBSD.org, ben@FreeBSD.org Cc: ahampi@yahoo.com, freebsd-doc@FreeBSD.org Subject: patch to handbook::kerneldebug Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_-89006380" Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This is a multipart MIME message. --==_Exmh_-89006380 Content-Type: text/plain GDB now needs an explicit "-k" option to switch to kernel debugging mode. The tactic of invoking GDB under the name of "kgdb" hasn't worked for a while. The following patch corrects the Kernel Debugging chapter of the handbook to reflect this change. Could you please review? Regards, Koshy --==_Exmh_-89006380 Content-Type: text/plain ; name="kgdb-patch" Content-Description: kgdb-patch Content-Disposition: attachment; filename="kgdb-patch" Index: kerneldebug/chapter.sgml =================================================================== RCS file: /home/ncvs/doc/en_US.ISO_8859-1/books/handbook/kerneldebug/chapter.sgml,v retrieving revision 1.25 diff -u -r1.25 chapter.sgml --- kerneldebug/chapter.sgml 2000/07/14 21:57:34 1.25 +++ kerneldebug/chapter.sgml 2000/11/02 09:16:30 @@ -10,7 +10,7 @@ Contributed by &a.paul; and &a.joerg; - Debugging a Kernel Crash Dump with <command>kgdb</command> + Debugging a Kernel Crash Dump with <command>gdb</command> Here are some instructions for getting kernel debugging working on a crash dump. They assume that you have enough swap space for a crash @@ -23,7 +23,7 @@ /etc/rc.conf. Typically you want to specify one of the swap devices specified in /etc/fstab. Dumps to non-swap devices, tapes for example, are currently not supported. Config - your kernel using config -g. See config . See Kernel Configuration for details on configuring the FreeBSD kernel. @@ -37,15 +37,12 @@ you want a crash dump from a kernel that crashes during booting. - In the following, the term kgdb refers to - gdb run in kernel debug mode. This - can be accomplished by either starting the gdb with - the option , or by linking and starting it under - the name kgdb. This is not being done by default, - however, and the idea is basically deprecated since the GNU folks do - not like their tools to behave differently when called by another - name. This feature may well be discontinued in further - releases. + In the following, the term gdb refers to + the debugger gdb run in kernel debug + mode. This can be accomplished by starting the + gdb with the option . In + kernel debug mode, gdb changes its prompt to + (kgdb). @@ -89,7 +86,7 @@ Now, after a crash dump, go to /sys/compile/WHATEVER and run - kgdb. From kgdb do: + gdb . From gdb do: symbol-file kernel.debug exec-file /var/crash/kernel.0 @@ -98,7 +95,7 @@ and voila, you can debug the crash dump using the kernel sources just like you can for any other program. - Here is a script log of a kgdb session + Here is a script log of a gdb session illustrating the procedure. Long lines have been folded to improve readability, and the lines are numbered for reference. Despite this, it is a real-world error trace taken during the development of the pcvt @@ -106,7 +103,7 @@ 1:Script started on Fri Dec 30 23:15:22 1994 2:&prompt.root; cd /sys/compile/URIAH - 3:&prompt.root; kgdb kernel /var/crash/vmcore.1 + 3:&prompt.root; gdb -k kernel /var/crash/vmcore.1 4:Reading symbol data from /usr/src/sys/compile/URIAH/kernel ...done. 5:IdlePTD 1f3000 @@ -291,7 +288,7 @@ might be incomplete for some places, as can be seen in the stack trace in the example above where some functions are displayed without line numbers and argument lists. If you need more debugging symbols, remove - the appropriate object files and repeat the kgdb + the appropriate object files and repeat the gdb session until you know enough. All this is not guaranteed to work, but it will do it fine in most @@ -301,7 +298,7 @@ On-Line Kernel Debugging Using DDB - While kgdb as an off-line debugger provides a very + While gdb as an off-line debugger provides a very high level of user interface, there are some things it cannot do. The most important ones being breakpointing and single-stepping kernel code. @@ -311,7 +308,7 @@ breakpoints, single-stepping kernel functions, examining and changing kernel variables, etc. However, it cannot access kernel source files, and only has access to the global and static symbols, not to the full - debug information like kgdb. + debug information like gdb. To configure your kernel to include DDB, add the option line @@ -467,7 +464,7 @@ panic This will cause your kernel to dump core and reboot, so you can - later analyze the core on a higher level with kgdb. This command + later analyze the core on a higher level with gdb. This command usually must be followed by another continue statement. @@ -517,7 +514,7 @@ of the target machine that has "flags 080" set on its sio device to any serial line of the debugging host. Now, on the debugging machine, go to the compile directory of the target - kernel, and start gdb: + kernel, and start gdb: &prompt.user; gdb -k kernel GDB is free software and you are welcome to distribute copies of it --==_Exmh_-89006380-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message