BUG: Re: gdb semi-broken in ydl4?

Joseph E. Sacco, Ph.D. joseph_sacco at comcast.net
Mon Dec 13 14:22:41 MST 2004


Albrecht,

Is it really a bug, or did the optimizer eliminate "r" completely? [I am
too lazy to dumb the assembler code :-)].

I have never had much success debugging optimized code for exactly this
reason.  The optimizer eliminates and moves things. 

Without "-O" gdb works as expected.


-Joseph

=======================================================================
On Mon, 2004-12-13 at 15:59, Albrecht Dreß wrote:
> Am 13.12.04 21:36 schrieb(en) Albrecht Dreß:
> > since my upgrade to ydl4, gdb seems to semi-broken. I set a breakpoint  
> > in a function and then try to display a local variable which spits out
> > 
> > (gdb) display body
> > 1: body = Variable "body" is not available.
> > Disabling display 1 to avoid infinite recursion.
> 
> To answer myself, here is a very simple test case. Try the attached c  
> code, and run it in gdb, like the following example:
> 
> <example>
> [albrecht at antares ~]$ gcc -Wall -Werror -g -O testprog.c -o testprog
> [albrecht at antares ~]$ gdb testprog
> GNU gdb Red Hat Linux (6.0post-0.20040223.19.ydl.1rh)
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you  
> are
> welcome to change it and/or distribute copies of it under certain  
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for  
> details.
> This GDB was configured as "ppc-yellowdog-linux-gnu"...Using host  
> libthread_db library "/lib/libthread_db.so.1".
> 
> (gdb) break 11
> Breakpoint 1 at 0x100004dc: file testprog.c, line 11.
> (gdb) run
> Starting program: /home/albrecht/Balsa/HEAD/testprog
> 
> Breakpoint 1, foo (p=0x10000914 "foo", q=0x10000918 "bar") at testprog. 
> c:11
> 11        strcpy(r, p);
> (gdb) display r
> 1: r = Variable "r" is not available.
> Disabling display 1 to avoid infinite recursion.
> </example>
> 
> gdb/gcc explicitly allow to use -g and -O together, so this is a bug.
> 
> Cheers, Albrecht.
-- 
Joseph E. Sacco, Ph.D. <joseph_sacco at comcast.net>



More information about the yellowdog-general mailing list