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
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
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
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.
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')
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.