]> granicus.if.org Git - llvm/commitdiff
DWARF parser: since DWARF4, DW_AT_high_pc may be a constant representing function...
authorAlexey Samsonov <samsonov@google.com>
Mon, 28 Oct 2013 23:15:15 +0000 (23:15 +0000)
committerAlexey Samsonov <samsonov@google.com>
Mon, 28 Oct 2013 23:15:15 +0000 (23:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193555 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DebugInfo/DWARFDebugInfoEntry.cpp

index e8b8748a9d73499b7c6364cd48c7ba00598acd57..3383cee0806875490f863bddd4fc8c34e17a7c6a 100644 (file)
@@ -258,11 +258,17 @@ uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsSectionOffset(
 bool DWARFDebugInfoEntryMinimal::getLowAndHighPC(const DWARFUnit *U,
                                                  uint64_t &LowPC,
                                                  uint64_t &HighPC) const {
-  HighPC = -1ULL;
   LowPC = getAttributeValueAsAddress(U, DW_AT_low_pc, -1ULL);
-  // FIXME: Check if HighPC is of class constant (it has different semantics).
-  if (LowPC != -1ULL)
-    HighPC = getAttributeValueAsAddress(U, DW_AT_high_pc, -1ULL);
+  if (LowPC == -1ULL)
+    return false;
+  HighPC = getAttributeValueAsAddress(U, DW_AT_high_pc, -1ULL);
+  if (HighPC == -1ULL) {
+    // Since DWARF4, DW_AT_high_pc may also be of class constant, in which case
+    // it represents function size.
+    HighPC = getAttributeValueAsUnsignedConstant(U, DW_AT_high_pc, -1ULL);
+    if (HighPC != -1ULL)
+      HighPC += LowPC;
+  }
   return (HighPC != -1ULL);
 }