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/13365] New: Missing DWARF line info for empty function


Current CVS gcc generates DWARF line number information that is incomplete, a regression
from earlier gcc versions, such as the native RedHat 9 gcc.

Environment:
System: Linux fred.ninemoons.com 2.4.20-20.9 #1 Mon Aug 18 11:27:43 EDT 2003 i686 athlon i386 GNU/Linux
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /src/sourceware/gcc/gcc/configure -v --prefix=/usr/local/sourceware --enable-languages=c,c++ : (reconfigured) /src/sourceware/gcc/gcc/configure -v --prefix=/usr/local/sourceware --enable-languages=c

How-To-Repeat:

I decided to investigate the following failure in the gdb testsuite
funcargs.exp test, that has led to what I believe is a gcc bug in the
DWARF debug information generated by the latest compiler (3.4
20031207):

  FAIL: gdb.base/funcargs.exp: continue to call6k

The problem can reproduced using:

  void foo ()
  {
  }

  void bar ()
  {
    static int dummy = 0;
  }

  main ()
  {
    foo ();
    bar ();
  }

If I debug the above program compiled with the 20031207 gcc, gdb
prints it's breakpoint stop message differently for foo than for bar:

  $ /usr/local/sourceware/bin/gcc -g -o x x.c
  $ gdb -q x
  (gdb) br foo
  Breakpoint 1 at 0x8048327: file x.c, line 2.
  (gdb) bar bar
  Undefined command: "bar".  Try "help".
  (gdb) br bar
  Breakpoint 2 at 0x804832c: file x.c, line 8.
  (gdb) run
  Starting program: /tmp/x 
  
  Breakpoint 1, 0x08048327 in foo () at x.c:2
  2       {
  (gdb) c
  Continuing.
  
  Breakpoint 2, bar () at x.c:8
  8       }

However debugging the program when compiled with the native RedHat 9 gcc
produces different, and correct, results:

  $ /usr/bin/gcc -g -o x x.c
  $ gdb -q x
  (gdb) br foo
  Breakpoint 1 at 0x80482f7: file x.c, line 3.
  (gdb) br bar
  Breakpoint 2 at 0x80482fc: file x.c, line 8.
  (gdb) run
  Starting program: /tmp/x 
  
  Breakpoint 1, foo () at x.c:3
  3       }
  (gdb) c
  Continuing.
  
  Breakpoint 2, bar () at x.c:8
  8       }
  (gdb) 

If you dump the debug line info for the 20031207 gcc compiled executable
using "readelf --debug-dump=line x" you get:

 Line Number Statements:
  Extended opcode 2: set Address to 0x8048324
  Special opcode 6: advance Address by 0 to 0x8048324 and Line by 1 to 2
  Special opcode 79: advance Address by 5 to 0x8048329 and Line by 4 to 6
  Special opcode 49: advance Address by 3 to 0x804832c and Line by 2 to 8
  Special opcode 36: advance Address by 2 to 0x804832e and Line by 3 to 11
  Advance PC by constant 17 to 0x804833f
  Special opcode 160: advance Address by 11 to 0x804834a and Line by 1 to 12
  Special opcode 76: advance Address by 5 to 0x804834f and Line by 1 to 13
  Special opcode 76: advance Address by 5 to 0x8048354 and Line by 1 to 14
  Advance PC by 2 to 8048356
  Extended opcode 1: End of Sequence

Dumping the debug line info for the native RedHat 9 gcc compiled executable
produces:

 Line Number Statements:
  Extended opcode 2: set Address to 0x80482f4
  Special opcode 6: advance Address by 0 to 0x80482f4 and Line by 1 to 2
  Special opcode 48: advance Address by 3 to 0x80482f7 and Line by 1 to 3  <=== NOTE
  Special opcode 36: advance Address by 2 to 0x80482f9 and Line by 3 to 6
  Special opcode 49: advance Address by 3 to 0x80482fc and Line by 2 to 8
  Special opcode 36: advance Address by 2 to 0x80482fe and Line by 3 to 11
  Special opcode 230: advance Address by 16 to 0x804830e and Line by 1 to 12
  Special opcode 76: advance Address by 5 to 0x8048313 and Line by 1 to 13
  Special opcode 76: advance Address by 5 to 0x8048318 and Line by 1 to 14
  Advance PC by 2 to 804831a
  Extended opcode 1: End of Sequence

Note that the 20031207 compiled debug info is missing the line number
info corresponding to "advance Address by 3 to 0x80482f7 and Line by 1
to 3" that is in the RedHat 9 executable.

For more in depth discussion of the gdb issues see the thread at:

  http://sources.redhat.com/ml/gdb-patches/2003-12/msg00253.html

-Fred

-- 
           Summary: Missing DWARF line info for empty function
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fnf at ninemoons dot com
                CC: gcc-bugs at gcc dot gnu dot org
 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=13365


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