Bug 226015

Summary: [patch] outdated debug kernel location and kgdb binary location
Product: Documentation Reporter: Phil Eaton <philneaton95>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed FIXED    
Severity: Affects Many People CC: bjk
Priority: --- Keywords: patch
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
diff of docs changes
none
updated kgdb docs diff referencing gdb port none

Description Phil Eaton 2018-02-18 23:31:10 UTC
Created attachment 190766 [details]
diff of docs changes

The docs don't mention that kgdb is not installed in a directory in PATH so it took me a while to figure out what the docs were talking about. Eventually I ran `find / -name "*kgdb*` and discovered /lib/userexec/kgdb which is the only such binary installed on my system on 12-CURRENT. The location of the debug kernel was also incorrect in the docs and that took my a while to figure out. These two changes allowed me to finally debug my kernel panics on 12-CURRENT. If there are better solutions or changes  to be made, let me know. Thank you!
Comment 1 Benjamin Kaduk freebsd_committer freebsd_triage 2018-02-19 01:42:54 UTC
A different patch would be preferred, since the libexec version is not preferred for general use after (base) r317094 -- gdb -k from ports should be a superset of functionality.
Comment 2 Phil Eaton 2018-02-19 01:46:53 UTC
(In reply to Benjamin Kaduk from comment #1)
I saw mentioned a few times that the libexec was not intended to be used but it was the only kgdb that I could find. It was written a few times that kgdb was part of the base system and not part of the ports. I'd be happy to change it (and also happy to learn what to actually use), but this is the only way I was able to run gdb on a kernel core dump myself.
Comment 3 Benjamin Kaduk freebsd_committer freebsd_triage 2018-02-19 01:55:09 UTC
https://svnweb.freebsd.org/ports/head/devel/gdb/pkg-plist?revision=440447&view=markup seems to indicate that a recent gdb package/port will install a kgdb binary.  Is that not the case for you?
Comment 4 Phil Eaton 2018-02-19 02:00:08 UTC
(In reply to Benjamin Kaduk from comment #3)
I'll give that a shot. If this is the appropriate path, this patch should also encompass any reference to kgdb being a built-in utility and that to get core dump debugger functionality you must now install gdb from ports.
Comment 5 Benjamin Kaduk freebsd_committer freebsd_triage 2018-02-19 02:05:48 UTC
That sounds like the appropriate path, yes.  Thank you for offering to take on the work of fixing the documentation!
Comment 6 Phil Eaton 2018-02-19 02:10:04 UTC
You were right, it is installed with gdb. I also missed the deprecation notice in the kgdb man page that mentions this too: https://www.freebsd.org/cgi/man.cgi?query=kgdb. I'm attaching an updated diff. I can't seem to find any other references to it being part of the base system.
Comment 7 Phil Eaton 2018-02-19 02:10:31 UTC
Created attachment 190776 [details]
updated kgdb docs diff referencing gdb port
Comment 8 Phil Eaton 2018-03-08 20:11:54 UTC
Is there anything more I can do to get this good to go/merged?
Comment 9 Benjamin Kaduk freebsd_committer freebsd_triage 2018-03-09 01:58:31 UTC
(In reply to Phil Eaton from comment #8)

The reminder should be enough (I think I either didn't notice when the latest patch first came in or was too busy to do anything with it).

I'll tweak a couple things (like using markup for "<package>devel/gdb</package>" and mentioning both paths to the debug kernel binary in the object tree, since IIRC the old version is still in use on some supported releases, but once the build passes it should be good to go.
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-03-09 02:07:41 UTC
A commit references this bug:

Author: bjk
Date: Fri Mar  9 02:06:39 UTC 2018
New revision: 51474
URL: https://svnweb.freebsd.org/changeset/doc/51474

Log:
  Update kgdb instructions

  The port/package should be used now, and build system changes have
  moved the kernel images in the object tree to a new location (on
  newer systems)

  PR:		226015
  Submitted by:	Phil Eaton <philneaton95@gmail.com>

Changes:
  head/en_US.ISO8859-1/books/developers-handbook/kerneldebug/chapter.xml
Comment 11 Phil Eaton 2018-03-09 03:12:27 UTC
Thank you!
Comment 12 Benjamin Kaduk freebsd_committer freebsd_triage 2018-03-09 03:14:47 UTC
And the change is now live, so I'll close this.
And thank *you* for putting the patch together!