Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 669785

Summary: Invalid DW_FORM_strp for 64 bit applications
Product: Red Hat Enterprise Linux 6 Reporter: Roger pett <pett>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: low    
Version: 6.0   
Target Milestone: rc   
Target Release: ---   
Hardware: powerpc   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-15 10:01:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.