Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2000 01:36:00 -0800 (PST)
From:      <jkoshy@FreeBSD.org>
To:        nik@FreeBSD.org, ben@FreeBSD.org
Cc:        ahampi@yahoo.com, freebsd-doc@FreeBSD.org
Subject:   patch to handbook::kerneldebug
Message-ID:  <200011020936.BAA50414@freefall.freebsd.org>

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

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
<jkoshy@freebsd.org>


--==_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 @@
   <para><emphasis>Contributed by &a.paul; and &a.joerg;</emphasis></para>
   
   <sect1>
-    <title>Debugging a Kernel Crash Dump with <command>kgdb</command></title>
+    <title>Debugging a Kernel Crash Dump with <command>gdb</command></title>
     
     <para>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 @@
       <filename>/etc/rc.conf</filename>.  Typically you want to specify one of
       the swap devices specified in <filename>/etc/fstab</filename>. Dumps to
       non-swap devices, tapes for example, are currently not supported. Config
-      your kernel using <command>config -g</command>.  See <link
+      your kernel using <command>config <option>-g</option></command>.  See <link
 	linkend="kernelconfig">Kernel Configuration</link> for details on
       configuring the FreeBSD kernel.</para>
 
@@ -37,15 +37,12 @@
       you want a crash dump from a kernel that crashes during booting.</para>
     
     <note>
-      <para>In the following, the term <command>kgdb</command> refers to
-	<command>gdb</command> run in <quote>kernel debug mode</quote>.  This
-	can be accomplished by either starting the <command>gdb</command> with
-	the option <option>-k</option>, or by linking and starting it under
-	the name <command>kgdb</command>.  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.</para>
+      <para>In the following, the term <command>gdb</command> refers to
+        the debugger <command>gdb</command> run in <quote>kernel debug 
+        mode</quote>.  This can be accomplished by starting the 
+        <command>gdb</command> with the option <option>-k</option>.  In 
+        kernel debug mode, <command>gdb</command> changes its prompt to 
+        <prompt>(kgdb)</prompt>.</para>
     </note>
     
     <tip>
@@ -89,7 +86,7 @@
     
     <para>Now, after a crash dump, go to
       <filename>/sys/compile/WHATEVER</filename> and run
-      <command>kgdb</command>.  From <command>kgdb</command> do:
+      <command>gdb <option>-k</option></command>.  From <command>gdb</command> do:
 	  
       <screen><userinput>symbol-file kernel.debug</userinput>
 <userinput>exec-file /var/crash/kernel.0</userinput>
@@ -98,7 +95,7 @@
       and voila, you can debug the crash dump using the kernel sources just
       like you can for any other program.</para>
 
-    <para>Here is a script log of a <command>kgdb</command> session
+    <para>Here is a script log of a <command>gdb</command> 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 @@
     
 <screen> 1:Script started on Fri Dec 30 23:15:22 1994
  2:&prompt.root; <userinput>cd /sys/compile/URIAH</userinput>
- 3:&prompt.root; <userinput>kgdb kernel /var/crash/vmcore.1</userinput> 
+ 3:&prompt.root; <userinput>gdb -k kernel /var/crash/vmcore.1</userinput> 
  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 <command>kgdb</command>
+      the appropriate object files and repeat the <command>gdb <option>-k</option></command>
       session until you know enough.</para>
 
     <para>All this is not guaranteed to work, but it will do it fine in most
@@ -301,7 +298,7 @@
   <sect1>
     <title>On-Line Kernel Debugging Using DDB</title>
     
-    <para>While <command>kgdb</command> as an off-line debugger provides a very
+    <para>While <command>gdb <option>-k</option></command> 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.</para>
@@ -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 <command>kgdb</command>.</para>
+      debug information like <command>gdb</command>.</para>
 
     <para>To configure your kernel to include DDB, add the option line
       
@@ -467,7 +464,7 @@
     <screen><userinput>panic</userinput></screen>
 	  
     <para>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 <command>gdb</command>.  This command
       usually must be followed by another <command>continue</command>
       statement.</para>
     
@@ -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:</para>
+      kernel, and start <command>gdb</command>:</para>
 
     <screen>&prompt.user; <userinput>gdb -k kernel</userinput>
 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011020936.BAA50414>