libdw: Handle split Dwarf Dies in dwarf_die_addr_die.
[platform/upstream/elfutils.git] / libdw / ChangeLog
index 35ce554..5a33d9c 100644 (file)
@@ -1,3 +1,399 @@
+2018-05-29  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_cuoffset.c (dwarf_cuoffset): Check die->cu is not NULL.
+       * dwarf_die_addr_die.c (dwarf_die_addr_die): Also search split
+       Dwarfs.
+       * libdwP.h (struct Dwarf): Add split_tree field.
+       (__libdw_find_split_dbg_addr): New internal function definition.
+       (__libdw_finddbg_cb): Likewise.
+       * libdw_find_split_unit.c (__libdw_find_split_unit): Insert split
+       Dwarf into skeleton dbg split_tree.
+       * libdw_findcu.c (__libdw_finddbg_cb): New function.
+       (__libdw_find_split_dbg_addr): Likewise.
+       * dwarf_end (dwarf_end): Destroy split_tree.
+
+2018-05-29  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf.h: Add GNU DebugFission list entry encodings
+       DW_LLE_GNU_end_of_list_entry,
+       DW_LLE_GNU_base_address_selection_entry,
+       DW_LLE_GNU_start_end_entry and DW_LLE_GNU_start_length_entry.
+       * dwarf_ranges.c (__libdw_read_begin_end_pair_inc): Handle
+       GNU DebugFission list entries.
+
+2018-05-28  Mark Wielaard  <mark@klomp.org>
+
+       * libdw_find_split_unit.c (__libdw_find_split_unit): End split_dwarf
+       only after we tried every unit id in it.
+
+2018-04-07  Mark Wielaard  <mark@klomp.org>
+
+       * libdwP.h (struct Dwarf_CU): Add locs_base.
+       (__libdw_cu_locs_base): New static inline function.
+       * libdw_findcu.c (__libdw_intern_next_unit): Initialize locs_base.
+       * dwarf_begin_elf.c (valid_p): Create fake_loclists_cu if necessary.
+       * dwarf_end.c (dwarf_end): Clean up fake_loclists_cu.
+       * dwarf_getlocation.c (initial_offset): Handle .debug_loclists.
+       (getlocations_addr): Likewise.
+       (dwarf_getlocation_addr): Likewise.
+       * dwarf_getlocation_attr.c (attr_form_cu): Use fake_loclists_cu for
+       DWARF5.
+       (initial_offset): Handle DW_FORM_loclistx.
+       * dwarf_ranges.c (__libdw_read_begin_end_pair_inc): Handle
+       .debug_loclists.
+       * libdwP.h (struct Dwarf): Add fake_loclists_cu.
+
+2018-04-12  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf.h: Add DWARF5 location list entry DW_LLE encodings.
+       * begin_elf.c (dwarf_scnnames): Add IDX_debug_loclists.
+       * dwarf_error.c (errmsgs): Remove DWARF_E_NO_LOCLIST. And replace
+       with DWARF_E_NO_DEBUG_LOC, DWARF_E_NO_DEBUG_LOCLISTS and
+       DWARF_E_NO_LOC_VALUE.
+       * dwarf_formudata.c (dwarf_formudata): Handle DW_AT_loclists_base
+       and DW_FORM_loclistx.
+       * dwarf_getlocation.c (attr_ok): Use DWARF_E_NO_LOC_VALUE.
+       (initial_offset): Use DWARF_E_NO_DEBUG_LOC.
+       * libdwP.h: Add IDX_debug_rnglists. Remove DWARF_E_NO_LOCLIST.
+       Add DWARF_E_NO_DEBUG_LOC, DWARF_E_NO_DEBUG_LOCLISTS and
+       DWARF_E_NO_LOC_VALUE.
+
+2018-05-25  Mark Wielaard  <mark@klomp.org>
+
+       * libdw_find_split_unit.c (__libdw_find_split_unit): Extract linking
+       skeleton and split compile units code into...
+       * libdwP (__libdw_link_skel_split): ...this new function.
+
+2018-04-06  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_formaddr.c (__libdw_addrx): New function, extracted from...
+       (dwarf_formaddr): here. Use __libdw_addrx.
+       * dwarf_getlocation.c (getlocations_addr): Pass cu to
+       __libdw_read_begin_end_pair_inc.
+       * dwarf_ranges.c (__libdw_read_begin_end_pair_inc): Take cu as
+       argument. Handle .debug_rnglists.
+       (initial_offset): Handle .debug_rnglists and DW_FORM_rnglistx.
+       (dwarf_ranges): Likewise. Check cu isn't NULL before use. Pass cu to
+       __libdw_read_begin_end_pair_inc.
+       * libdwP.h (__libdw_read_begin_end_pair_inc): Take cu as argument.
+       (__libdw_cu_ranges_base): Handle DW_AT_rnglists_base.
+       (__libdw_addrx): New function definition.
+
+2018-04-11  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf.h: Add DWARF5 range list entry DW_RLE encodings.
+       * begin_elf.c (dwarf_scnnames): Add IDX_debug_rnglists.
+       * dwarf_error.c (errmsgs): Add DWARF_E_NO_DEBUG_RNGLISTS.
+       * dwarf_formudata.c (dwarf_formudata): Handle DW_AT_rnglists_base
+       and DW_FORM_rnglistx.
+       * dwarf_getscopes.c (pc_match): Also check for
+       DWARF_E_NO_DEBUG_RNGLISTS.
+       * libdwP.h: Add IDX_debug_rnglists.
+
+2018-05-25  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_getlocation_attr.c (__libdw_cu_addr_base): Cast offset to
+       uintptr_t before returning as pointer.
+
+2018-05-22  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_getlocation.c (__libdw_cu_base_address): Treat errors of
+       getting lowpc or entrypc the same as missing base address (zero).
+       * dwarf_highpc (dwarf_highpc): Handle any address form. Always set
+       error when attribute could not be found.
+
+2018-05-21  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_begin_elf.c (valid_p): Add a fake_addr_cu to the result.
+       * dwarf_end.c (cu_free): Disconnect the fake_addr_cu from the split
+       dwarf if shared with skeleton.
+       (dwarf_end): release fake_addr_cu.
+       * dwarf_formaddr.c (__libdw_cu_addr_base): Move to...
+       * libdwP.h (__libdw_cu_addr_base): ... here.
+       (struct Dwarf): Add fake_addr_cu field.
+       * dwarf_formudata.c (dwarf_formudata): Handle
+       DW_FORM_GNU_addr_index and DW_FORM_addrx[1234].
+       * dwarf_getlocation_attr.c (addr_valp): New static function.
+       (dwarf_getlocation_attr): Create attribute for values of
+       DW_OP_GNU_const_index, DW_OP_constx and DW_OP_GNU_addr_index and
+       DW_OP_addrx.
+       * libdw_find_split_unit.c (__libdw_find_split_unit): Connect
+       IDX_debug_addr sectiondata and fake_addr_cu between split and
+       skeleton.
+
+2018-05-20  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_cu_info.c: New file.
+       * Makefile.am (libdw_a_SOURCES): Add dwarf_cu_info.c.
+       * libdw.h (dwarf_cu_info): New function declaration.
+       * libdw.map (ELFUTILS_0.171): Add dwarf_cu_info.
+
+2018-05-24  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_ranges.c (dwarf_ranges): Check for NULL cu.
+       * libdw_findcu.c (__libdw_intern_next_unit): Initialize ranges_base.
+
+2018-05-18  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_formudata.c (__libdw_formptr): Handle the special case
+       of IDX_debug_ranges for DW_UT_split_compile with version < 5.
+       * dwarf_highpc.c (dwarf_highpc): Use dwarf_lowpc, check for
+       split compile cudie.
+       * dwarf_lowpc.c (dwarf_lowpc): Check for split compile cudie.
+       * dwarf_ranges.c (dwarf_ranges): Switch cu and sectiondata for
+       split compile units.
+       * libdwP.h (struct Dwarf_CU): Add ranges_base field.
+       (__libdw_cu_ranges_base): New static inline function.
+
+2018-05-18  Mark Wielaard  <mark@klomp.org>
+
+       * libdw_findcu.c (__libdw_intern_next_unit): Init files to NULL.
+       * dwarf_getsrclines.c (dwarf_getsrclines): Handle split units by
+       taking the line table from the skeleton.
+       * dwarf_getsrcfiles.c (dwarf_getsrcfiles): Handle split units by
+       only taking the files from .debug_line offset zero (if it exists),
+       otherwise fall back to the skeleton.
+
+2018-05-17  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_begin_elf.c (__libdw_debugdir): New function.
+       (valid_p): Call __libdw_debugdir.
+       * dwarf_end.c (dwarf_end.c): Free debugdir.
+       * dwarf_getalt.c (__libdw_filepath): Extract __libdw_debugdir logic.
+       take debugdir as argument instead of fd.
+       (find_debug_altlink): Call __libdw_filepath with debugdir.
+       * libdwP.h (struct Dwarf): Add debugdir field.
+       (__libdw_debugdir): New function prototype.
+       (__libdw_filepath): Adjust prototype to take a const char * instead of
+       an int.
+       * libdw_find_split_unit.c (__libdw_find_split_unit): Call
+       __libdw_filepath with debugdir.
+
+2018-05-17  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_attr_integrate.c (dwarf_attr_integrate): Handle split_compile
+       unit DIE, search skeleton_compile unit DIE.
+       * dwarf_hasattr_integrate.c (dwarf_hasattr_integrate): Likewise.
+       * libdwP.h (is_cudie): Check cu is not NULL.
+
+2018-05-19  Mark Wielaard  <mark@klomp.org>
+
+       * libdwP.h (__libdw_find_split_unit): Mark as internal_function.
+
+2018-05-15  Mark Wielaard  <mark@klomp.org>
+
+       * Makefile.am (libdw_a_SOURCES): Add libdw_find_split_unit.c.
+       * dwarf_end.c (cu_free): Free split Dwarf.
+       * dwarf_get_units.c (dwarf_get_units): Handle DW_UT_skeleton by
+       calling __libdw_find_split_unit.
+       * libdwP.h (struct Dwarf_CU): Add split Dwarf_CU field.
+       (__libdw_find_split_unit): New function prototype.
+       (str_offsets_base_off): Use cu Dwarf if dbg is NULL.
+       (filepath): Rename to ...
+       (__libdw_filepath): This. Which is the actual function name in
+       dwarf_getalt.c.
+       (libdw_find_split_unit.c): New file.
+       * libdw_findcu.c (__libdw_intern_next_unit): Initialize split to -1.
+
+2018-05-15  Mark Wielaard  <mark@klomp.org>
+
+       * libdwP.h (__libdw_first_die_from_cu_start): Adjust commented out
+       asserts.
+       * libdw_findcu.c (__libdw_intern_next_unit): For version 4 DWARF if
+       the cudie has a DW_AT_GNU_dwi_id set the unit_id8 and unit_type to
+       DW_UT_skeleton or DW_UT_split_compile based on whether the cudie has
+       child DIEs and a DW_AT_GNU_dwo_name attribute.
+
+2018-05-14  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf.h: Add GNU Debug Fission extensions. DW_AT_GNU_dwo_name,
+       DW_AT_GNU_dwo_id, DW_AT_GNU_ranges_base, DW_AT_GNU_addr_base,
+       DW_AT_GNU_pubnames, DW_AT_GNU_pubtypes. DW_FORM_GNU_addr_index,
+       DW_FORM_GNU_str_index. DW_OP_GNU_addr_index, DW_OP_GNU_const_index.
+       * dwarf_formaddr.c (dwarf_formaddr): Handle DW_FORM_GNU_addr_index
+       as DW_FORM_addrx.
+       (__libdw_cu_addr_base): Check for both DW_AT_GNU_addr_base and
+       DW_AT_addr_base.
+       * dwarf_formstring.c (dwarf_formstring): Handle DW_FORM_GNU_str_index
+       as DW_FORM_strx.
+       * dwarf_formudata.c (dwarf_formudata): Recognize DW_AT_GNU_addr_base
+       as addrptr. Recognize DW_AT_GNU_ranges_base as rangelistptr.
+       * dwarf_getlocation.c (__libdw_intern_expression): Handle
+       DW_OP_GNU_addr_index as DW_OP_addrx and DW_OP_GNU_const_index as
+       DW_OP_constx.
+       * libdw_form.c (__libdw_form_val_compute_len): Handle
+       DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index taking an uleb128.
+
+2018-05-12  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_begin_elf.c (check_section): Also recognize .dwo section
+       name variants.
+
+2018-05-11  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_formudata.c (dwarf_formudata): Handle DW_AT_macros as macptr.
+       * dwarf_getmacros.c (get_table_for_offset): Add DW_MACRO_define_sup,
+       DW_MACRO_undef_sup, DW_MACRO_import_sup, DW_MACRO_define_strx and
+       DW_MACRO_undef_strx. Add str_offsets_base_off to fake CU. Deal with
+       DW_AT_macros. Use libdw_valid_user_form.
+
+2018-05-09  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_formstring.c (__libdw_cu_str_off_base): Moved to...
+       * libdwP.h (__libdw_cu_str_off_base): ...here. Make static inline.
+       (str_offsets_base_off): New internal function that also parses
+       .debug_str_offsets header if necessary.
+
+2018-05-11  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_siblingof.c (dwarf_siblingof): Don't reference cu till it is
+       known the Dwarf_Die is came from is valid.
+       * libdwP.h (__libdw_dieabbrev): Check cu is not NULL.
+
+2018-05-08  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_formref.c (__libdw_formref): Explicitly don't handle
+       DW_FORM_ref_sup4 and DW_FORM_ref_sup8.
+       * dwarf_formref_die.c (dwarf_formref_die): Handle DW_FORM_ref_sup4
+       and DW_FORM_ref_sup8.
+       * dwarf_formstring.c (dwarf_formstring): Handle DW_FORM_strp_sup
+       as DW_FORM_GNU_strp_alt.
+
+2018-05-05  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf.h: Add DWARF line content descriptions.
+       * libdwP.h (libdw_valid_user_form): New static function.
+       * dwarf_getsrclines.c (read_srclines): Check and parse version 5
+       DWARF header, dir and file tables separately from older versions
+       where different.
+
+2018-04-24  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_begin_elf.c (dwarf_scnnames): Add ".debug_line_str".
+       * dwarf_error.c (errmsgs): Add DWARF_E_NO_DEBUG_STR and
+       DWARF_E_NO_DEBUG_LINE_STR.
+       * dwarf_formstring.c (dwarf_formstring): Handle DW_FORM_line_strp.
+       Get data from either .debug_str or .debug_line_str.
+       * libdwP.h: Add IDX_debug_line_str, DWARF_E_NO_DEBUG_STR and
+       DWARF_E_NO_DEBUG_LINE_STR.
+
+2018-04-03  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_formudata.c (__libdw_formptr): Take and return const
+       unsigned char pointers.
+       * dwarf_getlocation.c (attr_base_address): Rename to...
+       (__libdw_cu_base_address): this. Take Dwarf_CU, check and set
+       base_address.
+       (initial_offset_base): Renamed to...
+       (initial_offset): this. Only provide offset.
+       (getlocations_addr): Move data size check and
+       address base addition into __libdw_read_begin_end_pair_inc. Use
+       __libdw_cu_base_address and initial_offset. Drop Elf_Data NULL
+       check (already done by initial_offset, through __libdw_formptr).
+       (dwarf_getlocations): Use __libdw_cu_base_address and initial_offset.
+       Drop Elf_Data NULL check.
+       * dwarf_ranges.c (__libdw_read_begin_end_pair_inc): Change argument
+       type of readp to Add readend argument. Check data size. Include base
+       in begin and end result.
+       (initial_offset): New static function.
+       (dwarf_ranges): Don't check Elf_Data being NULL (already done by
+       initial_offset, through __libdw_formptr). Use __libdw_cu_base_address
+       and initial_offset. Remove base check and addition (already done by
+       __libdw_read_begin_end_pair_inc.
+       * libdwP.h (Dwarf_CU): Add base_address field.
+       (__libdw_read_begin_end_pair_inc): Change argument type of readp to
+       const. Add readend argument.
+       (__libdw_formptr): Take and return const unsigned char pointers.
+       * libdw_findcu.c (__libdw_intern_next_unit): Initialize Dwarf_CU
+       base_address.
+
+2018-04-04  Mark Wielaard  <mark@klomp.org>
+
+       * libdw_findcu.c (__libdw_intern_next_unit): Initialize Dwarf_CU
+       addr_base and str_off_base.
+
+2018-03-23  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_str_offsets,
+       increase size.
+       * dwarf_error.c (errmsgs): Add DWARF_E_NO_STR_OFFSETS.
+       * dwarf_formstring.c (dwarf_formstring): Handle DW_FORM_strx[1234].
+       (__libdw_cu_str_off_base): New function.
+       * dwarf_formudata.c (dwarf_formudata): Handle IDX_debug_str_offsets
+       as stroffsetsptr.
+       * libdwP.h: Add IDX_debug_str_offsets and DWARF_E_NO_STR_OFFSETS.
+       (struct Dwarf_CU): Add str_off_base field.
+       (__libdw_cu_str_off_base): New function declaration.
+
+2018-03-22  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_addr.
+       * dwarf_error.c (errmsgs): Add DWARF_E_NO_DEBUG_ADDR.
+       * dwarf_formaddr.c (dwarf_formaddr): Handle DW_FORM_addrx[1234].
+       (__libdw_cu_addr_base): New function.
+       * dwarf_formudata.c (dwarf_formudata): Handle DW_AT_addr_base as
+       addrptr.
+       * libdwP.h: Add IDX_debug_addr and DWARF_E_NO_DEBUG_ADDR.
+       (struct Dwarf_CU): Add addr_base field.
+       (__libdw_cu_addr_base): New function definition.
+       * memory-access.h (file_byte_order): New static function.
+       (read_3ubyte_unaligned): New inline function.
+
+2018-03-29  Mark Wielaard  <mark@klomp.org>
+
+       * libdw.h (dwarf_decl_file): Extend documentation.
+       (dwarf_linesrc): Likewise.
+       (dwarf_filesrc): Likewise.
+
+2018-03-06  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf.h: Add DW_OP_implicit_pointer, DW_OP_addrx, DW_OP_constx,
+       DW_OP_entry_value, DW_OP_const_type, DW_OP_regval_type,
+       DW_OP_deref_type, DW_OP_xderef_type, DW_OP_convert and
+       DW_OP_reinterpret.
+       * dwarf_getlocation.c (__libdw_intern_expression): Handle
+       DW_OP_convert, DW_OP_reinterpret, DW_OP_addrx, DW_OP_constx,
+       DW_OP_regval_type, DW_OP_entry_value, DW_OP_implicit_pointer,
+       DW_OP_deref_type, DW_OP_xderef_type and DW_OP_const_type.
+       * dwarf_getlocation_attr.c (dwarf_getlocation_attr): Handle
+       DW_OP_entry_value, DW_OP_const_type and DW_OP_implicit_pointer.
+       * dwarf_getlocation_die.c (dwarf_getlocation_die): Handle
+       DW_OP_implicit_pointer, DW_OP_convert, DW_OP_reinterpret,
+       DW_OP_const_type, DW_OP_regval_type, DW_OP_deref_type and
+       DW_OP_xderef_type.
+       * dwarf_getlocation_implicit_pointer.c
+       (dwarf_getlocation_implicit_pointer): Handle DW_OP_implicit_pointer.
+
+2018-03-01  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf.h: Add DW_AT_GNU_locviews and DW_AT_GNU_entry_view.
+       * dwarf_formudata.c (dwarf_formudata): Handle DW_AT_GNU_locviews
+       as a loclistptr.
+
+2018-02-09  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_formblock.c (dwarf_formblock): Handle DW_FORM_data16 as a
+       16 byte block.
+
+2018-02-09  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_child.c (__libdw_find_attr): Handle DW_FORM_implicit_const.
+       * dwarf_formsdata.c (dwarf_formsdata): Likewise.
+       * dwarf_formudata.c (dwarf_formudata): Likewise.
+       * dwarf_getabbrev.c (__libdw_getabbrev): Likewise.
+       * dwarf_getattrs.c (dwarf_getattrs): Likewise.
+       * dwarf_hasattr.c (dwarf_hasattr): Likewise.
+       * dwarf_getabbrevattr.c (dwarf_getabbrevattr_data): New function
+       that will also return any data associated with the abbrev. Which
+       currently is only for DW_FORM_implicit_const. Based on...
+       (dwarf_getabbrevattr): ... this function. Which now just calls
+       dwarf_getabbrevattr_data.
+       * libdw.h (dwarf_getabbrevattr_data): Declare new function.
+       * libdw.map (ELFUTILS_0.170): Add dwarf_getabbrevattr_data.
+       * libdwP.h (dwarf_getabbrevattr_data): INTDECL.
+       * memory-access.h (__libdw_get_sleb128_unchecked): New inlined
+       function based on __libdw_get_uleb128_unchecked.
+
 2018-02-08  Mark Wielaard  <mark@klomp.org>
 
        * dwarf.h: Add DWARF5 DW_FORMs.