summaryrefslogtreecommitdiff
path: root/sys/gdbscripts/vchain
blob: f3a6fdc7eadbd6350ea6736f187b3b559b67742b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#	$NetBSD: vchain,v 1.9 2017/04/13 09:52:18 hannken Exp $

#	@(#)vchain	8.1 (Berkeley) 6/10/93
#

define vchain
	set $num = 0

	set $vp=(struct vnode *)$arg0
	set $vi=(struct vnode_impl *)$arg0
	while ($vp)
		printf "vp: 0x%lx lrulist_next: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\
		       $vp, $vi->vi_lrulist.tqe_next, $vp->v_uobj.uo_refs, \
		       $vp->v_iflag, $vp->v_vflag, $vp->v_uflag
		set $num++
		set $vp = $vp->v_mntvnodes.tqe_next
	end
	printf "Number of vnodes: %d\n", $num
end

document vchain
Given a vnode, follow its mount pointers
end

define vprint
	set $vp=(struct vnode *)$arg0
	set $ip=(struct inode *)$vp->v_data
end

define mp_vchain
	set $mp = (struct mount *)$arg0
	vchain $mp->mnt_vnodelist.tqh_first
end
document mp_vchain
print the vnode chain for a given mount point
end

define vall
	set $mp=mountlist.tqh_first
	while ($mp)
		printf "\tmount point at 0x%x\n", $mp
		mp_vchain $mp
		set $mp=$mp->mnt_list.tqe_next

		# "break"
		if ((const void *)$mp == (const void *)&mountlist)
			set $mp = 0
		end
	end
end
document vall
print vnode chains for all mount points
end

define mountdump
	set $me=mount_list.tqh_first
	while ($me)
		if ($me->me_type == ME_MOUNT)
			set $mp = $me->me_mount
			printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
			    $mp->mnt_stat->f_mntfromname, \
			    $mp->mnt_stat->f_mntonname, \
			    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
		end
		set $me=$me->me_list.tqe_next
		if ((const void *)$me == (const void *)&mount_list)
			set $me = 0
		end
	end
end