Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2001 23:44:13 -0500 (EST)
From:      Chuck Robey <chuckr@picnic.chuckr.org>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: ddb -> gdb help?
Message-ID:  <Pine.BSF.4.21.0103282335140.734-100000@picnic.chuckr.org>
In-Reply-To: <20010328191653.B9431@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Mar 2001, Alfred Perlstein wrote:

> I can't seem to get a crashdump, is there a way to take a 
> ddb crash address:  "Stopped at lf_setlock+0x52"
> and boot later and see what line of code that's on?

I do *lots* of debugging on very old 2.2.2 version stuff for my company,
and I have a method that works for me.  Don't know if it still works for
current, but you can find out.

I use cscope to find out what file the function in question is in, then I
go to the kernel build directory (and it must use exactly the same
sources, for reasons you'll find obvious) and rm the object file
involved.  Actually, before you do that, do another make, so that you can
be certain that the object file you rm is the *only* one that needs to be
rebuilt.

I have a hacked Makefile in there, so that I can set CC remotely, you may
have to hack the Makefile youself, because you need to change the
definition of CC or cflags in such a way that the option "-Wa,-a" gets
added; this causes the assembler listing file to come out to stdout.

do another make then, and catch the output, either in a file or via
less.  Find in the listing the starting address for the function.  Notice
that the C code is in that file also, making it easier to find what you're
after.  Also, in the second column from the left, is the binary offsets
into the file.

Locate the function you're after, and find out what it's binary offset
is.  Look at the error above, it says it ""Stopped at lf_setlock+0x52" so
after you find the offset of lf_setlock, add (using hex math) 0x52 to it,
and locate that offset in the assembler listing.  Look higher in the
listing for the immediately previous C source code line, you've got your
target line.

Tell me, does this still work in current now?

> 
> 
> 

----------------------------------------------------------------------------
Chuck Robey         | Interests include C & Java programming, FreeBSD,
chuckr@chuckr.org   | electronics, communications, and signal processing.

New Year's Resolution:  I will not sphroxify gullible people into looking up
fictitious words in the dictionary.
----------------------------------------------------------------------------


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?Pine.BSF.4.21.0103282335140.734-100000>