Date: 10 Sep 2001 20:32:42 +0200 From: Dag-Erling Smorgrav <des@ofug.org> To: Julian Elischer <julian@elischer.org> Cc: Marcel Moolenaar <marcel@xcllnt.net>, John Baldwin <jhb@FreeBSD.ORG>, current@FreeBSD.ORG Subject: Re: Linuxulator: possible Giant pushdown victim Message-ID: <xzpg09uj3qt.fsf@flood.ping.uio.no> In-Reply-To: <3B987CBA.97FC1A94@elischer.org> References: <20010905172451.A526@dhcp01.pn.xcllnt.net> <XFMail.010906115519.jhb@FreeBSD.org> <20010907003859.A446@dhcp01.pn.xcllnt.net> <3B987CBA.97FC1A94@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer <julian@elischer.org> writes:
> Marcel Moolenaar wrote:
> > BTW: Do we have handy functions for use in the remote debugger, such
> > as show_proc, show_vm or whatever, that dump important information
> > in a readable form?
> Matt has a cool set of macros as does Grog.
I have a couple of macros I've used for debugging KLDs, which may
serve as templates or inspiration for someone to write e.g. a "ps"
macro (it shouldn't be too different from the "kldstat" macro, just
walk the process table and print formatted info for every process)
define kldstat
set $kld = linker_files.tqh_first
printf "Id Refs Address Size Name\n"
while ($kld != 0)
printf "%2d %4d 0x%08x %-8x %s\n", \
$kld->id, $kld->refs, $kld->address, $kld->size, $kld->filename
set $kld = $kld->link.tqe_next
end
end
document kldstat
Lists the modules that were loaded when the kernel crashed.
end
define kldstat-v
set $kld = linker_files.tqh_first
printf "Id Refs Address Size Name\n"
while ($kld != 0)
printf "%2d %4d 0x%08x %-8x %s\n", \
$kld->id, $kld->refs, $kld->address, $kld->size, $kld->filename
printf " Contains modules:\n"
printf " Id Name\n"
set $module = $kld->modules.tqh_first
while ($module != 0)
printf " %2d %s\n", $module->id, $module->name
set $module = $module->link.tqe_next
end
set $kld = $kld->link.tqe_next
end
end
document kldstat-v
Lists modules with full information.
end
define kldload
set $kld = linker_files.tqh_first
set $done = 0
while ($kld != 0 && $done == 0)
if ($kld->filename == $arg0)
set $done = 1
else
set $kld = $kld->link.tqe_next
end
end
if ($done == 1)
shell /usr/bin/objdump -h $arg0 | \
awk '/ .text/ { print "set \$offset = 0x" $6 }' > .kgdb.temp
source .kgdb.temp
add-symbol-file $arg0 $kld->address + $offset
end
end
document kldload
Loads a module. Arguments are module name and offset of text section.
end
DES
--
Dag-Erling Smorgrav - des@ofug.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpg09uj3qt.fsf>
