aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
diff options
context:
space:
mode:
authorAlexey Lapshin <a.v.lapshin@mail.ru>2019-02-27 13:17:36 +0000
committerAlexey Lapshin <a.v.lapshin@mail.ru>2019-02-27 13:17:36 +0000
commit77fc1f6049a7414ec193c9ff8226eeb5662a5878 (patch)
treeb2bffed96e676b25942dbe39194e0f08a153f638 /llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
parentef920358277603c69f4f548d2e5c40842972dd71 (diff)
downloadllvm-77fc1f6049a7414ec193c9ff8226eeb5662a5878.zip
llvm-77fc1f6049a7414ec193c9ff8226eeb5662a5878.tar.gz
llvm-77fc1f6049a7414ec193c9ff8226eeb5662a5878.tar.bz2
[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/Symbolize/SymbolizableObjectFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
index 4f528f7..f0a9782 100644
--- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -222,9 +222,10 @@ bool SymbolizableObjectFile::shouldOverrideWithSymbolTable(
isa<DWARFContext>(DebugInfoContext.get());
}
-DILineInfo SymbolizableObjectFile::symbolizeCode(uint64_t ModuleOffset,
- FunctionNameKind FNKind,
- bool UseSymbolTable) const {
+DILineInfo
+SymbolizableObjectFile::symbolizeCode(object::SectionedAddress ModuleOffset,
+ FunctionNameKind FNKind,
+ bool UseSymbolTable) const {
DILineInfo LineInfo;
if (DebugInfoContext) {
LineInfo = DebugInfoContext->getLineInfoForAddress(
@@ -234,7 +235,7 @@ DILineInfo SymbolizableObjectFile::symbolizeCode(uint64_t ModuleOffset,
if (shouldOverrideWithSymbolTable(FNKind, UseSymbolTable)) {
std::string FunctionName;
uint64_t Start, Size;
- if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
+ if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset.Address,
FunctionName, Start, Size)) {
LineInfo.FunctionName = FunctionName;
}
@@ -243,7 +244,8 @@ DILineInfo SymbolizableObjectFile::symbolizeCode(uint64_t ModuleOffset,
}
DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
- uint64_t ModuleOffset, FunctionNameKind FNKind, bool UseSymbolTable) const {
+ object::SectionedAddress ModuleOffset, FunctionNameKind FNKind,
+ bool UseSymbolTable) const {
DIInliningInfo InlinedContext;
if (DebugInfoContext)
@@ -257,7 +259,7 @@ DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
if (shouldOverrideWithSymbolTable(FNKind, UseSymbolTable)) {
std::string FunctionName;
uint64_t Start, Size;
- if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
+ if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset.Address,
FunctionName, Start, Size)) {
InlinedContext.getMutableFrame(InlinedContext.getNumberOfFrames() - 1)
->FunctionName = FunctionName;
@@ -267,9 +269,10 @@ DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
return InlinedContext;
}
-DIGlobal SymbolizableObjectFile::symbolizeData(uint64_t ModuleOffset) const {
+DIGlobal SymbolizableObjectFile::symbolizeData(
+ object::SectionedAddress ModuleOffset) const {
DIGlobal Res;
- getNameFromSymbolTable(SymbolRef::ST_Data, ModuleOffset, Res.Name, Res.Start,
- Res.Size);
+ getNameFromSymbolTable(SymbolRef::ST_Data, ModuleOffset.Address, Res.Name,
+ Res.Start, Res.Size);
return Res;
}