Re: [PATCH 00/14] elfutils: DWARF package (.dwp) file support

2023-09-27 Thread Omar Sandoval
On Wed, Sep 27, 2023 at 03:20:40PM -0400, Frank Ch. Eigler wrote: > Hi - > > > This patch series adds support for DWARF package files to libdw and the > > elfutils tools. It supports the GNU DebugFission format for DWARF 4 [1] > > and the format standardized in DWARF 5 (section 7.3.5 "DWARF Packag

Re: [PATCH 00/14] elfutils: DWARF package (.dwp) file support

2023-09-27 Thread Frank Ch. Eigler via Elfutils-devel
Hi - > This patch series adds support for DWARF package files to libdw and the > elfutils tools. It supports the GNU DebugFission format for DWARF 4 [1] > and the format standardized in DWARF 5 (section 7.3.5 "DWARF Package > Files"). It supports both automatically opening the .dwp file for a > sk

[PATCH 13/14] libdw: Apply DWARF package file section offsets where appropriate

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval The final piece of DWARF package file support is that offsets have to be interpreted relative to the section offset from the package index. .debug_abbrev.dwo is already covered, so sprinkle around calls to dwarf_cu_dwp_section_info for the remaining sections: .debug_line.dwo,

[PATCH 08/14] libdw: Parse DWARF package file index sections

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval The .debug_cu_index and .debug_tu_index sections in DWARF package files are basically hash tables mapping a unit's 8 byte signature to an offset and size in each section used by that unit [1]. Add support for parsing and doing lookups in the index sections. We look up a unit

[PATCH 12/14] tests: Optionally dump all units in dwarf-getmacros

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval If instead of a CU offset an empty string is given as the second argument, dump all units. Signed-off-by: Omar Sandoval --- tests/ChangeLog | 3 +++ tests/dwarf-getmacros.c | 51 + 2 files changed, 44 insertions(+), 10 deleti

[PATCH 11/14] tests: Handle DW_MACRO_{define, undef}_{strx, sup} in dwarf-getmacros

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval Signed-off-by: Omar Sandoval --- tests/ChangeLog | 3 +++ tests/dwarf-getmacros.c | 4 2 files changed, 7 insertions(+) diff --git a/tests/ChangeLog b/tests/ChangeLog index 687a9f32..4380c57f 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -14,6 +14,9 @@

[PATCH 14/14] libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file indexes

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval Meta uses DWARF package files for our large, statically-linked C++ applications. Some of our largest applications have more than 4GB in .debug_info.dwo, but the section offsets in .debug_cu_index and .debug_tu_index are 32 bits; see the discussion here [1]. We implemented a

[PATCH 10/14] libdw: Try .dwp file in __libdw_find_split_unit()

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval Try opening the file in the location suggested by the standard (the skeleton file name + ".dwp") and looking up the unit in the package index. The rest is similar to .dwo files, with slightly different cleanup since a single Dwarf handle is shared. Signed-off-by: Omar Sandov

[PATCH 09/14] libdw, libdwfl: Save original path of ELF file

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval libdw and libdwfl currently save the path of the directory containing the ELF file to use when searching for alt and dwo files. To search for dwp files, we need the file name too. Add an elfpath field to Dwarf, and set the debugdir field from it. Also update libdwfl to set

[PATCH 04/14] libdw: Handle other string forms in dwarf_macro_param2

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval dwarf_getmacros handles the additional macro string forms added by DWARF 5, but dwarf_macro_param2 doesn't. Update it with the list of all string forms allowed in .debug_macro. In particular, GCC and Clang generate DW_MACRO_define_strx and DW_MACRO_undef_strx, which dwarf_ma

[PATCH 07/14] libdw: Recognize .debug_[ct]u_index sections in dwarf_elf_begin

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval DWARF package (.dwp) files have a .debug_cu_index section and, optionally, a .debug_tu_index section. Add them to the list of DWARF sections. Unfortunately, it's not that simple: the other debug sections in a dwp file have names ending with .dwo, which confuses the checks in

[PATCH 03/14] libdw: Handle DW_AT_ranges in split DWARF 5 skeleton in dwarf_ranges

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval When commit 879f3a4f99df ("libdw: Handle .debug_rnglists in dwarf_ranges.") added support for split DWARF 5 in 2018, GCC put all range lists for split DWARF in the .debug_rnglists section of the skeleton file (similarly to GNU DebugFission, which puts all range lists in .debug

[PATCH 05/14] libdw: Fix dwarf_macro_getsrcfiles for DWARF 5

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval Dwarf_Macro_Op_Table::is_64bit conflates the address size and the offset size: for .debug_macinfo, it is initialized based on the compilation unit's address size, but for .debug_macro, it is initialized based on the macro unit's offset size. is_64bit is used to determine the

[PATCH 06/14] libdw: Handle split DWARF in dwarf_macro_getsrcfiles

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval Macro information references file names from the line number information table, which is tricky in split DWARF for a couple of reasons. First, the line number information for a macro unit comes from the .debug_line.dwo section in the split file, not the .debug_line section in

[PATCH 02/14] libdw: Handle split DWARF in dwarf_entrypc

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval If a DIE has no DW_AT_entry_pc attribute, dwarf_entrypc looks for DW_AT_low_pc in that DIE. But for a split compilation unit DIE, DW_AT_low_pc is in the corresponding skeleton DIE, so this fails. dwarf_lowpc already handles this fallback, so use it instead. Signed-off-by: Om

[PATCH 00/14] elfutils: DWARF package (.dwp) file support

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval Hi, This patch series adds support for DWARF package files to libdw and the elfutils tools. It supports the GNU DebugFission format for DWARF 4 [1] and the format standardized in DWARF 5 (section 7.3.5 "DWARF Package Files"). It supports both automatically opening the .dwp fi

[PATCH 01/14] libdw: Make try_split_file static

2023-09-27 Thread Omar Sandoval
From: Omar Sandoval It's only used in libdw_find_split_unit.c. Signed-off-by: Omar Sandoval --- libdw/ChangeLog | 4 libdw/libdw_find_split_unit.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 406310ef..0014aeb1