[llvm] r251363 - [LLVMSymbolize] Don't use LLVMSymbolizer::Options in ModuleInfo. NFC.
Alexey Samsonov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 26 15:34:56 PDT 2015
Author: samsonov
Date: Mon Oct 26 17:34:56 2015
New Revision: 251363
URL: http://llvm.org/viewvc/llvm-project?rev=251363&view=rev
Log:
[LLVMSymbolize] Don't use LLVMSymbolizer::Options in ModuleInfo. NFC.
LLVMSymbolizer::Options is mostly used in LLVMSymbolizer class anyway.
Let's keep their usage restricted to that class, especially given that
it's worth to move ModuleInfo to a different header, independent from
the symbolizer class.
Modified:
llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h
llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h?rev=251363&r1=251362&r2=251363&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/Symbolize/Symbolize.h Mon Oct 26 17:34:56 2015
@@ -104,10 +104,11 @@ class ModuleInfo {
public:
ModuleInfo(ObjectFile *Obj, std::unique_ptr<DIContext> DICtx);
- DILineInfo symbolizeCode(uint64_t ModuleOffset,
- const LLVMSymbolizer::Options &Opts) const;
- DIInliningInfo symbolizeInlinedCode(
- uint64_t ModuleOffset, const LLVMSymbolizer::Options &Opts) const;
+ DILineInfo symbolizeCode(uint64_t ModuleOffset, FunctionNameKind FNKind,
+ bool UseSymbolTable) const;
+ DIInliningInfo symbolizeInlinedCode(uint64_t ModuleOffset,
+ FunctionNameKind FNKind,
+ bool UseSymbolTable) const;
bool symbolizeData(uint64_t ModuleOffset, std::string &Name, uint64_t &Start,
uint64_t &Size) const;
Modified: llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp?rev=251363&r1=251362&r2=251363&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp (original)
+++ llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp Mon Oct 26 17:34:56 2015
@@ -55,10 +55,9 @@ static bool error(std::error_code ec) {
}
static DILineInfoSpecifier
-getDILineInfoSpecifier(const LLVMSymbolizer::Options &Opts) {
+getDILineInfoSpecifier(FunctionNameKind FNKind) {
return DILineInfoSpecifier(
- DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
- Opts.PrintFunctions);
+ DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, FNKind);
}
ModuleInfo::ModuleInfo(ObjectFile *Obj, std::unique_ptr<DIContext> DICtx)
@@ -201,16 +200,16 @@ bool ModuleInfo::getNameFromSymbolTable(
return true;
}
-DILineInfo ModuleInfo::symbolizeCode(
- uint64_t ModuleOffset, const LLVMSymbolizer::Options &Opts) const {
+DILineInfo ModuleInfo::symbolizeCode(uint64_t ModuleOffset,
+ FunctionNameKind FNKind,
+ bool UseSymbolTable) const {
DILineInfo LineInfo;
if (DebugInfoContext) {
LineInfo = DebugInfoContext->getLineInfoForAddress(
- ModuleOffset, getDILineInfoSpecifier(Opts));
+ ModuleOffset, getDILineInfoSpecifier(FNKind));
}
// Override function name from symbol table if necessary.
- if (Opts.PrintFunctions == FunctionNameKind::LinkageName &&
- Opts.UseSymbolTable) {
+ if (FNKind == FunctionNameKind::LinkageName && UseSymbolTable) {
std::string FunctionName;
uint64_t Start, Size;
if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
@@ -221,21 +220,21 @@ DILineInfo ModuleInfo::symbolizeCode(
return LineInfo;
}
-DIInliningInfo ModuleInfo::symbolizeInlinedCode(
- uint64_t ModuleOffset, const LLVMSymbolizer::Options &Opts) const {
+DIInliningInfo ModuleInfo::symbolizeInlinedCode(uint64_t ModuleOffset,
+ FunctionNameKind FNKind,
+ bool UseSymbolTable) const {
DIInliningInfo InlinedContext;
if (DebugInfoContext) {
InlinedContext = DebugInfoContext->getInliningInfoForAddress(
- ModuleOffset, getDILineInfoSpecifier(Opts));
+ ModuleOffset, getDILineInfoSpecifier(FNKind));
}
// Make sure there is at least one frame in context.
if (InlinedContext.getNumberOfFrames() == 0) {
InlinedContext.addFrame(DILineInfo());
}
// Override the function name in lower frame with name from symbol table.
- if (Opts.PrintFunctions == FunctionNameKind::LinkageName &&
- Opts.UseSymbolTable) {
+ if (FNKind == FunctionNameKind::LinkageName && UseSymbolTable) {
DIInliningInfo PatchedInlinedContext;
for (uint32_t i = 0, n = InlinedContext.getNumberOfFrames(); i < n; i++) {
DILineInfo LineInfo = InlinedContext.getFrame(i);
@@ -274,8 +273,8 @@ std::string LLVMSymbolizer::symbolizeCod
ModuleOffset += Info->getModulePreferredBase();
if (Opts.PrintInlining) {
- DIInliningInfo InlinedContext =
- Info->symbolizeInlinedCode(ModuleOffset, Opts);
+ DIInliningInfo InlinedContext = Info->symbolizeInlinedCode(
+ ModuleOffset, Opts.PrintFunctions, Opts.UseSymbolTable);
uint32_t FramesNum = InlinedContext.getNumberOfFrames();
assert(FramesNum > 0);
std::string Result;
@@ -285,7 +284,8 @@ std::string LLVMSymbolizer::symbolizeCod
}
return Result;
}
- DILineInfo LineInfo = Info->symbolizeCode(ModuleOffset, Opts);
+ DILineInfo LineInfo = Info->symbolizeCode(ModuleOffset, Opts.PrintFunctions,
+ Opts.UseSymbolTable);
return printDILineInfo(LineInfo, Info);
}
More information about the llvm-commits
mailing list