diff options
author | Michael Pozulp <pozulp.llvm@gmail.com> | 2019-07-30 05:28:26 +0000 |
---|---|---|
committer | Michael Pozulp <pozulp.llvm@gmail.com> | 2019-07-30 05:28:26 +0000 |
commit | b1cbe51bdf44098c74f5c74b7bcd8c041a7c6772 (patch) | |
tree | 588f18be5fd52bedb0f539699d9df998de34a565 /llvm/lib | |
parent | f940d859589faf3b769449be8d55304b0e2f0ba9 (diff) | |
download | bcm5719-llvm-b1cbe51bdf44098c74f5c74b7bcd8c041a7c6772.tar.gz bcm5719-llvm-b1cbe51bdf44098c74f5c74b7bcd8c041a7c6772.zip |
[llvm-objdump] Add warning messages if disassembly + source for problematic inputs
Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905
Reviewers: jhenderson, rupprecht, grimar
Reviewed By: jhenderson, grimar
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62462
llvm-svn: 367284
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp | 17 |
2 files changed, 7 insertions, 12 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index b7bb9c2347a..ce376827e7f 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -1118,8 +1118,8 @@ DILineInfoTable DWARFContext::getLineInfoForAddressRange( if (!CU) return Lines; - std::string FunctionName = "<invalid>"; uint32_t StartLine = 0; + std::string FunctionName(DILineInfo::BadString); getFunctionNameAndStartLineForAddress(CU, Address.Address, Spec.FNKind, FunctionName, StartLine); diff --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp index b2bfef25148..b1a80cbc458 100644 --- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp +++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp @@ -30,11 +30,6 @@ namespace llvm { namespace symbolize { -// By default, DILineInfo contains "<invalid>" for function/filename it -// cannot fetch. We replace it to "??" to make our output closer to addr2line. -static const char kDILineInfoBadString[] = "<invalid>"; -static const char kBadString[] = "??"; - // Prints source code around in the FileName the Line. void DIPrinter::printContext(const std::string &FileName, int64_t Line) { if (PrintSourceContext <= 0) @@ -68,16 +63,16 @@ void DIPrinter::printContext(const std::string &FileName, int64_t Line) { void DIPrinter::print(const DILineInfo &Info, bool Inlined) { if (PrintFunctionNames) { std::string FunctionName = Info.FunctionName; - if (FunctionName == kDILineInfoBadString) - FunctionName = kBadString; + if (FunctionName == DILineInfo::BadString) + FunctionName = DILineInfo::Addr2LineBadString; StringRef Delimiter = PrintPretty ? " at " : "\n"; StringRef Prefix = (PrintPretty && Inlined) ? " (inlined by) " : ""; OS << Prefix << FunctionName << Delimiter; } std::string Filename = Info.FileName; - if (Filename == kDILineInfoBadString) - Filename = kBadString; + if (Filename == DILineInfo::BadString) + Filename = DILineInfo::Addr2LineBadString; else if (Basenames) Filename = llvm::sys::path::filename(Filename); if (!Verbose) { @@ -115,8 +110,8 @@ DIPrinter &DIPrinter::operator<<(const DIInliningInfo &Info) { DIPrinter &DIPrinter::operator<<(const DIGlobal &Global) { std::string Name = Global.Name; - if (Name == kDILineInfoBadString) - Name = kBadString; + if (Name == DILineInfo::BadString) + Name = DILineInfo::Addr2LineBadString; OS << Name << "\n"; OS << Global.Start << " " << Global.Size << "\n"; return *this; |