summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-01-18 18:27:21 +0000
committerjhb <jhb@FreeBSD.org>2016-01-18 18:27:21 +0000
commite6d9c6386f7459b113c9c9586b3364d2ffd472b3 (patch)
tree74ba68a5c50bce5ed0eb00cf26bc8f79f267249b /sys/kern/kern_linker.c
parent628004b7857599544a8b1f99cb2114e13254a693 (diff)
downloadFreeBSD-src-e6d9c6386f7459b113c9c9586b3364d2ffd472b3.zip
FreeBSD-src-e6d9c6386f7459b113c9c9586b3364d2ffd472b3.tar.gz
MFC 290728:
Export various helper variables describing the layout and size of certain kernel structures for use by debuggers. This mostly aids in examining cores from a kernel without debug symbols as a debugger can infer these values if debug symbols are available. One set of variables describes the layout of 'struct linker_file' to walk the list of loaded kernel modules. A second set of variables describes the layout of 'struct proc' and 'struct thread' to walk the list of processes in the kernel and the threads in each process. The 'pcb_size' variable is used to index into the stoppcbs[] array. The 'vm_maxuser_address' is used to distinguish kernel virtual addresses from user addresses. This doesn't have to be perfect, and 'vm_maxuser_address' is a cheap and simple way to differentiate kernel pointers from simple values like TIDs and PIDs. While here, annotate the fields in struct pcb used by kgdb on amd64 and i386 to note that their ABI should be preserved. Annotations for other platforms will be added in the future.
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index e379f5f..78eab87 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -71,6 +71,12 @@ SYSCTL_INT(_debug, OID_AUTO, kld_debug, CTLFLAG_RW | CTLFLAG_TUN,
TUNABLE_INT("debug.kld_debug", &kld_debug);
#endif
+/* These variables are used by kernel debuggers to enumerate loaded files. */
+const int kld_off_address = offsetof(struct linker_file, address);
+const int kld_off_filename = offsetof(struct linker_file, filename);
+const int kld_off_pathname = offsetof(struct linker_file, pathname);
+const int kld_off_next = offsetof(struct linker_file, link.tqe_next);
+
/*
* static char *linker_search_path(const char *name, struct mod_depend
* *verinfo);
OpenPOWER on IntegriCloud