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/60812] New: gcc -g -gpubnames statically linked produces a .debug_pubnames that is wrong or corrupted


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

            Bug ID: 60812
           Summary: gcc -g -gpubnames statically linked produces a
                    .debug_pubnames that is wrong or corrupted
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: geir at cray dot com

gcc -g -gpubnames statically linked produces a .debug_pubnames that is wrong or
corrupted:

$ gcc --version
gcc (GCC) 4.8.2 20131016 (Cray Inc.)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat getpid.c
#include <unistd.h>

int main() {
    return getpid();
}
$ gcc -c -g -gpubnames getpid.c
$ gcc -o getpid getpid.o -static
$ readelf -wp getpid
Contents of the .debug_pubnames section:

  Length:                              33
  Version:                             2
  Offset into .debug_info section:     0x77
  Size of area in .debug_info section: 139

    Offset      Name
    6f          _IO_stdin_used
  Length:                              7091
  Version:                             2
  Offset into .debug_info section:     0x102
  Size of area in .debug_info section: 145

    Offset      Name
    73          main
readelf: Warning: .debug_info offset of 0x6e65706f in .debug_pubnames section
does not point to a CU header.
readelf: Warning: Only DWARF 2 and 3 pubnames are currently supported

$


   The .debug_pubnames section of the getpid.o object file is fine:

$ readelf -wp getpid.o
Contents of the .debug_pubnames section:

  Length:                              7091
  Version:                             2
  Offset into .debug_info section:     0x0
  Size of area in .debug_info section: 145

    Offset      Name
    73          main

$


   The .debug_pubnames section of a dynamically linked executable is also fine:

$ gcc -o getpid-dynamic getpid.o
$ readelf -wp getpid-dynamic
Contents of the .debug_pubnames section:

  Length:                              33
  Version:                             2
  Offset into .debug_info section:     0x77
  Size of area in .debug_info section: 139

    Offset      Name
    6f          _IO_stdin_used
  Length:                              7091
  Version:                             2
  Offset into .debug_info section:     0x102
  Size of area in .debug_info section: 145

    Offset      Name
    73          main

$


Problem is severely impacting the operation of performance analysis tools that
need to use this information.


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