[all-commits] [llvm/llvm-project] 19602b: Add a DWARF transformer class that converts DWARF ...

Greg Clayton via All-commits all-commits at lists.llvm.org
Thu Feb 13 10:48:56 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 19602b71949db1f840b262558c832c5f73722c7e
      https://github.com/llvm/llvm-project/commit/19602b71949db1f840b262558c832c5f73722c7e
  Author: Greg Clayton <gclayton at fb.com>
  Date:   2020-02-13 (Thu, 13 Feb 2020)

  Changed paths:
    A llvm/include/llvm/DebugInfo/GSYM/DwarfTransformer.h
    M llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h
    M llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
    M llvm/include/llvm/DebugInfo/GSYM/LineTable.h
    M llvm/include/llvm/MC/StringTableBuilder.h
    M llvm/lib/DebugInfo/GSYM/CMakeLists.txt
    A llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
    M llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
    M llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
    M llvm/lib/DebugInfo/GSYM/GsymReader.cpp
    M llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
    M llvm/unittests/DebugInfo/GSYM/CMakeLists.txt
    M llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

  Log Message:
  -----------
  Add a DWARF transformer class that converts DWARF to GSYM.

Summary:
The DWARF transformer is added as a class so it can be unit tested fully.

The DWARF is converted to GSYM format and handles many special cases for functions:
- omit functions in compile units with 4 byte addresses whose address is UINT32_MAX (dead stripped)
- omit functions in compile units with 8 byte addresses whose address is UINT64_MAX (dead stripped)
- omit any functions whose high PC is <= low PC (dead stripped)
- StringTable builder doesn't copy strings, so we need to make backing copies of strings but only when needed. Many strings come from sections in object files and won't need to have backing copies, but some do.
- When a function doesn't have a mangled name, store the fully qualified name by creating a string by traversing the parent decl context DIEs and then. If we don't do this, we end up having cases where some function might appear in the GSYM as "erase" instead of "std::vector<int>::erase".
- omit any functions whose address isn't in the optional TextRanges member variable of DwarfTransformer. This allows object file to register address ranges that are known valid code ranges and can help omit functions that should have been dead stripped, but just had their low PC values set to zero. In this case we have many functions that all appear at address zero and can omit these functions by making sure they fall into good address ranges on the object file. Many compilers do this when the DWARF has a DW_AT_low_pc with a DW_FORM_addr, and a DW_AT_high_pc with a DW_FORM_data4 as the offset from the low PC. In this case the linker can't write the same address to both the high and low PC since there is only a relocation for the DW_AT_low_pc, so many linkers tend to just zero it out.

Reviewers: aprantl, dblaikie, probinson

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list