cvs commit: src/sys/debugscripts gdbinit.i386 gdbinit.kernel
gdbinit.vinum
David Schultz
das at FreeBSD.ORG
Fri Jun 6 23:00:58 PDT 2003
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
More information about the cvs-src
mailing list