Bug 110146 - [patch] [request] Allow arbitrary gdb(1) options to bypass kgdb
Summary: [patch] [request] Allow arbitrary gdb(1) options to bypass kgdb
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2007-03-09 22:30 UTC by Mikhail T.
Modified: 2018-09-17 06:28 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail T. 2007-03-09 22:30:05 UTC
	Currently, no gdb options can be given to kgdb -- except the
	specially-handled -q and -f.

	This is unfortunate -- in particular, the `-x script' option is
	missing, but possibly others.

	The patch below modifies kgdb to:

	. allow anything after the kernel/core to be sent to gdb_main;
	. eats all options recognized by kgdb itself;
	. removes some redundant strdups
	. re-arrange the command-line loop handling a bit to avoid our
	  own wrapper.

	The following command now becomes possible, for example:

		kgdb -v -c /home/mi/crash/vmcore.1 kernel.debug -x script.txt

	The command-line handling could be improved further to allow
	mixing of gdb and kgdb options (except where they overlap),
	but that is, probably, not needed.

	The common usage (as specified in Handbook) shows kernel.debug
	and vmcore explicitly...


The up-to-date patch can be found at

Comment 1 Joerg Wunsch freebsd_committer 2011-05-25 07:41:03 UTC
Responsible Changed
From-To: freebsd-bugs->joerg

I think I'll be able to handle that, I'm currently trying to improve 
KGDB's behaviour when running from within Emacs.  Alas, the old patch 
no longer applies cleanly.  Are you willing to provide an updated 
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:43:20 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
- Untouched since 2018-01-01.
- Affects Base System OR Documentation


Reset to open status.

I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 3 John Baldwin freebsd_committer freebsd_triage 2018-09-09 05:09:39 UTC
Note that for kgdb in ports, you can just use 'gdb' from ports directly (unlike the old gdb in base where only kgdb understands kernels).  In newer gdb, you can just use 'target vmcore' to open a crash dump (or /dev/mem) which means you can use existing GDB support in Emacs or other editors, or use any command line options supported by gdb.  I think just using gdb directly is probably the best path forward vs trying to make kgdb support all of gdb's options.  In particular, kgdb has different semantics for -r than gdb IIRC.  (If you look at the source of kgdb in ports, it effectively just constructs a set of args to pass to gdb using "-xie", etc. type options to change the prompt and invoke 'target vmcore')
Comment 4 Joerg Wunsch freebsd_committer 2018-09-17 06:28:39 UTC
I'd like to return that bug to anyone else who has time to handle it.

Based on jhb's comment, it can probably be closed.