This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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 gdb/21226] New: DW_OP_stack_value pieces yield wrong data on big-endian targets


https://sourceware.org/bugzilla/show_bug.cgi?id=21226

            Bug ID: 21226
           Summary: DW_OP_stack_value pieces yield wrong data on
                    big-endian targets
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: arnez at linux dot vnet.ibm.com
  Target Milestone: ---

The guality test case pr54970.c from the GCC test suite yields lots of fails on
s390x.  The test case defines a local variable a like this:

  int a[] = { 1, 2, 3 };

and the compiler optimizes the variable away, leaving only a DWARF
representation.  That's intentional; the test case verifies that the variable
can still be displayed correctly in GDB.  But on s390x it can't.  All elements
are shown as zero instead.

The compiler represents the array as a DWARF composite location with three
DW_OP_stack_value pieces.  Each piece is 4 bytes long, and on s390x a DWARF
stack value is 8 bytes long.  So GDB extracts 4 bytes out of the stack value. 
But it always uses the *lowest-addressed* bytes, independent from endianness,
where GCC obviously meant the *least significant* bytes to be used.  On
big-endian systems the lowest-addressed bytes are always zero in this case.

This problem should affect all big-endian systems, whenever a DWARF location
involves a DW_OP_stack_value piece that is smaller than the address size.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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