Bug 19648

Summary: handbook mentions stripping kernel.debug, but this is done for you
Product: Documentation Reporter: jblaine <jblaine>
Component: Books & ArticlesAssignee: ben <ben>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description jblaine 2000-07-02 19:20:00 UTC
In the section of the handbook regarding debugging kernel dumps,
the directions tell you to enable 'makeoptions DEBUG=-g' in your
/usr/src/sys/BLAH kernel config file, build the new kernel, and then
strip it.  When I built my kernel with -g, the kernel was stripped
as a final part of the make process.

Fix: 

Remove the following paragraph from the appropriate handbook section:

=======================================================================
When the kernel has been built make a copy of it, say kernel.debug, and then run strip -g on the original. Install the original as normal. You may
also install the unstripped kernel, but symbol table lookup time for some programs will drastically increase, and since the whole kernel is loaded
entirely at boot time and cannot be swapped out later, several megabytes of physical memory will be wasted.
=======================================================================

Additionally, change the following text to refer to 'kernel' and not
'kernel.debug':

======================================================================
Now, after a crash dump, go to /sys/compile/WHATEVER and run kgdb. From kgdb do:

    symbol-file kernel.debug
    exec-file /var/crash/kernel.0
    core-file /var/crash/vmcore.0
======================================================================
How-To-Repeat: Build a 4.0-RELEASE kernel with 'makeoptions DEBUG=-g' and examine
the final line of the build process.
Comment 1 jblaine 2000-07-06 14:59:53 UTC
The 2nd part of this reported doc error is not a doc error at all.
It's a manifestation of my FreeBSD ignorance.  The 1st part of this
bug is still valid I believe.

For reference the 2nd part I'm referring to is:

     Additionally, change the following text to refer to 'kernel'
     and not 'kernel.debug':

     ==============================================================
     Now, after a crash dump, go to /sys/compile/WHATEVER and run
     kgdb. From kgdb do:

         symbol-file kernel.debug
         exec-file /var/crash/kernel.0
         core-file /var/crash/vmcore.0
     ==============================================================
Comment 2 ben freebsd_committer freebsd_triage 2000-07-10 21:21:54 UTC
jblaine@mitre.org wrote:

> Remove the following paragraph from the appropriate handbook section:
>
> ======================================================================
> When the kernel has been built make a copy of it, say kernel.debug,
> and then run strip -g on the original. Install the original as
> normal. You may also install the unstripped kernel, but symbol table
> lookup time for some programs will drastically increase, and since the
> whole kernel is loaded entirely at boot time and cannot be swapped out
> later, several megabytes of physical memory will be wasted.
> ======================================================================


Then people with FreeBSD 3.x or earlier will lose that advice...  How
about something like this instead:

--- chapter.sgml        2000/06/14 00:47:36     1.24
+++ chapter.sgml        2000/07/10 20:19:07
@@ -48,7 +48,10 @@
        releases.</para>
     </note>
     
-    <para>When the kernel has been built make a copy of it, say
+    <para>If you are using any version of FreeBSD older than 4.0-RELEASE,
+      you should install a stripped copy of the kernel, rather than the
+      significantly larger debug copy.
+      When the kernel has been built, make a copy of it, say
       <filename>kernel.debug</filename>, and then run <command>strip
        -g</command> on the original.  Install the original as normal.  You
       may also install the unstripped kernel, but symbol table lookup time for

Is the bit about wasting space still even true?  I thought with ELF this
situation had improved a bit.  Anyone know?

-- 
Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D
Comment 3 ben freebsd_committer freebsd_triage 2000-07-10 21:38:28 UTC
Ben Smithurst wrote:

> -    <para>When the kernel has been built make a copy of it, say
> +    <para>If you are using any version of FreeBSD older than 4.0-RELEASE,
> +      you should install a stripped copy of the kernel, rather than the
> +      significantly larger debug copy.
> +      When the kernel has been built, make a copy of it, say


Grr.  That's not what I meant, you still use the stripped copy on 4.0,
you just don't strip it yourself.  Something like this would actually
make more sense:

--- chapter.sgml        2000/06/14 00:47:36     1.24
+++ chapter.sgml        2000/07/10 20:37:40
@@ -48,9 +48,12 @@
        releases.</para>
     </note>
     
-    <para>When the kernel has been built make a copy of it, say
+    <para>When the kernel has been built, make a copy of it, say
       <filename>kernel.debug</filename>, and then run <command>strip
-       -g</command> on the original.  Install the original as normal.  You
+       -g</command> on the original.  Install the original as normal.
+      Note that from FreeBSD 4.0-RELEASE onwards, these two steps are
+      performed automatically, so you should not execute them yourself.
+      On all FreeBSD releases, you
       may also install the unstripped kernel, but symbol table lookup time for
       some programs will drastically increase, and since the whole kernel is
       loaded entirely at boot time and cannot be swapped out later, several

-- 
Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D
Comment 4 ben freebsd_committer freebsd_triage 2000-07-13 20:48:48 UTC
Responsible Changed
From-To: freebsd-doc->ben

I'm working on this one.
Comment 5 ben freebsd_committer freebsd_triage 2000-07-14 22:56:52 UTC
State Changed
From-To: open->closed

Text updated, thanks!