[all-commits] [llvm/llvm-project] 06e73f: [lldb/DWARF] Change how we construct a llvm::DWARF...

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Jan 20 02:48:44 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 06e73f071ae12dc83c102ddecdb939dea880e588
      https://github.com/llvm/llvm-project/commit/06e73f071ae12dc83c102ddecdb939dea880e588
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-01-20 (Mon, 20 Jan 2020)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
    M lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp

  Log Message:
  -----------
  [lldb/DWARF] Change how we construct a llvm::DWARFContext

Summary:
The goal of this patch is two-fold. First, it fixes a use-after-free in
the construction of the llvm DWARFContext. This happened because the
construction code was throwing away the lldb DataExtractors it got while
reading the sections (unlike their llvm counterparts, these are also
responsible for memory ownership). In most cases this did not matter,
because the sections are just slices of the mmapped file data. But this
isn't the case for compressed elf sections, in which case the section is
decompressed into a heap buffer. A similar thing also happen with object
files which are loaded from process memory.

The second goal is to make it explicit which sections go into the llvm
DWARFContext -- any access to the sections through both DWARF parsers
carries a risk of parsing things twice, so it's better if this is a
conscious decision. Also, this avoids loading completely irrelevant
sections (e.g. .text). At present, the only section that needs to be
present in the llvm DWARFContext is the debug_line_str. Using it through
both APIs is not a problem, as there is no parsing involved.

The first goal is achieved by loading the sections through the existing
lldb DWARFContext APIs, which already do the caching. The second by
explicitly enumerating the sections we wish to load.

Reviewers: JDevlieghere, aprantl

Subscribers: lldb-commits

Tags: #lldb

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




More information about the All-commits mailing list