[PATCH] D27885: Make a function to correctly extract the DW_AT_high_pc given the low pc value.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 18 08:22:39 PST 2016


aprantl added inline comments.


================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:266
     return false;
-
-  if (auto HighPCVal = getAttributeValueAsAddress(DW_AT_high_pc)) {
-    // High PC is an address.
-    HighPC = *HighPCVal;
-  } else if (auto Offset = getAttributeValueAsUnsignedConstant(DW_AT_high_pc)) {
-    // High PC is an offset from LowPC.
-    HighPC = LowPC + *Offset;
-  } else
-    return false;
-  return true;
+  LowPC = *LowPcAddr;
+  if (auto HighPcAddr = getHighPC(LowPC)) {
----------------
should the update be atomically (ie. only update if highpc is available, too)?


================
Comment at: tools/dsymutil/DwarfLinker.cpp:2145
   // Replace the debug map range with a more accurate one.
-  Ranges[*LowPc] = std::make_pair(HighPc, MyInfo.AddrAdjust);
-  Unit.addFunctionRange(*LowPc, HighPc, MyInfo.AddrAdjust);
+  Ranges[*LowPc] = std::make_pair(*HighPc, MyInfo.AddrAdjust);
+  Unit.addFunctionRange(*LowPc, *HighPc, MyInfo.AddrAdjust);
----------------
I think MSVC now also understands 
`Ranges[*LowPc] = { *HighPc, MyInfo.AddrAdjust };`


https://reviews.llvm.org/D27885





More information about the llvm-commits mailing list