This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/29614] New: DWARF information for function static variable is missing after unrelated code addition


A bunch of tests in the gdb testsuite dealing with static variables inside
function scopes have started failing recently with the latest development gcc. 
I simplified the test case down to a small program that shows that simply
adding a small bit of unrelated code causes the DWARF information to disappear.
 Here is a typescript:

Script started on Tue 24 Oct 2006 08:58:44 PM MST
$ cat b.c
int bar ()
{
  static int funclocal = 4;     /* In data section */
  return funclocal;
}

int foo ()
{
  static int funclocal = 3;     /* In Data section */
  return funclocal;
}

#ifdef EXPOSEBUG
void bell ()
{
  static int usedval;
}
#endif

main ()
{
  extern void exit (int);
  exit (bar() + foo());
}
$ gcc -g -o b b.c
$ readelf --debug-dump b | grep funclocal
     DW_AT_name        : (indirect string, offset: 0x0): funclocal
     DW_AT_name        : (indirect string, offset: 0x0): funclocal
     DW_AT_name        : (indirect string, offset: 0x0): funclocal
  0x00000000 66756e63 6c6f6361 6c00              funclocal.
$ gcc -DEXPOSEBUG -g -o b b.c
$ readelf --debug-dump b | grep funclocal
     DW_AT_name        : funclocal
$ gdb b
GNU gdb 6.5.50.20060923-cvs
Copyright (C) 2006 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 "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) br foo
Breakpoint 1 at 0x8048361: file b.c, line 10.
(gdb) br bar
Breakpoint 2 at 0x8048357: file b.c, line 4.
(gdb) run
Starting program:
/media/backups/new/build/specifix/experimental/i686-pc-linux-gnu/gdb/gdb/testsuite/b

Breakpoint 2, bar () at b.c:4
4         return funclocal;
(gdb) p funclocal
No symbol "funclocal" in current context.
(gdb) c
Continuing.

Breakpoint 1, foo () at b.c:10
10        return funclocal;
(gdb) p funclocal
$1 = 3
(gdb) quit
The program is running.  Exit anyway? (y or n) y
$ exit

Script done on Tue 24 Oct 2006 08:59:51 PM MST


-- 
           Summary: DWARF information for function static variable is
                    missing after unrelated code addition
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fnf at specifixinc dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29614


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]