[BACK]Return to vchain CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / gdbscripts

File: [cvs.NetBSD.org] / src / sys / gdbscripts / vchain (download)

Revision 1.9, Thu Apr 13 09:52:18 2017 UTC (3 years, 10 months ago) by hannken
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20191119, phil-wifi-20190609, pgoyette-localcount-20170426, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, netbsd-9-base, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, isaki-audio2-base, isaki-audio2, bouyer-socketcan-base1
Branch point for: phil-wifi
Changes since 1.8: +13 -9 lines

Change command mountdump to evaluate mountlist_entry.

#	$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