mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 12:50:00 +00:00
[LLVMSymbolize] Simplify SymbolizableObjectFile::symbolizeInlinedCode(). NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5f6abbdbfd
commit
9452d6e487
@ -57,6 +57,10 @@ class DIInliningInfo {
|
||||
assert(Index < Frames.size());
|
||||
return Frames[Index];
|
||||
}
|
||||
DILineInfo *getMutableFrame(unsigned Index) {
|
||||
assert(Index < Frames.size());
|
||||
return &Frames[Index];
|
||||
}
|
||||
uint32_t getNumberOfFrames() const {
|
||||
return Frames.size();
|
||||
}
|
||||
|
@ -217,26 +217,18 @@ DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
|
||||
if (InlinedContext.getNumberOfFrames() == 0)
|
||||
InlinedContext.addFrame(DILineInfo());
|
||||
|
||||
if (FNKind != FunctionNameKind::LinkageName || !UseSymbolTable)
|
||||
return InlinedContext;
|
||||
|
||||
// Override the function name in lower frame with name from symbol table.
|
||||
// We can't directly change the last element of DIInliningInfo, so copy
|
||||
// all frames into new context, replacing function name in the last one.
|
||||
DIInliningInfo PatchedInlinedContext;
|
||||
for (uint32_t i = 0, n = InlinedContext.getNumberOfFrames(); i < n; i++) {
|
||||
DILineInfo LineInfo = InlinedContext.getFrame(i);
|
||||
if (i == n - 1) {
|
||||
std::string FunctionName;
|
||||
uint64_t Start, Size;
|
||||
if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
|
||||
FunctionName, Start, Size)) {
|
||||
LineInfo.FunctionName = FunctionName;
|
||||
}
|
||||
if (FNKind == FunctionNameKind::LinkageName && UseSymbolTable) {
|
||||
std::string FunctionName;
|
||||
uint64_t Start, Size;
|
||||
if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
|
||||
FunctionName, Start, Size)) {
|
||||
InlinedContext.getMutableFrame(InlinedContext.getNumberOfFrames() - 1)
|
||||
->FunctionName = FunctionName;
|
||||
}
|
||||
PatchedInlinedContext.addFrame(LineInfo);
|
||||
}
|
||||
return PatchedInlinedContext;
|
||||
|
||||
return InlinedContext;
|
||||
}
|
||||
|
||||
DIGlobal SymbolizableObjectFile::symbolizeData(uint64_t ModuleOffset) const {
|
||||
|
Loading…
Reference in New Issue
Block a user