HomePhabricator

DWARF: Add ability to reference debug info coming from multiple sections
ca959d5f4c41Unpublished

Authored by labath on May 16 2019, 4:07 AM.

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

DWARF: Add ability to reference debug info coming from multiple sections

Summary:
This patch adds the ability to precisely address debug info in
situations when a single file can have more than one debug-info-bearing
sections (as is the case with type units in DWARF v4).

The changes here can be classified into roughly three categories:

  • the code which addresses a debug info by offset gets an additional argument, which specifies the section one should look into.
  • the DIERef class also gets an additional member variable specifying the section. This way, code dealing with DIERefs can know which section is the object referring to.
  • the user_id_t encoding steals one bit from the dwarf_id field to store the section. This means the total number of separate object files (apple .o, or normal .dwo) is limited to 2 billion, but that is fine as it's not possible to hit that number without switching to DWARF64 anyway.

This patch is functionally equivalent to (and inspired by) the two
patches (D61503 and D61504) by Jan Kratochvil, but there are differences
in the implementation:

  • it uses an enum instead of a bool flag to differentiate the sections
  • it increases the size of DIERef struct instead of reducing the amount of addressable debug info
  • it sets up DWARFDebugInfo to store the units in a single vector instead of two. This sets us up for the future in which type units can also live in the debug_info section, and I believe it's cleaner because there's no need for unit index remapping

There are no tests with this patch as this is essentially NFC until
we start parsing type units from the debug_types section.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: arphaman, jankratochvil, lldb-commits

Differential Revision: https://reviews.llvm.org/D61908

llvm-svn: 360872