diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2015-10-30 00:40:20 +0000 |
|---|---|---|
| committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-10-30 00:40:20 +0000 |
| commit | 46c1ce6ff5aecd4a101f5b609c88f88f4ae06695 (patch) | |
| tree | 14feac5dfe28013d3724365b307b5683608a8cbd /llvm/lib/DebugInfo | |
| parent | e31e67719cb16d8f3d4280ace700582ae5811f90 (diff) | |
| download | bcm5719-llvm-46c1ce6ff5aecd4a101f5b609c88f88f4ae06695.tar.gz bcm5719-llvm-46c1ce6ff5aecd4a101f5b609c88f88f4ae06695.zip | |
Let the users of LLVMSymbolizer decide whether they want to symbolize inlined frames.
Introduce LLVMSymbolizer::symbolizeInlinedCode() instead of switching
on PrintInlining option passed to the constructor. This will be needed
once we retrun structured data (instead of std::string) from
LLVMSymbolizer and move printing logic out.
llvm-svn: 251675
Diffstat (limited to 'llvm/lib/DebugInfo')
| -rw-r--r-- | llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 87f76eda6c7..2e6f60416a4 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -73,23 +73,27 @@ std::string LLVMSymbolizer::symbolizeCode(const std::string &ModuleName, if (Opts.RelativeAddresses) ModuleOffset += Info->getModulePreferredBase(); - if (Opts.PrintInlining) { - DIInliningInfo InlinedContext = Info->symbolizeInlinedCode( - ModuleOffset, Opts.PrintFunctions, Opts.UseSymbolTable); - uint32_t FramesNum = InlinedContext.getNumberOfFrames(); - assert(FramesNum > 0); - std::string Result; - for (uint32_t i = 0; i < FramesNum; i++) { - DILineInfo LineInfo = InlinedContext.getFrame(i); - Result += printDILineInfo(LineInfo, Info); - } - return Result; - } DILineInfo LineInfo = Info->symbolizeCode(ModuleOffset, Opts.PrintFunctions, Opts.UseSymbolTable); return printDILineInfo(LineInfo, Info); } +std::string LLVMSymbolizer::symbolizeInlinedCode(const std::string &ModuleName, + uint64_t ModuleOffset) { + SymbolizableModule *Info = getOrCreateModuleInfo(ModuleName); + if (!Info) + return printDIInliningInfo(DIInliningInfo(), nullptr); + + // If the user is giving us relative addresses, add the preferred base of the + // object to the offset before we do the query. It's what DIContext expects. + if (Opts.RelativeAddresses) + ModuleOffset += Info->getModulePreferredBase(); + + DIInliningInfo InlinedContext = Info->symbolizeInlinedCode( + ModuleOffset, Opts.PrintFunctions, Opts.UseSymbolTable); + return printDIInliningInfo(InlinedContext, Info); +} + std::string LLVMSymbolizer::symbolizeData(const std::string &ModuleName, uint64_t ModuleOffset) { if (Opts.UseSymbolTable) { @@ -375,6 +379,20 @@ LLVMSymbolizer::printDILineInfo(DILineInfo LineInfo, } std::string +LLVMSymbolizer::printDIInliningInfo(DIInliningInfo InlinedContext, + const SymbolizableModule *ModInfo) const { + uint32_t FramesNum = InlinedContext.getNumberOfFrames(); + if (FramesNum == 0) + return printDILineInfo(DILineInfo(), ModInfo); + std::string Result; + for (uint32_t i = 0; i < FramesNum; i++) { + DILineInfo LineInfo = InlinedContext.getFrame(i); + Result += printDILineInfo(LineInfo, ModInfo); + } + return Result; +} + +std::string LLVMSymbolizer::printDIGlobal(DIGlobal Global, const SymbolizableModule *ModInfo) const { std::stringstream Result; |

