summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-04-18 22:22:44 +0000
committerAlexey Samsonov <samsonov@google.com>2014-04-18 22:22:44 +0000
commite0d2d7fb26a2dac464f6e245594176a2a7f1ccf7 (patch)
tree94d42a9b65ae304aff4453b7b1e3d3d013f6f150 /lib
parent1c60993799ad7ade9eea6f2603525d2086e90729 (diff)
downloadllvm-e0d2d7fb26a2dac464f6e245594176a2a7f1ccf7.tar.gz
llvm-e0d2d7fb26a2dac464f6e245594176a2a7f1ccf7.tar.bz2
llvm-e0d2d7fb26a2dac464f6e245594176a2a7f1ccf7.tar.xz
[llvm-symbolizer] Print file/line for a PC even if there is no DIE describing it.
This is important for symbolizing executables with debug info in unavailable .dwo files. Even if all DIE entries are missing, we can still symbolize an address: function name can be fetched from symbol table, and file/line info can be fetched from line table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206665 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/DebugInfo/DWARFContext.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp
index 50ec4d3cb4..148d56800f 100644
--- a/lib/DebugInfo/DWARFContext.cpp
+++ b/lib/DebugInfo/DWARFContext.cpp
@@ -545,18 +545,32 @@ DILineInfoTable DWARFContext::getLineInfoForAddressRange(uint64_t Address,
DIInliningInfo DWARFContext::getInliningInfoForAddress(uint64_t Address,
DILineInfoSpecifier Specifier) {
+ DIInliningInfo InliningInfo;
+
DWARFCompileUnit *CU = getCompileUnitForAddress(Address);
if (!CU)
- return DIInliningInfo();
+ return InliningInfo;
+ const DWARFLineTable *LineTable = nullptr;
+ const bool NeedsAbsoluteFilePath =
+ Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);
const DWARFDebugInfoEntryInlinedChain &InlinedChain =
CU->getInlinedChainForAddress(Address);
- if (InlinedChain.DIEs.size() == 0)
- return DIInliningInfo();
+ if (InlinedChain.DIEs.size() == 0) {
+ // If there is no DIE for address (e.g. it is in unavailable .dwo file),
+ // try to at least get file/line info from symbol table.
+ if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {
+ DILineInfo Frame;
+ LineTable = getLineTableForCompileUnit(CU);
+ if (getFileLineInfoForCompileUnit(CU, LineTable, Address,
+ NeedsAbsoluteFilePath, Frame)) {
+ InliningInfo.addFrame(Frame);
+ }
+ }
+ return InliningInfo;
+ }
- DIInliningInfo InliningInfo;
uint32_t CallFile = 0, CallLine = 0, CallColumn = 0;
- const DWARFLineTable *LineTable = nullptr;
for (uint32_t i = 0, n = InlinedChain.DIEs.size(); i != n; i++) {
const DWARFDebugInfoEntryMinimal &FunctionDIE = InlinedChain.DIEs[i];
DILineInfo Frame;
@@ -566,16 +580,13 @@ DIInliningInfo DWARFContext::getInliningInfoForAddress(uint64_t Address,
Frame.FunctionName = Name;
}
if (Specifier.needs(DILineInfoSpecifier::FileLineInfo)) {
- const bool NeedsAbsoluteFilePath =
- Specifier.needs(DILineInfoSpecifier::AbsoluteFilePath);
if (i == 0) {
// For the topmost frame, initialize the line table of this
// compile unit and fetch file/line info from it.
LineTable = getLineTableForCompileUnit(CU);
// For the topmost routine, get file/line info from line table.
getFileLineInfoForCompileUnit(CU, LineTable, Address,
- NeedsAbsoluteFilePath,
- Frame);
+ NeedsAbsoluteFilePath, Frame);
} else {
// Otherwise, use call file, call line and call column from
// previous DIE in inlined chain.