diff options
| author | mrg <mrg@NetBSD.org> | 2016-05-11 09:22:55 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2016-05-11 09:22:55 +0000 |
| commit | 95fff57ddf6ea7596364be8b65ea8f07c0baf54e (patch) | |
| tree | 10648b8a03b3fd034455d040a884740ed2cbd90f /sys/gdbscripts | |
| parent | e9b0860a9004acc7eea22610921e41904e4b24be (diff) | |
add a gdb script to dump kernel histories. based upon a script by skrll,
updated by myself to run faster and more stupidly (but more workingly.)
normal gdb scripts don't seem to be able to call printf with the format
string as a variable, so we simply print the format itself as a string
and the (upto 4) arguments as unsigned long (how they're strored.)
Diffstat (limited to 'sys/gdbscripts')
| -rw-r--r-- | sys/gdbscripts/kernhist | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/gdbscripts/kernhist b/sys/gdbscripts/kernhist new file mode 100644 index 00000000000..283d8420492 --- /dev/null +++ b/sys/gdbscripts/kernhist @@ -0,0 +1,42 @@ +# $NetBSD: kernhist,v 1.1 2016/05/11 09:22:55 mrg Exp $ + +# by mrg and skrll + +define kernhist + dont-repeat + + set $hist = (struct kern_history *)&$arg0 + set $histf = $hist->f + set $histn = $hist->n + set $lcv = $histf + + printf "Kernel history %s has %d entries (next free %d)\n", $hist->name, $histn, $histf + while (1) + set $e = &$hist->e[$lcv] + set $fmt = $e->fmt + + if ($fmt) + printf "%06lx.%06d ", $e->tv.tv_sec, $e->tv.tv_usec + printf "%s#%ld@%d: ", $e->fn, $e->call, $e->cpunum + printf "%s: %lx %lx %lx %lx\n", $fmt, $e->v[0], $e->v[1], $e->v[2], $e->v[3] + set $lcv = ($lcv + 1) % $histn + else + if ($histf == 0) + printf "No entries\n" + loop_break + end + # if fmt is NULL and hist->f isn't zero, skip back to + # the start of the list since it hasn't looped yet. + set $lcv = 0 + end + + if ($lcv == $histf) + loop_break + end + end +end +document kernhist +dump a kernel hist. eg, "kernhist usbhist". note that the format +is not expanded due to there being now way to pass a variable format +string to gdb's printf. +end |
