Re: Error referencing symbols in gdb when compiled with gcc 3.4.6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

So sorry about the multiple post. I'll do future posts on gcc-help..

Here I am using the same debugger when I try to view a symbol in gdb. The only thing that's changed is the version of gcc. I used gcc 3.2.2 earlier where things worked fine. But with gcc 3.4.6, I am unable to find symbols. I've had previous mysterious issues too when I compiled the very same code in with gcc 3.4.6 where I had to explicitly typecast a symbol to a class or struct. I didn't have to do all this earlier with gcc 3.2.2. I am concerned that I am probably building the executable with the wrong options. Here's how the code is being compiled with the following
options :

gcc -ansi -g -O -march=pentiumpro -fmessage-length=0 -isystem -DNEWGCC -DGCC34

readelf -aw does not show me the problematic symbol when compiled with gcc 3.2.2. But it is seen when referenced in gdb. But when compiled with gcc 3.4.6, it is neither seen in readelf nor in gdb. That's what bothers me - why is this difference when compiled with gcc 3.4.6.

Also, another of my investigations shows that if the .o file containing this symbol is placed at the top of list of files to be linked (first file to be linked) - the problem goes away. I am able to see that
symbol in gdb now.

So is this a problem with the linker ?

Why is this problem occuring when compiled with gcc 3.4.6 and not with the earlier compilers ?

Regards,
Kalpana
====

From: Michael Eager <eager@xxxxxxxxxxxx>
To: Kalpana Ramamurthy <kal_pana@xxxxxxxxxxx>
CC: gcc-help@xxxxxxxxxxx,  gcc@xxxxxxx
Subject: Re: Error referencing symbols in gdb when compiled with gcc 3.4.6
Date: Wed, 18 Jul 2007 10:16:05 -0700

Kalpana Ramamurthy wrote:
Hello,

I am having a problem when using gcc 3.4.6. My code was compiled earlier using gcc 3.2.2 with the -g option. I was able to print the addess of any symbol or do a "ptype" on any symbol using gdb 6.4 with the generated
binary.

Now I compile the very same code using gcc 3.4.6 using the -g option again. Here, I get an error saying
"There is no field/member named <symbol name>".
This very symbol was found when the code was compiled using gcc 3.2.2.

First, please don't cross-post to both gcc and gcc-help mailing lists.
This belongs on gcc-help; future replies should only go to gcc-help.

You can see if there is debugging information in the object file
file by running "readelf -aw" and searching for the name.  You may
want to check both the object file and the executable.  If the symbol
appears to be defined correctly, then the problem may be in gdb.

--
Michael Eager	 eager@xxxxxxxxxxxx
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

_________________________________________________________________
Real Estate classifieds on MSN - for free.www.yello.in http://www.yello.in/home.php?utm_source=hotmailtag&utm_medium=email&utm_content=in&utm_campaign=jun


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux