]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdw: Apply DWARF package file section offsets where appropriate
authorOmar Sandoval <osandov@fb.com>
Mon, 26 Feb 2024 19:32:50 +0000 (11:32 -0800)
committerMark Wielaard <mark@klomp.org>
Thu, 29 Feb 2024 23:20:34 +0000 (00:20 +0100)
commit517c773b0242fe3665e5082a06fd5816edbe4b21
tree1b0ec20bcc0a64805c74e09bd278188dd9272834
parent855769777519cfa37d2bfe06a623acdbbba59faa
libdw: Apply DWARF package file section offsets where appropriate

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,
.debug_loclists.dwo/.debug_loc.dwo, .debug_str_offsets.dwo,
.debug_macro.dwo/.debug_macinfo.dwo, and .debug_rnglists.dwo.  With all
of that in place, we can finally test various libdw functions on dwp
files.

* libdw/dwarf_getlocation.c (initial_offset): Call
dwarf_cu_dwp_section_info and add offset to start_offset.
* libdw/dwarf_getmacros.c (get_macinfo_table): Call
dwarf_cu_dwp_section_info and add offset to line_offset.
(get_offset_from): Call dwarf_cu_dwp_section_info and add offset
to *retp.
* libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Call
dwarf_cu_dwp_section_info and pass offset to
        __libdw_getsrclines.
* libdw/dwarf_next_lines.c (dwarf_next_lines): Call
dwarf_cu_dwp_section_info and add offset to stmt_off.
* libdw/libdwP.h (str_offsets_base_off): Call
dwarf_cu_dwp_section_info and add offset.
(__libdw_cu_ranges_base): Ditto.
(__libdw_cu_locs_base): Ditto.
* tests/run-all-dwarf-ranges.sh: Check testfile-dwp-5 and
testfile-dwp-4.
* tests/run-declfiles.sh: Ditto.
* tests/run-get-lines.sh: Ditto.
* tests/run-next-lines.sh: Ditto.
* tests/run-varlocs.sh: Ditto.
* tests/run-get-files.sh: Check testfile-dwp-5,
testfile-dwp-5.dwp, testfile-dwp-4, and testfile-dwp-4.dwp
* tests/run-next-files.sh: Ditto.
* tests/run-dwarf-getmacros.sh: Check testfile-dwp-5 and
testfile-dwp-4-strict.
* tests/run-get-units-split.sh: Ditto.

Signed-off-by: Omar Sandoval <osandov@fb.com>
14 files changed:
libdw/dwarf_getlocation.c
libdw/dwarf_getmacros.c
libdw/dwarf_getsrcfiles.c
libdw/dwarf_next_lines.c
libdw/libdwP.h
tests/run-all-dwarf-ranges.sh
tests/run-declfiles.sh
tests/run-dwarf-getmacros.sh
tests/run-get-files.sh
tests/run-get-lines.sh
tests/run-get-units-split.sh
tests/run-next-files.sh
tests/run-next-lines.sh
tests/run-varlocs.sh