[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
diff --git a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
index 9fff1a5..c54e538 100644
--- a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -130,8 +130,8 @@
std::map<unsigned, uint64_t> BlameCounter;
- for (uint64_t Address : Analysis.getIndirectInstructions()) {
- const auto &InstrMeta = Analysis.getInstructionOrDie(Address);
+ for (object::SectionedAddress Address : Analysis.getIndirectInstructions()) {
+ const auto &InstrMeta = Analysis.getInstructionOrDie(Address.Address);
GraphResult Graph = GraphBuilder::buildFlowGraph(Analysis, Address);
CFIProtectionStatus ProtectionStatus =
@@ -153,7 +153,7 @@
auto InliningInfo = Analysis.symbolizeInlinedCode(Address);
if (!InliningInfo || InliningInfo->getNumberOfFrames() == 0) {
- errs() << "Failed to symbolise " << format_hex(Address, 2)
+ errs() << "Failed to symbolise " << format_hex(Address.Address, 2)
<< " with line tables from " << InputFilename << "\n";
exit(EXIT_FAILURE);
}
@@ -164,9 +164,9 @@
if (!Summarize) {
for (uint32_t i = 0; i < InliningInfo->getNumberOfFrames(); ++i) {
const auto &Line = InliningInfo->getFrame(i);
- outs() << " " << format_hex(Address, 2) << " = " << Line.FileName
- << ":" << Line.Line << ":" << Line.Column << " ("
- << Line.FunctionName << ")\n";
+ outs() << " " << format_hex(Address.Address, 2) << " = "
+ << Line.FileName << ":" << Line.Line << ":" << Line.Column
+ << " (" << Line.FunctionName << ")\n";
}
}