diff options
author | Alexey Lapshin <a.v.lapshin@mail.ru> | 2019-02-27 13:17:36 +0000 |
---|---|---|
committer | Alexey Lapshin <a.v.lapshin@mail.ru> | 2019-02-27 13:17:36 +0000 |
commit | 77fc1f6049a7414ec193c9ff8226eeb5662a5878 (patch) | |
tree | b2bffed96e676b25942dbe39194e0f08a153f638 /llvm/lib/DebugInfo/PDB/PDBContext.cpp | |
parent | ef920358277603c69f4f548d2e5c40842972dd71 (diff) | |
download | bcm5719-llvm-77fc1f6049a7414ec193c9ff8226eeb5662a5878.tar.gz bcm5719-llvm-77fc1f6049a7414ec193c9ff8226eeb5662a5878.zip |
[DebugInfo] add SectionedAddress to DebugInfo interfaces.
That patch is the fix for https://bugs.llvm.org/show_bug.cgi?id=40703
"wrong line number info for obj file compiled with -ffunction-sections"
bug. The problem happened with only .o files. If object file contains
several .text sections then line number information showed incorrectly.
The reason for this is that DwarfLineTable could not detect section which
corresponds to specified address(because address is the local to the
section). And as the result it could not select proper sequence in the
line table. The fix is to pass SectionIndex with the address. So that it
would be possible to differentiate addresses from various sections. With
this fix llvm-objdump shows correct line numbers for disassembled code.
Differential review: https://reviews.llvm.org/D58194
llvm-svn: 354972
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDBContext.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBContext.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/llvm/lib/DebugInfo/PDB/PDBContext.cpp index 6d030d4aeda..89c20e67413 100644 --- a/llvm/lib/DebugInfo/PDB/PDBContext.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBContext.cpp @@ -30,14 +30,14 @@ PDBContext::PDBContext(const COFFObjectFile &Object, void PDBContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts){} -DILineInfo PDBContext::getLineInfoForAddress(uint64_t Address, +DILineInfo PDBContext::getLineInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier) { DILineInfo Result; - Result.FunctionName = getFunctionName(Address, Specifier.FNKind); + Result.FunctionName = getFunctionName(Address.Address, Specifier.FNKind); uint32_t Length = 1; std::unique_ptr<PDBSymbol> Symbol = - Session->findSymbolByAddress(Address, PDB_SymType::None); + Session->findSymbolByAddress(Address.Address, PDB_SymType::None); if (auto Func = dyn_cast_or_null<PDBSymbolFunc>(Symbol.get())) { Length = Func->getLength(); } else if (auto Data = dyn_cast_or_null<PDBSymbolData>(Symbol.get())) { @@ -46,7 +46,7 @@ DILineInfo PDBContext::getLineInfoForAddress(uint64_t Address, // If we couldn't find a symbol, then just assume 1 byte, so that we get // only the line number of the first instruction. - auto LineNumbers = Session->findLineNumbersByAddress(Address, Length); + auto LineNumbers = Session->findLineNumbersByAddress(Address.Address, Length); if (!LineNumbers || LineNumbers->getChildCount() == 0) return Result; @@ -63,26 +63,27 @@ DILineInfo PDBContext::getLineInfoForAddress(uint64_t Address, } DILineInfoTable -PDBContext::getLineInfoForAddressRange(uint64_t Address, uint64_t Size, +PDBContext::getLineInfoForAddressRange(object::SectionedAddress Address, + uint64_t Size, DILineInfoSpecifier Specifier) { if (Size == 0) return DILineInfoTable(); DILineInfoTable Table; - auto LineNumbers = Session->findLineNumbersByAddress(Address, Size); + auto LineNumbers = Session->findLineNumbersByAddress(Address.Address, Size); if (!LineNumbers || LineNumbers->getChildCount() == 0) return Table; while (auto LineInfo = LineNumbers->getNext()) { - DILineInfo LineEntry = - getLineInfoForAddress(LineInfo->getVirtualAddress(), Specifier); + DILineInfo LineEntry = getLineInfoForAddress( + {LineInfo->getVirtualAddress(), Address.SectionIndex}, Specifier); Table.push_back(std::make_pair(LineInfo->getVirtualAddress(), LineEntry)); } return Table; } DIInliningInfo -PDBContext::getInliningInfoForAddress(uint64_t Address, +PDBContext::getInliningInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier) { DIInliningInfo InlineInfo; DILineInfo Frame = getLineInfoForAddress(Address, Specifier); |