Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jun 2003 23:00:50 -0700
From:      David Schultz <das@FreeBSD.ORG>
To:        Greg Lehey <grog@FreeBSD.ORG>
Cc:        cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/debugscripts gdbinit.i386 gdbinit.kernel gdbinit.vinum
Message-ID:  <20030607060050.GB60955@HAL9000.homeunix.com>
In-Reply-To: <200306060642.h566g2Hn097640@repoman.freebsd.org>
References:  <200306060642.h566g2Hn097640@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 05, 2003, Greg Lehey wrote:
> grog        2003/06/05 23:42:01 PDT
> 
>   FreeBSD src repository
> 
>   Added files:
>     sys/debugscripts     gdbinit.i386 gdbinit.kernel gdbinit.vinum 
>   Log:
>   Add macros for kernel debugging.  These have been around for a
>   while, and they will need some more tuning before they're really
>   useful, but at the moment they're better than nothing.

Cool, these look useful.  I just started writing some macros for
poking around mounts and vnodes the other day, although I haven't
yet come up with a particularly good way of printing vnodes.
If someone has something better, I'd love to see it.


define _getmnt
	set $_mp = mountlist->tqh_first
	set $_i = $arg0
	while $_i != 0 && $_mp != 0
		set $_mp = $_mp->mnt_list->tqe_next
		set $_i -= 1
	end
	if $_mp == 0
		printf "Error: end of mount list\n"
	end
end

define _vnprint
	print $arg0
end

define mntstat
	_getmnt $arg0
	printf "%s filesystem %s mounted on %s\n", \
		$_mp->mnt_stat->f_fstypename, \
		$_mp->mnt_stat->f_mntonname, \
		$_mp->mnt_stat->f_mntfromname
	printf "frag size: %12ld\tblock size: %11ld\n", \
		$_mp->mnt_stat->f_bsize, $_mp->mnt_stat->f_iosize
	printf "blocks: %15ld\tblocks free: %10ld\n", \
		$_mp->mnt_stat->f_blocks, $_mp->mnt_stat->f_bfree
	printf "inodes: %15ld\tinodes free: %10ld\n", \
		$_mp->mnt_stat->f_files, $_mp->mnt_stat->f_ffree
	printf "flags:       0x%08x\towner: %16d\n", \
		$_mp->mnt_stat->f_flags, $_mp->mnt_stat->f_owner
	printf "sync writes: %10d\tasync writes:%10d\n", \
		$_mp->mnt_stat->f_syncwrites, $_mp->mnt_stat->f_asyncwrites
	printf "sync reads:  %10d\tasync reads: %10d\n", \
		$_mp->mnt_stat->f_syncreads, $_mp->mnt_stat->f_asyncreads
	
end
document mntstat
	Usage: mntstat index
	Print information about the indexth filesystem on the mount list.
end

define vnodes
	_getmnt $arg0
	set $_vn = $_mp->mnt_nvnodelist.tqh_first
	set $_i = 0
	printf "Counting vnodes; this could take a few minutes...\n"
	while $_vn != 0
		set $_i += 1
		set $_vn = $_vn->v_nmntvnodes.tqe_next
	end
	printf "\n%i vnodes:\n_________________________________\n", $_i
	set $_vn = $_mp->mnt_nvnodelist.tqh_first
	while $_vn != 0
		_vnprint $_vn
		set $_vn = $_vn->v_nmntvnodes.tqe_next
	end
end
document vnodes
	Usage: vnodes index
	Print information about vnodes belonging to the indexth filesystem.
end



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030607060050.GB60955>