indicating a debug image

Nate Eldredge neldredge at math.ucsd.edu
Fri Oct 17 00:23:48 UTC 2008


On Thu, 16 Oct 2008, Chuck Robey wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I was wondering, for FreeBSD images, is there a symbol that one could look for,
> to indicate if image had debug symbols?  I know you could destroy that by just
> stripping, I just wanted to know if there is any way to definitely tell, short
> of firing up gdb and looking for info.

There's really three possibilities:

1. Image has no symbols
2. Image has only non-debug symbols (e.g. global functions and variables)
3. Image has debug symbols (e.g. line numbers, local variables)

strip(1) or gcc -s produces #1.  gcc without -g produces #2.  gcc -g 
produces #3.

You can distinguish #1 because 'nm image' will give no output.  nm and 
objdump don't appear able to distinguish #2 and #3, but readelf -w will 
give a bunch of output for #3 and none for #2.

Does that help?

-- 

Nate Eldredge
neldredge at math.ucsd.edu


More information about the freebsd-hackers mailing list