freebsd-dev/gnu/usr.bin/binutils/gdb/fbsd-kgdb.h
Ian Dowse ea0d04f36e Attempt to automatically read in kernel module symbols when a live
or dead kernel core is loaded into gdb. This extends gdb's existing
shared library support, so the "info sharedlibrary", "sharedlibrary"
and "nosharedlibrary" commands can be used to view and change the
list of loaded symbol files.

The current implementation is more than a kludge however, and it
will not always manage to find the .ko.debug file corresponding to
the loaded module. In particular, for modules whose build directory
cannot be easily guessed from the module name such as all the
netgraph modules, the debug version of the .ko will not be found
automatically.

The logic for finding the module file first attempts to guess at
the module build directory by parsing the version[] string. Then
using that directory ($DIR), it tries the following paths in turn:

	./<module>.ko.debug		./<module>.ko
	$DIR/<module>.ko.debug		$DIR/<module>.ko
	/boot/kernel/<module>.ko.debug	/boot/kernel/<module>.ko

Approved by:	obrien, mp
2003-03-21 00:30:53 +00:00

35 lines
1.0 KiB
C

/* Native-kernel debugging definitions for FreeBSD.
* $FreeBSD$
*/
#ifndef FBSD_KGDB_H
#define FBSD_KGDB_H
extern int kernel_debugging;
extern int kernel_writablecore;
extern struct target_so_ops kgdb_so_ops;
#define ADDITIONAL_OPTIONS \
{"kernel", no_argument, &kernel_debugging, 1}, \
{"k", no_argument, &kernel_debugging, 1}, \
{"wcore", no_argument, &kernel_writablecore, 1}, \
{"w", no_argument, &kernel_writablecore, 1},
#define ADDITIONAL_OPTION_HELP \
"\
--kernel Enable kernel debugging.\n\
--wcore Make core file writable (only works for /dev/mem).\n\
This option only works while debugging a kernel !!\n\
"
#define DEFAULT_PROMPT kernel_debugging?"(kgdb) ":"(gdb) "
/* misuse START_PROGRESS to test whether we're running as kgdb */
/* START_PROGRESS is called at the top of main */
#undef START_PROGRESS
#define START_PROGRESS(STR,N) \
if (!strcmp (STR, "kgdb")) \
kernel_debugging = 1;
#endif /* FBSD_KGDB_H */