Bug 669785 - Invalid DW_FORM_strp for 64 bit applications
Summary: Invalid DW_FORM_strp for 64 bit applications
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc
Version: 6.0
Hardware: powerpc
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-14 19:10 UTC by Roger pett
Modified: 2011-05-13 12:25 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-15 10:01:53 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Roger pett 2011-01-14 19:10:52 UTC
Description of problem:

This version of the compiler marks its debug information as dwarf-3.  This
causes problems with a dwarf-3 compliant debugger when debugging 64 bit code. (We are developing such a debugger)

In section "7.4 32-Bit and 64-Bit DWARF Formats", the dwarf-3 spec says with
regard to DW_FORM_strp:
"Within the body of the .debug_info section, certain forms of attribute value
depend on the choice of DWARF format as follows. For the 32-bit DWARF format,
the value is a 32-bit unsigned integer; for the 64-bit DWARF format, the value
is a 64-bit unsigned integer."

This version of the compiler is generating 32 bit integers for both 32 and 64
bit formats.  This causes a compliant debugger to generate an incorrect pointer
into the debug information.

Version-Release number of selected component (if applicable):
gcc -v reports:
Using built-in specs.
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --enable-secureplt --with-long-double-128
--with-cpu-32=power4 --with-tune-32=power6 --with-cpu-64=power4
--with-tune-64=power6 --build=ppc64-redhat-linux
Thread model: posix
gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)


How reproducible:
Build any c/c++ application as 64 bit.  Attempt to debug with a DWARF-3 compliant debugger (gdb is not compliant).  Debugger fails.

Steps to Reproduce:
1.  compile the following C application (gcc -g -c x.c)
    int main()
    {
      return 0;
    }
2.  dump the resulting .o file
    objdump -s -Wi x.o
3.  Examine the .debug_info section
Contents of section .debug_info:
 0000 0000004f 00030000 00000801 00000000  ...O............
 0010 01782e63 00000000 28000000 00000000  .x.c....(.......
 0020 00000000 00000000 2c000000 00020100  ........,.......
 0030 00003c01 01000000 4b000000 00000000  ..<.....K.......
 0040 00000000 00000000 2c019c03 0405696e  ........,.....in
 0050 740000  

The .debug-abbrev section specifies the following mapping for the debug info
starting at 000b:
   1      DW_TAG_compile_unit    [has children]
    DW_AT_producer     DW_FORM_strp
    DW_AT_language     DW_FORM_data1
    DW_AT_name         DW_FORM_string
    DW_AT_comp_dir     DW_FORM_strp
    DW_AT_low_pc       DW_FORM_addr
    DW_AT_high_pc      DW_FORM_addr
    DW_AT_stmt_list    DW_FORM_data4
There are 4 byte offsets into the strings section at offsets +000c and +0015 in the .debug_info section.  Because the compile unit is 64 bit, DWARF-3 compliance requires that these be 8 byte offsets.

    
  
Actual results:


Expected results:


Additional info:

Comment 2 Jakub Jelinek 2011-01-15 10:01:53 UTC
We are producing 32-bit DWARF[234] format even on 64-bit targets, so this is not a bug.
As per DWARF4 section 7.4 or 7.5.1.1, 64-bit DWARF .debug_info starts with 0xffffffff followed by 64-bit initial length size.


Note You need to log in before you can comment on or make changes to this bug.