[PATCH] D70394: [DWARF] Add an api to get "interpreted" location lists

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 06:40:31 PST 2019


labath created this revision.
labath added reviewers: dblaikie, JDevlieghere, SouraVX.
Herald added subscribers: hiraditya, mgorny.
Herald added a project: LLVM.

This patch adds DWARFDie::getLocations, which returns the location
expressions for a given attribute (typically DW_AT_location). It handles
both "inline" locations and references to the external location list
sections (currently only of the DW_FORM_sec_offset type). It is
implemented on top of DWARFUnit::findLoclistFromOffset, which is also
added in this patch. I tried to make their signatures similar to the
equivalent range list functionality.

The actual location list interpretation logic is in
DWARFLocationTable::visitAbsoluteLocationList. This part is not
equivalent to the range list code, but this deviation is motivated by a
desire to reuse the same location list parsing code within lldb.

I've also converted one of the existing location list users (dwarfdump
--statistics) to use the new API instead parsing location lists
manually.

Since test the full extent of this functionality via the statistics
output (which is the only way to access this code right now) would be
tricky, I opted to write a DWARFDie level unit test.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70394

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFLocationExpression.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
  llvm/include/llvm/Object/ObjectFile.h
  llvm/lib/DebugInfo/DWARF/CMakeLists.txt
  llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
  llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
  llvm/lib/Object/ObjectFile.cpp
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
  llvm/tools/llvm-dwarfdump/Statistics.cpp
  llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70394.229832.patch
Type: text/x-patch
Size: 18866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191118/4078a064/attachment.bin>


More information about the llvm-commits mailing list