[v3,0/4] elfutils: DWARF package (.dwp) file support

Message ID cover.1708974560.git.osandov@fb.com
Headers
Series elfutils: DWARF package (.dwp) file support |

Message

Omar Sandoval Feb. 26, 2024, 7:32 p.m. UTC
  From: Omar Sandoval <osandov@fb.com>

Hi,

This is version 3 of my patch series adding support for DWARF package
files to libdw and the elfutils tools. Version 2 is here [1], and
version 1 is [here]. This version fixes handling of line number
information.

Patches 1 and 2 are new in this version. Patch 1 fixes dwarf_decl_file
for split DWARF (not just DWP). Patch 2 is primarly a refactor to
prepare for patch 3, but I also stumbled across a theoretical bug that
it fixes.

Patch 3 is the last piece of core DWP support. It was updated in this
version to handle DWP files in dwarf_getsrcfiles and dwarf_next_lines
and run the declfiles, get-lines, next-lines, get-files, and next-files
tests on DWP files.

Patch 4 is unchanged from version 2. It adds support and tests for an
LLVM extension to the dwp format. The "extension" is ugly because of an
oversight in the design of the format that LLVM had to make the best of,
but unfortunately it's necessary for a lot of our use cases.

Thanks!

Omar

1: https://sourceware.org/pipermail/elfutils-devel/2023q4/006718.html
2: https://sourceware.org/pipermail/elfutils-devel/2023q3/006410.html

Omar Sandoval (4):
  libdw: Handle split DWARF in dwarf_decl_file
  libdw: Refactor dwarf_next_lines and fix skipped CU
  libdw: Apply DWARF package file section offsets where appropriate
  libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file
    indexes

 libdw/dwarf_cu_dwp_section_info.c             |  147 +-
 libdw/dwarf_decl_file.c                       |   30 +-
 libdw/dwarf_end.c                             |   15 +-
 libdw/dwarf_getlocation.c                     |    6 +
 libdw/dwarf_getmacros.c                       |   26 +-
 libdw/dwarf_getsrcfiles.c                     |   17 +-
 libdw/dwarf_next_lines.c                      |   80 +-
 libdw/libdwP.h                                |   45 +-
 tests/.gitignore                              |    1 +
 tests/Makefile.am                             |   13 +-
 tests/declfiles.c                             |   90 ++
 tests/run-all-dwarf-ranges.sh                 |  114 ++
 tests/run-declfiles.sh                        |  323 ++++
 tests/run-dwarf-getmacros.sh                  | 1412 +++++++++++++++++
 tests/run-get-files.sh                        |  115 ++
 tests/run-get-lines.sh                        |  244 +++
 tests/run-get-units-split.sh                  |   18 +
 tests/run-large-elf-file.sh                   |  174 ++
 tests/run-next-files.sh                       |  100 ++
 tests/run-next-lines.sh                       |  242 +++
 tests/run-varlocs.sh                          |  112 ++
 tests/testfile-dwp-4-cu-index-overflow.bz2    |  Bin 0 -> 4490 bytes
 .../testfile-dwp-4-cu-index-overflow.dwp.bz2  |  Bin 0 -> 5584 bytes
 tests/testfile-dwp-5-cu-index-overflow.bz2    |  Bin 0 -> 4544 bytes
 .../testfile-dwp-5-cu-index-overflow.dwp.bz2  |  Bin 0 -> 5790 bytes
 tests/testfile-dwp-cu-index-overflow.source   |   86 +
 26 files changed, 3313 insertions(+), 97 deletions(-)
 create mode 100644 tests/declfiles.c
 create mode 100755 tests/run-declfiles.sh
 create mode 100755 tests/testfile-dwp-4-cu-index-overflow.bz2
 create mode 100644 tests/testfile-dwp-4-cu-index-overflow.dwp.bz2
 create mode 100755 tests/testfile-dwp-5-cu-index-overflow.bz2
 create mode 100644 tests/testfile-dwp-5-cu-index-overflow.dwp.bz2
 create mode 100644 tests/testfile-dwp-cu-index-overflow.source