2 # Command file for the GNU Debugger, for kernel debugging.
4 # This file can either be put in your home directory as ~/.gdbinit,
5 # or selected at run time as:
7 # 'gdb -k -q -x /usr/share/misc/gdbinit ...'
10 set history expansion on
13 printf "%10s\n",$arg0->td_comm
17 set $vfc = (struct vfsconf *)vfsconf_list.stqh_first
18 printf "\nFilesystem Refs Flags\n"
20 printf "%-10s %6d 0x%08x\n", $vfc->vfc_name, \
21 $vfc->vfc_refcount, $vfc->vfc_flags
22 set $vfc = $vfc->vfc_next.stqe_next
27 set $mnt = (mountlist->tqh_first)
30 set $mnt = $mnt->mnt_list->tqe_next
35 set $vfc = (struct vfsconf *)vfsconf_list.stqh_first
37 printf "Filesystem: %s, Refs: %d, Flags: 0x%08x\n", \
38 $vfc->vfc_name, $vfc->vfc_refcount, $vfc->vfc_flags
41 print *$vfc->vfc_vfsops
43 set $vfc = $vfc->vfc_next.stqe_next
49 set $kld = linker_files.tqh_first
50 printf "\nId Refs Address Size Name\n"
52 printf "%2d %4d 0x%08x %-8x %s\n", \
53 $kld->id, $kld->refs, $kld->address, $kld->size, $kld->filename
54 set $kld = $kld->link.tqe_next
60 printf "\ncpu pid thread flags comm wchan wmesg\n"
62 set $gd = &((struct privatespace *)&CPU_prvspace)[$cpu].mdglobaldata
63 set $td = $gd->mi.gd_tdallq.tqh_first
65 if ( $td->td_proc != 0 )
66 set $pid = $td->td_proc->p_pid
70 if ( $td->td_wmesg != 0 )
71 printf "%3d %5d %08x %08x %-18s %08x %s\n", \
72 $cpu, $pid, $td, $td->td_flags, $td->td_comm, $td->td_wchan, \
75 printf "%3d %5d %08x %08x %-18s %08x\n", \
76 $cpu, $pid, $td, $td->td_flags, $td->td_comm, $td->td_wchan
78 set $td = $td->td_allq.tqe_next
85 define running_threads
87 printf "\ncpu curthread wchan\n"
89 set $ipvspace = (struct privatespace *)&CPU_prvspace
90 set $gd = $ipvspace[$icpu].mdglobaldata.mi
91 set $td = $gd.gd_curthread
92 printf "%d %10s %08x\n", \
93 $gd.gd_cpuid, $td->td_comm, $td->td_wchan
99 set $proc = allproc->lh_first
101 printf "%p%6d%10s\n",$proc,$proc->p_pid,$proc->p_comm
102 set $proc = $proc->p_list.le_next
108 set $tokref = $token->t_ref
110 printf "%-15s %10d 0x%08x\n", $token->t_desc, \
111 $token->t_collisions, $tokref->tr_owner
113 printf "%-15s %10d not held\n", $token->t_desc, \
119 printf "\nToken collisions owner\n"
124 printf "\nToken collisions owner\n"
128 _infotok &vmspace_token
132 _infotok &vnode_token
133 _infotok &vmobj_token
138 printf "\nTokens for td %p (%s)\n", $mytd, $mytd->td_comm
139 printf "\nToken collisions owner\n"
141 while (td->td_toks_array[$pos]->tr_tok) != 0
142 _infotok &td->td_toks_array[$pos++]->tr_tok
147 set $bufp = msgbufp->msg_ptr
148 set $size = msgbufp->msg_size
149 set $rseq = msgbufp->msg_bufr % $size
150 set $wseq = msgbufp->msg_bufx % $size
151 if ( $bufp != 0 && $size != 0 && $rseq != $wseq )
152 while ( $rseq < $wseq )
153 set $c = $bufp + $rseq
155 set $rseq = $rseq + 1
156 if ( $rseq == msgbufp->msg_size )
167 # Documentation, usable within GDB using the 'help' command.
169 Output list of loaded file systems, refcount, similar to the
174 Iterate the current list of mount structures loaded from the
175 memory core, there should be one per loaded VFS.
179 Display the VFS operations vector for each file system found in
180 the memory core, preceded by a summarised header.
184 Output list of loaded kernel modules in kldstat(1) style.
188 Print command name of the given thread pointer (first argument).
192 Output a list of processes with wait-channel (wchan) information.
195 document running_threads
196 List the threads which are currently running and their CPU number.
200 Output a list of processes.
204 Display all known global tokens and some information about them.
208 Display all tokens related to the specified thread.
212 Takes one argument, a struct lwkt_token * (pointer) and prints some
213 information about that token.
217 Shows the unread portion of the kernel message buffer.