Bug 226015 - [patch] outdated debug kernel location and kgdb binary location
Summary: [patch] outdated debug kernel location and kgdb binary location
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Documentation (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-doc (Nobody)
Keywords: patch
Depends on:
Reported: 2018-02-18 23:31 UTC by Phil Eaton
Modified: 2018-03-09 03:14 UTC (History)
1 user (show)

See Also:

diff of docs changes (1.52 KB, text/plain)
2018-02-18 23:31 UTC, Phil Eaton
no flags Details
updated kgdb docs diff referencing gdb port (1.53 KB, text/plain)
2018-02-19 02:10 UTC, Phil Eaton
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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 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 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 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 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 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

  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>

Comment 11 Phil Eaton 2018-03-09 03:12:27 UTC
Thank you!
Comment 12 Benjamin Kaduk freebsd_committer 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!