xref: /netbsd-src/sys/gdbscripts/vchain (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1#	$NetBSD: vchain,v 1.5 2006/11/04 20:33:17 pooka Exp $
2
3#	@(#)vchain	8.1 (Berkeley) 6/10/93
4#
5# Given a vnode, follow its mount pointers
6define vchain
7	set $num = 0
8
9	set $vp=(struct vnode *)$arg0
10	while ($vp)
11		printf "vp: 0x%x freelist_next: 0x%x usecount: %d flags: 0x%x\n", $vp, $vp->v_freelist.tqe_next, $vp->v_uobj.uo_refs, $vp->v_flag
12		set $num++
13		set $vp = $vp->v_mntvnodes.tqe_next
14	end
15	printf "Number of vnodes: %d\n", $num
16end
17
18define vprint
19	set $vp=(struct vnode *)$arg0
20	set $ip=(struct inode *)$vp->v_data
21end
22
23# print the vnode chain for a given mount point
24define mp_vchain
25	set $mp = (struct mount *)$arg0
26	vchain $mp->mnt_vnodelist.tqh_first
27end
28
29# print vnode chains for all mount points
30define vall
31	set $mp=mountlist.cqh_first
32	while ($mp)
33		printf "\tmount point at 0x%x\n", $mp
34		mp_vchain $mp
35		set $mp=$mp->mnt_list.cqe_next
36
37		# "break"
38		if ((const void *)$mp == (const void *)&mountlist)
39			set $mp = 0
40		end
41	end
42end
43
44define mountdump
45	set $mp=mountlist.cqh_first
46	while ($mp)
47		printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
48		    $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \
49		    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
50		set $mp=$mp->mnt_list.cqe_next
51		if ((const void *)$mp == (const void *)&mountlist)
52			set $mp = 0
53		end
54	end
55