diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-10-28 23:15:15 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-10-28 23:15:15 +0000 |
commit | 7614212fd1ad193d6f195d4b560cc073d11fc9d4 (patch) | |
tree | 38b9f18b05073329d2e8eb503260efc44279da2f /llvm | |
parent | a839855b5683cd80476eee736573787c2aae7484 (diff) | |
download | bcm5719-llvm-7614212fd1ad193d6f195d4b560cc073d11fc9d4.tar.gz bcm5719-llvm-7614212fd1ad193d6f195d4b560cc073d11fc9d4.zip |
DWARF parser: since DWARF4, DW_AT_high_pc may be a constant representing function size
llvm-svn: 193555
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp index e8b8748a9d7..3383cee0806 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/llvm/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); } |