kernhist revision 1.2.18.2 1 # $NetBSD: kernhist,v 1.2.18.2 2017/12/03 11:38:44 jdolecek Exp $
2
3 # by mrg and skrll
4
5 define kernhist
6 dont-repeat
7
8 set $hist = (struct kern_history *)&$arg0
9 set $histf = $hist->f
10 set $histn = $hist->n
11 set $lcv = $histf
12
13 printf "Kernel history %s has %d entries (next free %d)\n", $hist->name, $histn, $histf
14 while (1)
15 set $e = $hist->e[$lcv]
16 set $fmt = $e.fmt
17
18 if ($fmt)
19 printf "%06lx.%06d ", $e.tv.tv_sec, $e.tv.tv_usec
20 printf "%s#%ld@%d: ", $e.fn, $e.call, $e.cpunum
21 printf "%s: %lx %lx %lx %lx\n", $fmt, $e.v[0], $e.v[1], $e.v[2], $e.v[3]
22 set $lcv = ($lcv + 1) % $histn
23 else
24 if ($histf == 0)
25 printf "No entries\n"
26 loop_break
27 end
28 # if fmt is NULL and hist->f isn't zero, skip back to
29 # the start of the list since it hasn't looped yet.
30 set $lcv = 0
31 end
32
33 if ($lcv == $histf)
34 loop_break
35 end
36 end
37 end
38 document kernhist
39 dump a kernel hist. eg, "kernhist usbhist". note that the format
40 is not expanded due to there being now way to pass a variable format
41 string to gdb's printf.
42 end
43