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 exp/19999] gdb not able to resolve argc, argv with fission when built as PIE


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

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at google dot com

--- Comment #2 from dje at google dot com ---
I was probably trying to cope with a case where DW_AT_low_pc was non-zero (say
0x400410 or some such), and the addresses in .debug_addr also had low_pc
(initial "base address") already added as well.

https://gcc.gnu.org/wiki/DebugFission

"Each location list entry in the .debug_loc section contains a beginning and
ending address offset, which normally are relocated addresses. In the
.debug_loc.dwo section, these offsets will be replaced by indices into the
.debug_addr section. Each location list entry will begin with a single byte
identifying the entry type: DW_LLE_end_of_list_entry (0) indicates an
end-of-list entry, DW_LLE_base_address_selection_entry (1) indicates a base
address selection entry, DW_LLE_start_end_entry (2) indicates a normal location
list entry providing start and end addresses, DW_LLE_start_length_entry (3)
indicates a normal location list entry providing a start address and a length,
and DW_LLE_offset_pair_entry (4) indicates a normal location list entry
providing start and end offsets relative to the base address given by a base
address selection entry. An end-of-list entry has no further data. A base
address selection entry contains a single unsigned LEB128 number following the
entry type byte, which is an index into the .debug_addr section that selects
the new base address for subsequent location list entries. A start/end entry
contains two unsigned LEB128 numbers following the entry type byte, which are
indices into the .debug_addr section that select the beginning and ending
addresses. A start/length entry contains one unsigned LEB128 number and a
4-byte unsigned value (as would be represented by the form code
DW_FORM_const4u). The first number is an index into the .debug_addr section
that selects the beginning offset, and the second number is the length of the
range. Addresses fetched from the .debug_addr section are not relative to the
base address. An offset pair entry contains two 4-byte unsigned values (as
would be represented by the form code DW_FORM_const4u), treated as the
beginning and ending offsets, respectively, relative to the base address. As in
the .debug_loc section, the base address is obtained either from the nearest
preceding base address selection entry, or, if there is no such entry, from the
compilation unit base address (see section 3.1.1 in the DWARF-4 spec). For the
latter three types (start/end, start/length, and offset pair), the two operand
values are followed by a location description as in a normal location list
entry in the .debug_loc section."

In particular: "Addresses fetched from the .debug_addr section are not relative
to the base address."

This might be the right fix (untested):

      if (baton->from_dwo)
        {
          low += base_offset
          high += base_offset
        }
      else
        {
          low += base_address;
          high += base_address;
        }

-- 
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]