aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/debugscripts/gdbinit.kernel57
1 files changed, 39 insertions, 18 deletions
diff --git a/tools/debugscripts/gdbinit.kernel b/tools/debugscripts/gdbinit.kernel
index 4b18219c1a26..89541ce317ee 100644
--- a/tools/debugscripts/gdbinit.kernel
+++ b/tools/debugscripts/gdbinit.kernel
@@ -301,24 +301,6 @@ document y
Kludge for writing macros This is a no-op except for printing a message See gdb(4) for more details.
end
-# kldstat(8) lookalike
-define kldstat
- set $file = linker_files.tqh_first
- printf "Id Refs Address Size Name\n"
- while ($file != 0)
- printf "%2d %4d 0x%8x %8x %s\n", \
- $file->id, \
- $file->refs, \
- $file->address, \
- $file->size, \
- $file->filename
- set $file = $file->link.tqe_next
- end
-end
-document kldstat
-Equivalent of the kldstat(8) command without options
-end
-
# msgbuf: print msgbuf. Can take forever.
define msgbuf
printf "%s", msgbufp->msg_ptr
@@ -349,3 +331,42 @@ end
document checkmem
Check unallocated memory for modifications This assumes that DIAGNOSTIC is set which causes free memory to be set to 0xdeadc0de.
end
+
+define kernel
+ exec-file kernel.$arg0
+ symbol-file symbols.$arg0
+ core-file vmcore.$arg0
+end
+
+define kldstat
+y
+ set $kld = linker_files.tqh_first
+ printf "Id Refs Address Size Name\n"
+ while ($kld != 0)
+ printf "%2d %4d 0x%08x %-8x %s\n", \
+ $kld->id, $kld->refs, $kld->address, $kld->size, $kld->filename
+ set $kld = $kld->link.tqe_next
+ end
+end
+
+document kldstat
+ Lists the modules that were loaded when the kernel crashed.
+end
+
+define kldstat-v
+y
+ set $kld = linker_files.tqh_first
+ printf "Id Refs Address Size Name\n"
+ while ($kld != 0)
+ printf "%2d %4d 0x%08x %-8x %s\n", \
+ $kld->id, $kld->refs, $kld->address, $kld->size, $kld->filename
+ printf " Contains modules:\n"
+ printf " Id Name\n"
+ set $module = $kld->modules.tqh_first
+ while ($module != 0)
+ printf " %2d %s\n", $module->id, $module->name
+ set $module = $module->link.tqe_next
+ end
+ set $kld = $kld->link.tqe_next
+ end
+end