[llvm] r193555 - DWARF parser: since DWARF4, DW_AT_high_pc may be a constant representing function size

Alexey Samsonov samsonov at google.com
Mon Oct 28 16:15:15 PDT 2013


Author: samsonov
Date: Mon Oct 28 18:15:15 2013
New Revision: 193555

URL: http://llvm.org/viewvc/llvm-project?rev=193555&view=rev
Log:
DWARF parser: since DWARF4, DW_AT_high_pc may be a constant representing function size

Modified:
    llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp?rev=193555&r1=193554&r2=193555&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp Mon Oct 28 18:15:15 2013
@@ -258,11 +258,17 @@ uint64_t DWARFDebugInfoEntryMinimal::get
 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);
 }
 





More information about the llvm-commits mailing list