Date: Wed, 3 Jan 2001 12:11:15 +1030 From: Greg Lehey <grog@lemis.com> To: Doug White <dwhite@resnet.uoregon.edu> Cc: Zhiui Zhang <zzhang@cs.binghamton.edu>, freebsd-hackers@FreeBSD.ORG Subject: Re: kernel debugging suggestion needed Message-ID: <20010103121115.D15003@wantadilla.lemis.com> In-Reply-To: <Pine.BSF.4.21.0101021402410.38463-100000@resnet.uoregon.edu>; from dwhite@resnet.uoregon.edu on Tue, Jan 02, 2001 at 02:03:16PM -0800 References: <Pine.SOL.4.21.0101021251070.3528-100000@opal> <Pine.BSF.4.21.0101021402410.38463-100000@resnet.uoregon.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, 2 January 2001 at 14:03:16 -0800, Doug White wrote: > On Tue, 2 Jan 2001, Zhiui Zhang wrote: > >> >> I have written a KLD and am debugging it. The program often hangs after >> runs for a while (I guess it enters into some dead loop). Is there a way >> to attach to the process and somehow find out which code it is executing >> (with remote debugging or ddb)? > > kld debugging is a bit tricky. Take a look at the debugging macros and > bits that Greg Lehey put together for vinum for a starting point. You have > to calculate the appropriate offset to get to the KLD code in gdb. Doug Rabson has described an alternative to me, but I never got it to work. My hack walks down the list of klds looking for a name starting with 'v'; you can change this to something which identifies your kld, and you'll need to change the name of the kld itself, of course. I also have a number of other macros in files in /usr/src/sys/modules/vinum. Here's the macro: define asf set $file = linker_files.tqh_first set $found = 0 while ($found == 0) if (*$file->filename == 'v') set $found = 1 else set $file = $file->link.tqe_next end end shell /usr/bin/objdump --section-headers sys/modules/vinum/vinum.ko | grep ' .text' | awk '{print "add-symbol-file sys/modules/vinum/vinum.ko \$file->address+0x" $4}' > .asf source .asf end Greg -- Finger grog@lemis.com for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010103121115.D15003>