[0/9,libbacktrace] Handle .gnu_debugaltlink

Message ID 20181211101411.7067-1-tdevries@suse.de
Headers show
  • Handle .gnu_debugaltlink
Related show


Tom de Vries Dec. 11, 2018, 10:14 a.m.
[ Part of this patch series was earlier posted as "[libbacktrace] Handle
DW_FORM_GNU_strp_alt" here (
https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01091.html ).

This patch series is based on the patch series submitted here (
https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01091.html).  It needs the part
that adds keeping track of units.  ]

The dwz tool attempts to optimize DWARF debugging information contained in ELF
shared libraries and ELF executables for size.

With the dwz -m option, it attempts to optimize by moving DWARF debugging
information entries (DIEs), strings and macro descriptions duplicated in
more than one object into a newly created ELF ET_REL object whose filename is
given as -m option argument.  The debug sections in the executables and
shared libraries specified on the command line are then modified again,
referring to the entities in the newly created object.

After a dwz invocation:
$ dwz -m c.debug a.out b.out
both a.out and b.out contain a .gnu_debugaltlink section referring to c.debug,
and use "DWZ DWARF multifile extensions" such as DW_FORM_GNU_strp_alt and
DW_FORM_GNU_ref_alt to refer to the content of c.debug.

The .gnu_debugaltlink consists of a filename and the expected buildid.

This patch series adds to libbacktrace:
- reading the dwarf of the .gnu_debugaltlink
- support for FORM_GNU_strp_alt and FORM_GNU_ref_alt
- a test-case btest_dwz
- a test-case printdwarftest_dwz_cmp.sh

Bootstrapped and reg-tested on x86_64.

OK for trunk?

- Tom

Tom de Vries (9):
  [libbacktrace] Read .gnu_debugaltlink
  [libbacktrace] Add altlink field to struct dwarf_data
  [libbacktrace] Handle alt FORMS without .gnu_debugaltlink
  [libbacktrace] Handle DW_FORM_GNU_strp_alt
  [libbacktrace] Unify function name preference handling
  [libbacktrace] Factor out read_referenced_name_1
  [libbacktrace] Handle DW_FORM_GNU_ref_alt
  [libbacktrace] Add btest_dwz test-case
  [libbacktrace] Add printdwarftest_dwz_cmp.sh test-case

 libbacktrace/Makefile.am               |  23 +++
 libbacktrace/Makefile.in               |  88 ++++++++---
 libbacktrace/configure                 |  57 ++++++-
 libbacktrace/configure.ac              |   3 +
 libbacktrace/dwarf.c                   | 274 +++++++++++++++++++++++++--------
 libbacktrace/elf.c                     | 103 ++++++++++++-
 libbacktrace/internal.h                |   4 +-
 libbacktrace/pecoff.c                  |   3 +-
 libbacktrace/printdwarftest.c          | 241 +++++++++++++++++++++++++++++
 libbacktrace/printdwarftest_dwz_cmp.sh |   8 +
 libbacktrace/xcoff.c                   |   3 +-
 11 files changed, 711 insertions(+), 96 deletions(-)
 create mode 100644 libbacktrace/printdwarftest.c
 create mode 100755 libbacktrace/printdwarftest_dwz_cmp.sh