gcc - gdb compatibility issue

sumanth sumanth.gundapneni@redpinesignals.com
Mon Apr 27 06:36:00 GMT 2009


hi,
 I tried compiling with '-g -O0' option, result is same.
 Since I am not using a well known architecture , i need to port gdb to 
my architecture.
 gcc --version gives gcc (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30).

 The problem here is ,it is generating local variables address but not 
in the current frame. But when I compile
 with '-g -O0 -fvar-tracking ' I got partial correct information .
 Let me explain with an example :
 int main()
{
volatile int a, b , c;
a =10;
b =20;
c =add(a,b);
return 0;
}

int add(int x, int y)
{
return x+y;
}

With '-g -O0' all the local variable's address i.e a,b,c generated is wrong.
with '-g -O0 -fvar-tracking ' a,b 's address is generated correct. c 
variable's address is wrong.
I am confident that there is no error from compiler side . So, I am 
asking for any compatibility issue regarding gcc-gdb versions.

sumanth


  
Paul Pluzhnikov wrote:
> On Sun, Apr 26, 2009 at 10:17 PM, sumanth
> <sumanth.gundapneni@redpinesignals.com> wrote:
>
>   
>> I am using gcc-4.3.3 and gdb 5.3 version.
>>     
>
> That's a rather new GCC and rather old GDB.
>
>   
>> I have problems in  debugging my  binaries (a.out)  concerned to local
>> variable's address location.
>>     
>
> What kind of problems?
> Did you compile with -O, -O2, or -O3?
> Debugging optimized code is always problematic: the compiler may not
> have assigned address for a local variable at all.
>
>   
>> Is there any gcc-gdb compatibility issue here. If so how can I generate the
>> correct debugging information and use it.
>>     
>
> Start by compiling with '-g -O0'.
> If that doesn't work, try current GDB built from CVS Head.
> If that still doesn't work, show us your compile line, and output from
> 'gcc --version'.
>
> Cheers,
>   




More information about the Gdb mailing list