xref: /freebsd/tools/debugscripts/gdbinit.kernel (revision a783ff949cafa0efc59d68ca19224e62d73616b9)
1030b9a7cSGreg Lehey# $FreeBSD$
2030b9a7cSGreg Lehey# General kernel macros
3030b9a7cSGreg Lehey
4030b9a7cSGreg Lehey# Print the command name of the current process
5030b9a7cSGreg Leheydefine pname
6030b9a7cSGreg Leheyp (char *)curproc->p_comm
7030b9a7cSGreg Leheyend
8030b9a7cSGreg Leheydocument pname
9410b51e7SGreg LeheyPrint the command name of the current process.
10030b9a7cSGreg Leheyend
11030b9a7cSGreg Lehey
12030b9a7cSGreg Lehey# Show contents of bp supplied as first parameter:
13030b9a7cSGreg Lehey#
14030b9a7cSGreg Lehey# (gdb) bpp bp
15030b9a7cSGreg Leheydefine bpp
16030b9a7cSGreg Leheyset $bp = (struct buf *) $arg0
17030b9a7cSGreg Lehey    if $bp->b_io.bio_dev
18030b9a7cSGreg Lehey      printf "  Buffer at 0x%x: dev 0x%x  data 0x%x  bcount 0x%x  blkno 0x%x resid 0x%x\n", \
19030b9a7cSGreg Lehey        $bp, \
20030b9a7cSGreg Lehey        $bp->b_io.bio_dev->si_udev, \
21030b9a7cSGreg Lehey        $bp->b_io.bio_data, \
22030b9a7cSGreg Lehey        $bp->b_io.bio_bcount, \
23030b9a7cSGreg Lehey        $bp->b_io.bio_blkno, \
24030b9a7cSGreg Lehey        $bp->b_io.bio_resid
25030b9a7cSGreg Lehey    else
26030b9a7cSGreg Lehey      printf "  Buffer at 0x%x: dev (none) data 0x%x  bcount 0x%x  blkno 0x%x resid 0x%x\n", \
27030b9a7cSGreg Lehey        $bp, \
28030b9a7cSGreg Lehey        $bp->b_io.bio_data, \
29030b9a7cSGreg Lehey        $bp->b_io.bio_bcount, \
30030b9a7cSGreg Lehey        $bp->b_io.bio_blkno, \
31030b9a7cSGreg Lehey        $bp->b_io.bio_resid
32030b9a7cSGreg Lehey    end
33030b9a7cSGreg Lehey    printf "   flags 0x%x: ", $bp->b_flags
34030b9a7cSGreg Lehey      if $bp->b_flags & 0x10
35030b9a7cSGreg Lehey        printf "busy "
36030b9a7cSGreg Lehey      end
37030b9a7cSGreg Lehey      if $bp->b_flags & 0x40
38030b9a7cSGreg Lehey        printf "call "
39030b9a7cSGreg Lehey      end
40030b9a7cSGreg Lehey      if $bp->b_flags & 0x200
41030b9a7cSGreg Lehey        printf "done "
42030b9a7cSGreg Lehey      end
43030b9a7cSGreg Lehey      if $bp->b_flags & 0x800
44030b9a7cSGreg Lehey        printf "error "
45030b9a7cSGreg Lehey      end
46030b9a7cSGreg Lehey      if $bp->b_flags & 0x40000
47030b9a7cSGreg Lehey        printf "phys "
48030b9a7cSGreg Lehey      end
49030b9a7cSGreg Lehey      if $bp->b_flags & 0x100000
50030b9a7cSGreg Lehey        printf "read "
51030b9a7cSGreg Lehey      end
52030b9a7cSGreg Lehey    printf "\n"
53030b9a7cSGreg Leheyend
54030b9a7cSGreg Leheydocument bpp
55410b51e7SGreg LeheyShow summary information about the buffer header (struct bp) pointed at by the parameter.
56030b9a7cSGreg Leheyend
57030b9a7cSGreg Lehey
58030b9a7cSGreg Lehey# Show more detailed contents of bp supplied as first parameter:
59030b9a7cSGreg Lehey#
60030b9a7cSGreg Lehey# (gdb) bpl bp
61030b9a7cSGreg Leheydefine bpl
62030b9a7cSGreg Leheyset $bp = (struct buf *) $arg0
63030b9a7cSGreg Leheyprintf "b_proc: "
64030b9a7cSGreg Leheyoutput $bp->b_proc
65030b9a7cSGreg Leheyprintf "\nb_flags:      "
66030b9a7cSGreg Leheyoutput $bp->b_flags
67030b9a7cSGreg Leheyprintf "\nb_qindex:     "
68030b9a7cSGreg Leheyoutput $bp->b_qindex
69030b9a7cSGreg Leheyprintf "\nb_usecount:   "
70030b9a7cSGreg Leheyoutput $bp->b_usecount
71030b9a7cSGreg Leheyprintf "\nb_error:      "
72030b9a7cSGreg Leheyoutput $bp->b_error
73030b9a7cSGreg Leheyprintf "\nb_bufsize:    "
74030b9a7cSGreg Leheyoutput $bp->b_bufsize
75030b9a7cSGreg Leheyprintf "\nb_io.bio_bcount:     "
76030b9a7cSGreg Leheyoutput $bp->b_io.bio_bcount
77030b9a7cSGreg Leheyprintf "\nb_io.bio_resid:      "
78030b9a7cSGreg Leheyoutput $bp->b_io.bio_resid
79030b9a7cSGreg Leheyprintf "\nb_io.bio_dev:        "
80030b9a7cSGreg Leheyoutput $bp->b_io.bio_dev
81030b9a7cSGreg Leheyprintf "\nb_io.bio_data:       "
82030b9a7cSGreg Leheyoutput $bp->b_io.bio_data
83030b9a7cSGreg Leheyprintf "\nb_kvasize:    "
84030b9a7cSGreg Leheyoutput $bp->b_kvasize
85030b9a7cSGreg Leheyprintf "\nb_lblkno:     "
86030b9a7cSGreg Leheyoutput $bp->b_lblkno
87030b9a7cSGreg Leheyprintf "\nb_io.bio_blkno:      "
88030b9a7cSGreg Leheyoutput $bp->b_io.bio_blkno
89030b9a7cSGreg Leheyprintf "\nb_iodone:     "
90030b9a7cSGreg Leheyoutput $bp->b_iodone
91030b9a7cSGreg Leheyprintf "\nb_vp: "
92030b9a7cSGreg Leheyoutput $bp->b_vp
93030b9a7cSGreg Leheyprintf "\nb_dirtyoff:   "
94030b9a7cSGreg Leheyoutput $bp->b_dirtyoff
95030b9a7cSGreg Leheyprintf "\nb_dirtyend:   "
96030b9a7cSGreg Leheyoutput $bp->b_dirtyend
97030b9a7cSGreg Leheyprintf "\nb_generation: "
98030b9a7cSGreg Leheyoutput $bp->b_generation
99030b9a7cSGreg Leheyprintf "\nb_rcred:      "
100030b9a7cSGreg Leheyoutput $bp->b_rcred
101030b9a7cSGreg Leheyprintf "\nb_wcred:      "
102030b9a7cSGreg Leheyoutput $bp->b_wcred
103030b9a7cSGreg Leheyprintf "\nb_validoff:   "
104030b9a7cSGreg Leheyoutput $bp->b_validoff
105030b9a7cSGreg Leheyprintf "\nb_validend:   "
106030b9a7cSGreg Leheyoutput $bp->b_validend
107030b9a7cSGreg Leheyprintf "\nb_pblkno:     "
108030b9a7cSGreg Leheyoutput $bp->b_pblkno
109030b9a7cSGreg Leheyprintf "\nb_saveaddr:   "
110030b9a7cSGreg Leheyoutput $bp->b_saveaddr
111030b9a7cSGreg Leheyprintf "\nb_savekva:    "
112030b9a7cSGreg Leheyoutput $bp->b_savekva
113030b9a7cSGreg Leheyprintf "\nb_driver1:    "
114030b9a7cSGreg Leheyoutput $bp->b_driver1
115030b9a7cSGreg Leheyprintf "\nb_driver2:    "
116030b9a7cSGreg Leheyoutput $bp->b_driver2
117030b9a7cSGreg Leheyprintf "\nb_spc:        "
118030b9a7cSGreg Leheyoutput $bp->b_spc
119030b9a7cSGreg Leheyprintf "\nb_npages:     "
120030b9a7cSGreg Leheyoutput $bp->b_npages
121030b9a7cSGreg Leheyprintf "\n"
122030b9a7cSGreg Leheyend
123030b9a7cSGreg Leheydocument bpl
124410b51e7SGreg LeheyShow detailed information about the buffer header (struct bp) pointed at by the parameter.
125030b9a7cSGreg Leheyend
126030b9a7cSGreg Lehey
127030b9a7cSGreg Lehey# Show contents of buffer header in local variable bp.
128030b9a7cSGreg Leheydefine bp
129030b9a7cSGreg Leheybpp bp
130030b9a7cSGreg Leheyend
131030b9a7cSGreg Leheydocument bp
132410b51e7SGreg LeheyShow information about the buffer header pointed to by the variable bp in the current frame.
133030b9a7cSGreg Leheyend
134030b9a7cSGreg Lehey
135030b9a7cSGreg Lehey# Show data of buffer header in local variable bp as string.
136030b9a7cSGreg Leheydefine bpd
137030b9a7cSGreg Lehey    printf "Buffer data:\n%s", (char *) bp->b_io.bio_data
138030b9a7cSGreg Leheyend
139030b9a7cSGreg Leheydocument bpd
140030b9a7cSGreg LeheyShow the contents (char*) of bp->data in the current frame.
141030b9a7cSGreg Leheyend
142030b9a7cSGreg Leheydocument bpl
143410b51e7SGreg LeheyShow detailed information about the buffer header (struct bp) pointed at by the local variable bp.
144030b9a7cSGreg Leheyend
145030b9a7cSGreg Leheydefine bx
146030b9a7cSGreg Leheyprintf "\n b_vnbufs "
147030b9a7cSGreg Leheyoutput/x bp->b_vnbufs
148030b9a7cSGreg Leheyprintf "\n b_freelist "
149030b9a7cSGreg Leheyoutput/x bp->b_freelist
150030b9a7cSGreg Leheyprintf "\n b_act "
151030b9a7cSGreg Leheyoutput/x bp->b_act
152030b9a7cSGreg Leheyprintf "\n b_flags "
153030b9a7cSGreg Leheyoutput/x bp->b_flags
154030b9a7cSGreg Leheyprintf "\n b_qindex "
155030b9a7cSGreg Leheyoutput/x bp->b_qindex
156030b9a7cSGreg Leheyprintf "\n b_usecount "
157030b9a7cSGreg Leheyoutput/x bp->b_usecount
158030b9a7cSGreg Leheyprintf "\n b_error "
159030b9a7cSGreg Leheyoutput/x bp->b_error
160030b9a7cSGreg Leheyprintf "\n b_bufsize "
161030b9a7cSGreg Leheyoutput/x bp->b_bufsize
162030b9a7cSGreg Leheyprintf "\n b_io.bio_bcount "
163030b9a7cSGreg Leheyoutput/x bp->b_io.bio_bcount
164030b9a7cSGreg Leheyprintf "\n b_io.bio_resid "
165030b9a7cSGreg Leheyoutput/x bp->b_io.bio_resid
166030b9a7cSGreg Leheyprintf "\n b_io.bio_dev "
167030b9a7cSGreg Leheyoutput/x bp->b_io.bio_dev
168030b9a7cSGreg Leheyprintf "\n b_io.bio_data "
169030b9a7cSGreg Leheyoutput/x bp->b_io.bio_data
170030b9a7cSGreg Leheyprintf "\n b_kvasize "
171030b9a7cSGreg Leheyoutput/x bp->b_kvasize
172030b9a7cSGreg Leheyprintf "\n b_io.bio_blkno "
173030b9a7cSGreg Leheyoutput/x bp->b_io.bio_blkno
174030b9a7cSGreg Leheyprintf "\n b_iodone_chain "
175030b9a7cSGreg Leheyoutput/x bp->b_iodone_chain
176030b9a7cSGreg Leheyprintf "\n b_vp "
177030b9a7cSGreg Leheyoutput/x bp->b_vp
178030b9a7cSGreg Leheyprintf "\n b_dirtyoff "
179030b9a7cSGreg Leheyoutput/x bp->b_dirtyoff
180030b9a7cSGreg Leheyprintf "\n b_validoff "
181030b9a7cSGreg Leheyoutput/x bp->b_validoff
182030b9a7cSGreg Leheyecho \n
183030b9a7cSGreg Leheyend
184410b51e7SGreg Leheydocument bx
185410b51e7SGreg LeheyPrint a number of fields from the buffer header pointed at in by the pointer bp in the current environment.
186410b51e7SGreg Leheyend
187030b9a7cSGreg Lehey
188030b9a7cSGreg Lehey# Switch back to ddb
189030b9a7cSGreg Leheydefine ddb
190030b9a7cSGreg Leheyset boothowto=0x80000000
191030b9a7cSGreg Leheys
192030b9a7cSGreg Leheyend
193030b9a7cSGreg Leheydocument ddb
194030b9a7cSGreg LeheySwitch back to ddb.
195030b9a7cSGreg Leheyend
196030b9a7cSGreg Lehey
197030b9a7cSGreg Lehey# ps: equivalent of the userland command
198030b9a7cSGreg Leheydefine ps
199030b9a7cSGreg Lehey    set $nproc = nprocs
200030b9a7cSGreg Lehey    set $aproc = allproc.lh_first
201030b9a7cSGreg Lehey    set $proc = allproc.lh_first
202030b9a7cSGreg Lehey    printf "  pid    proc    addr   uid  ppid  pgrp   flag stat comm         wchan\n"
203030b9a7cSGreg Lehey    while (--$nproc >= 0)
204030b9a7cSGreg Lehey        set $pptr = $proc.p_pptr
205030b9a7cSGreg Lehey        if ($pptr == 0)
206030b9a7cSGreg Lehey           set $pptr = $proc
207030b9a7cSGreg Lehey        end
208030b9a7cSGreg Lehey        if ($proc.p_state)
209030b9a7cSGreg Lehey            set $thread = $proc->p_threads.tqh_first
210030b9a7cSGreg Lehey            while ($thread)
211030b9a7cSGreg Lehey                printf "%5d %08x %08x %4d %5d %5d  %06x  %d  %-10s   ", \
212030b9a7cSGreg Lehey                       $proc.p_pid, $aproc, \
213030b9a7cSGreg Lehey                       $proc.p_uarea, $proc.p_ucred->cr_ruid, $pptr->p_pid, \
214030b9a7cSGreg Lehey                       $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_state, \
215030b9a7cSGreg Lehey                       &$proc.p_comm[0]
216030b9a7cSGreg Lehey                if ($thread.td_wchan)
217030b9a7cSGreg Lehey                    if ($thread.td_wmesg)
218030b9a7cSGreg Lehey                        printf "%s ", $thread.td_wmesg
219030b9a7cSGreg Lehey                    end
220030b9a7cSGreg Lehey                    printf "%x", $thread.td_wchan
221030b9a7cSGreg Lehey                end
222030b9a7cSGreg Lehey                printf "\n"
223030b9a7cSGreg Lehey                set $thread = $thread->td_plist.tqe_next
224030b9a7cSGreg Lehey            end
225030b9a7cSGreg Lehey        end
226030b9a7cSGreg Lehey        set $aproc = $proc.p_list.le_next
227030b9a7cSGreg Lehey        if ($aproc == 0 && $nproc > 0)
228030b9a7cSGreg Lehey            set $aproc = zombproc
229030b9a7cSGreg Lehey        end
230030b9a7cSGreg Lehey        set $proc = $aproc
231030b9a7cSGreg Lehey    end
232030b9a7cSGreg Leheyend
233030b9a7cSGreg Leheydocument ps
234410b51e7SGreg LeheyShow process status without options.
235030b9a7cSGreg Leheyend
236030b9a7cSGreg Lehey
237030b9a7cSGreg Lehey# Specify a process for other commands to refer to.
238030b9a7cSGreg Lehey# Most are machine-dependent.
239030b9a7cSGreg Leheydefine defproc
240030b9a7cSGreg Lehey    set $nproc = nprocs
241030b9a7cSGreg Lehey    set $aproc = allproc.lh_first
242030b9a7cSGreg Lehey    set $proc = allproc.lh_first
243030b9a7cSGreg Lehey    while (--$nproc >= 0)
244030b9a7cSGreg Lehey        if ($proc->p_pid == $arg0)
245030b9a7cSGreg Lehey	   set $pptr = $proc.p_pptr
246030b9a7cSGreg Lehey           if ($pptr == 0)
247030b9a7cSGreg Lehey              set $pptr = $proc
248030b9a7cSGreg Lehey           end
249030b9a7cSGreg Lehey	   set $myvectorproc = $proc
25036572f48SGreg Lehey           if ($proc.p_state)
25136572f48SGreg Lehey               set $thread = $proc->p_threads.tqh_first
25236572f48SGreg Lehey               while ($thread)
253030b9a7cSGreg Lehey                   printf "%5d %08x %08x %4d %5d %5d  %06x  %d  %-10s   ", \
254030b9a7cSGreg Lehey                          $proc.p_pid, $aproc, \
25536572f48SGreg Lehey                          $proc.p_uarea, $proc.p_ucred->cr_ruid, $pptr->p_pid, \
25636572f48SGreg Lehey                          $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_state, \
257030b9a7cSGreg Lehey                          &$proc.p_comm[0]
25836572f48SGreg Lehey                   if ($thread.td_wchan)
25936572f48SGreg Lehey                       if ($thread.td_wmesg)
26036572f48SGreg Lehey                           printf "%s ", $thread.td_wmesg
261030b9a7cSGreg Lehey                       end
26236572f48SGreg Lehey                       printf "%x", $thread.td_wchan
263030b9a7cSGreg Lehey                   end
264030b9a7cSGreg Lehey                   printf "\n"
26536572f48SGreg Lehey                   set $thread = $thread->td_plist.tqe_next
26636572f48SGreg Lehey               end
267030b9a7cSGreg Lehey           end
268030b9a7cSGreg Lehey           btpp
269030b9a7cSGreg Lehey	   set $nproc = 0
270030b9a7cSGreg Lehey	else
271030b9a7cSGreg Lehey           set $proc = $proc.p_list.le_next
272030b9a7cSGreg Lehey        end
273030b9a7cSGreg Lehey   end
274030b9a7cSGreg Leheyend
275030b9a7cSGreg Leheydocument defproc
276030b9a7cSGreg LeheySpecify a process for btpp and fr commands.
277030b9a7cSGreg Leheyend
278030b9a7cSGreg Lehey
279030b9a7cSGreg Leheydefine vdev
280030b9a7cSGreg Leheyif (vp->v_type == VBLK)
281030b9a7cSGreg Lehey  p *vp->v_un.vu_spec.vu_specinfo
282030b9a7cSGreg Lehey  printf "numoutput: %d\n", vp->v_numoutput
283030b9a7cSGreg Leheyelse
284030b9a7cSGreg Lehey  echo "Not a block device"
285030b9a7cSGreg Leheyend
286030b9a7cSGreg Leheyend
287030b9a7cSGreg Leheydocument vdev
288030b9a7cSGreg LeheyShow some information of the vnode pointed to by the local variable vp.
289030b9a7cSGreg Leheyend
290030b9a7cSGreg Lehey
291030b9a7cSGreg Lehey# Kludge.  When changing macros, it's convenient to copy and paste
292030b9a7cSGreg Lehey# definitions from the editor into the debugger window.
293030b9a7cSGreg Lehey# Unfortunately, gdb insists on asking for confirmation after the
294030b9a7cSGreg Lehey# "define" line.  y enables you to insert the confirmation in the
295030b9a7cSGreg Lehey# definition without affecting the way the macro runs (much).
296030b9a7cSGreg Leheydefine y
297410b51e7SGreg Leheyecho Check your .gdbinit: it contains a y command\n
298410b51e7SGreg Leheyend
299410b51e7SGreg Lehey
300410b51e7SGreg Leheydocument y
301410b51e7SGreg LeheyKludge for writing macros   This is a no-op except for printing a message   See gdb(4) for more details.
302030b9a7cSGreg Leheyend
303030b9a7cSGreg Lehey
304a783ff94SGreg Lehey# dmesg: print msgbuf.  Can take forever.
305a783ff94SGreg Leheydefine dmesg
306030b9a7cSGreg Leheyprintf "%s", msgbufp->msg_ptr
307030b9a7cSGreg Leheyend
308a783ff94SGreg Leheydocument dmesg
309a783ff94SGreg LeheyPrint the system message buffer (dmesg) This can take a long time due to the time it takes to transmit the data across a serial line and even on a firewire connection the processing time slows it down
310030b9a7cSGreg Leheyend
311030b9a7cSGreg Lehey
312030b9a7cSGreg Lehey# checkmem: check unallocated memory for modifications
313030b9a7cSGreg Lehey# this assumes that DIAGNOSTIC is set, which causes
314030b9a7cSGreg Lehey# free memory to be set to 0xdeadc0de
315030b9a7cSGreg Lehey#
316030b9a7cSGreg Lehey# Use: checkmem offset length
317030b9a7cSGreg Leheydefine checkmem
318030b9a7cSGreg Leheyset $offset = $arg0
319030b9a7cSGreg Lehey# XXX sizeof int.   Needs changing for 64 bit machines.
320030b9a7cSGreg Lehey# subtract 1 because the last word is always different.
321030b9a7cSGreg Leheyset $length = $arg1 / 4 - 1
322030b9a7cSGreg Leheyset $word = 0
323030b9a7cSGreg Leheywhile ($word < $length)
324030b9a7cSGreg Lehey   if ((int *) $offset) [$word] != 0xdeadc0de
325030b9a7cSGreg Lehey      printf "invalid word 0x%x at 0x%x\n", ((int *) $offset) [$word], &((int *) $offset) [$word]
326030b9a7cSGreg Lehey   end
327030b9a7cSGreg Lehey   set $word = $word + 1
328030b9a7cSGreg Leheyend
329030b9a7cSGreg Leheyend
330410b51e7SGreg Lehey
331410b51e7SGreg Leheydocument checkmem
332410b51e7SGreg LeheyCheck unallocated memory for modifications  This assumes that DIAGNOSTIC is set which causes free memory to be set to 0xdeadc0de.
333410b51e7SGreg Leheyend
3341cff4d0cSGreg Lehey
3351cff4d0cSGreg Leheydefine kernel
3361cff4d0cSGreg Lehey  exec-file kernel.$arg0
3371cff4d0cSGreg Lehey  symbol-file symbols.$arg0
3381cff4d0cSGreg Lehey  core-file vmcore.$arg0
3391cff4d0cSGreg Leheyend
3401cff4d0cSGreg Lehey
3411cff4d0cSGreg Leheydefine kldstat
3421cff4d0cSGreg Lehey  set $kld = linker_files.tqh_first
3431cff4d0cSGreg Lehey  printf "Id Refs Address    Size     Name\n"
3441cff4d0cSGreg Lehey  while ($kld != 0)
3451cff4d0cSGreg Lehey    printf "%2d %4d 0x%08x %-8x %s\n", \
3461cff4d0cSGreg Lehey      $kld->id, $kld->refs, $kld->address, $kld->size, $kld->filename
3471cff4d0cSGreg Lehey    set $kld = $kld->link.tqe_next
3481cff4d0cSGreg Lehey  end
3491cff4d0cSGreg Leheyend
3501cff4d0cSGreg Lehey
3511cff4d0cSGreg Leheydocument kldstat
3521cff4d0cSGreg Lehey  Lists the modules that were loaded when the kernel crashed.
3531cff4d0cSGreg Leheyend
3541cff4d0cSGreg Lehey
3551cff4d0cSGreg Leheydefine kldstat-v
3561cff4d0cSGreg Lehey  set $kld = linker_files.tqh_first
3571cff4d0cSGreg Lehey  printf "Id Refs Address    Size     Name\n"
3581cff4d0cSGreg Lehey  while ($kld != 0)
3591cff4d0cSGreg Lehey    printf "%2d %4d 0x%08x %-8x %s\n", \
3601cff4d0cSGreg Lehey      $kld->id, $kld->refs, $kld->address, $kld->size, $kld->filename
3611cff4d0cSGreg Lehey    printf "        Contains modules:\n"
3621cff4d0cSGreg Lehey    printf "                Id Name\n"
3631cff4d0cSGreg Lehey    set $module = $kld->modules.tqh_first
3641cff4d0cSGreg Lehey    while ($module != 0)
3651cff4d0cSGreg Lehey      printf "                %2d %s\n", $module->id, $module->name
3661cff4d0cSGreg Lehey      set $module = $module->link.tqe_next
3671cff4d0cSGreg Lehey    end
3681cff4d0cSGreg Lehey    set $kld = $kld->link.tqe_next
3691cff4d0cSGreg Lehey  end
3701cff4d0cSGreg Leheyend
371