summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-11-08 15:24:11 +0100
committerPavel Labath <pavel@labath.sk>2019-11-20 13:25:18 +0100
commit089c0f581492cd6e2a3d2927be3fbf60ea2d7e62 (patch)
treec99b6523359271ad380b5b039af76805b7dab1dc /llvm/lib/ObjectYAML
parent979592a6f735a7111ba2c3a19e5ef3e8d336e01a (diff)
downloadbcm5719-llvm-089c0f581492cd6e2a3d2927be3fbf60ea2d7e62.tar.gz
bcm5719-llvm-089c0f581492cd6e2a3d2927be3fbf60ea2d7e62.zip
[DWARF] Add an api to get "interpreted" location lists
Summary: 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. The functionality is tested via a c++ unit test of the DWARFDie API. Reviewers: dblaikie, JDevlieghere, SouraVX Subscribers: mgorny, hiraditya, cmtice, probinson, llvm-commits, aprantl Tags: #llvm Differential Revision: https://reviews.llvm.org/D70394
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/DWARFEmitter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index 2ae66997cf5..b410fed16f0 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -314,7 +314,10 @@ public:
DIEFixupVisitor(DWARFYAML::Data &DI) : DWARFYAML::Visitor(DI){};
private:
- virtual void onStartCompileUnit(DWARFYAML::Unit &CU) { Length = 7; }
+ virtual void onStartCompileUnit(DWARFYAML::Unit &CU) {
+ // Size of the unit header, excluding the length field itself.
+ Length = CU.Version >= 5 ? 8 : 7;
+ }
virtual void onEndCompileUnit(DWARFYAML::Unit &CU) {
CU.Length.setLength(Length);
OpenPOWER on IntegriCloud