Re: How to tell whether .o was compiled with -g option

Henrik Carlqvist <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization SunSITE.dk - Supporting Open source
Message-ID <[email protected]>
[email protected] (Karl Berry) wrote:
> I'm sure this is not 100% accurate (in either direction), but it's one
> hint, anyway.

I was also going to give this answer, but did a quick test first:

$ gcc -g -c -o hello_debug.o hello.c
$ gcc -c -o hello_no_debug.o hello.c
$ ls -al *.o
-rw-r--r--    1 henca    users        9056 May 22 08:24 hello_debug.o
-rw-r--r--    1 henca    users         776 May 22 08:25 hello_no_debug.o 
$ file *.o
hello_debug.o:    ELF 32-bit LSB relocatable, Intel 80386, version 1
(SYSV), not stripped 
hello_no_debug.o: ELF 32-bit LSB relocatable, Intel 80386, version 1
(SYSV), not stripped 
$ strip *.o $ ls -al *.o
-rw-r--r--    1 henca    users         496 May 22 08:25 hello_debug.o
-rw-r--r--    1 henca    users         496 May 22 08:25 hello_no_debug.o 
$ file *.o
hello_debug.o:    ELF 32-bit LSB relocatable, Intel 80386, version 1
(SYSV), stripped 
hello_no_debug.o: ELF 32-bit LSB relocatable, Intel 80386, version 1
(SYSV), stripped

So, there is more than the debug information that gets stripped out from
an object file and being "not stripped" is no guarantee for containing
debug information.

Unfortunately I have no better answer.

regards Henrik
-- 
The address in the header is only to prevent spam. My real address is:
hc1(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.