aboutsummaryrefslogtreecommitdiffstats
path: root/lib/DebugInfo
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-10-28 23:15:15 +0000
committerAlexey Samsonov <samsonov@google.com>2013-10-28 23:15:15 +0000
commitd2d54e2b7c8a427cf1f4684bee335c4bedc5a99b (patch)
tree4cf1953ff29aabac39a1988a35950569a36c33b0 /lib/DebugInfo
parentc5253237f8b3b4eb888f7f85f39acd7d4d0f57cf (diff)
downloadexternal_llvm-d2d54e2b7c8a427cf1f4684bee335c4bedc5a99b.zip
external_llvm-d2d54e2b7c8a427cf1f4684bee335c4bedc5a99b.tar.gz
external_llvm-d2d54e2b7c8a427cf1f4684bee335c4bedc5a99b.tar.bz2
DWARF parser: since DWARF4, DW_AT_high_pc may be a constant representing function size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193555 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r--lib/DebugInfo/DWARFDebugInfoEntry.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/lib/DebugInfo/DWARFDebugInfoEntry.cpp
index e8b8748..3383cee 100644
--- a/lib/DebugInfo/DWARFDebugInfoEntry.cpp
+++ b/lib/DebugInfo/DWARFDebugInfoEntry.cpp
@@ -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);
}