From 2f97cd97724122818c872cf2319d2f3295401de9 Mon Sep 17 00:00:00 2001 From: grog Date: Tue, 30 Dec 2003 01:23:16 +0000 Subject: Remove current implementation of kldstat macro. Add new kldstat, kldstat-v and kernel macros. The kldstat macro is functionally equivalent to the previous implementation, but it looks prettier and it matches the kldstat-v macro better. kldstat-v gives output similar to userland kldstat -v (note lacking space), and kernel loads a new kernel and dump. Submitted by: des --- tools/debugscripts/gdbinit.kernel | 57 ++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 18 deletions(-) (limited to 'tools/debugscripts') diff --git a/tools/debugscripts/gdbinit.kernel b/tools/debugscripts/gdbinit.kernel index 4b18219..89541ce 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 -- cgit v1.1