[Lldb-commits] [PATCH] D32167: Add support for type units (.debug_types) to LLDB in a way that is compatible with DWARF 5

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 18 08:25:08 PDT 2017


clayborg created this revision.

This patch adds support for type units and parsing the .debug_types section which allows LLDB to debug binaries that were built with "-gdwarf-4 -fdebug-types-section". This patch takes into account how DWARF 5 will represent type units: all compile units will contain extra fields and all type units are in the .debug_info section.

Normally this change would be very invasive because we would need to make a way for DIEs in the .debug_types section to have unique IDs (lldb::user_id_t). This patch takes advantage of the fact that debug info in the .debug_types section can't point to any other DWARF directly. There are only CU relative references and type signatures that might point to other debug info, but indirected through the type signature. This means the offset of the DIEs in the ,.debug_types section are not important. Given all of this, there are the important takes from this patch:

- Modify DWARFCompileUnit to contain extra fields: type signature and type offset. This is the way DWARF5 is doing it, so we will need to do that anyway in the near future.
- Slide the offset of all DIEs in .debug_types by the size of the .debug_info section. This allows every DIE to have unique offset and allows this patch to "just work" with the existing DWARF parser
- Anyone extracting attribute values must use the DWARFDIE::GetData() or DWARFCompileUnit::GetData() to make sure they are getting the right info (.debug_info or .debug_types) to extract from
- LLDB testing adds a new "_dwarf_debug_types" variant (like we add the _dwarf, _dwarf_dsym, _dwo) on platforms that support the .debug_types

I would love to get this in. Anything is better that what LLDB does now when it debugs binaries with .debug_types: crash a lot. So we should get this in and iterate on it.


https://reviews.llvm.org/D32167

Files:
  include/lldb/lldb-enumerations.h
  include/lldb/lldb-forward.h
  packages/Python/lldbsuite/test/lldbinline.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/make/Makefile.rules
  packages/Python/lldbsuite/test/plugins/builder_base.py
  packages/Python/lldbsuite/test/test_categories.py
  source/Core/Section.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/SymbolFile/DWARF/DIERef.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
  source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/ObjectFile.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32167.95572.patch
Type: text/x-patch
Size: 56743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170418/0329da21/attachment-0001.bin>


More information about the lldb-commits mailing list