Skip to content

Commit

Permalink
Improve stack trace symbolization. Fix Vector35#631
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 committed Oct 18, 2024
1 parent 3634f7e commit 8c9c129
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions core/debuggerstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,37 @@ void DebuggerThreads::SymbolizeFrames(std::vector<DebugFrame>& frames)
if (!func)
continue;

frame.m_functionStart = func->GetStart();
auto symbol = func->GetSymbol();
if (symbol)
frame.m_functionName = symbol->GetShortName();
if (func->GetStart() != frame.m_functionStart)
{
// Found a better function start from the analysis, use it
frame.m_functionStart = func->GetStart();
auto symbol = func->GetSymbol();
if (symbol)
frame.m_functionName = symbol->GetShortName();
else
frame.m_functionName = fmt::format("sub_{:x}", func->GetStart());
}
else
frame.m_functionName = fmt::format("sub_{:x}", func->GetStart());

{
std::string symName;
auto symbol = func->GetSymbol();
if (symbol)
symName = symbol->GetShortName();

auto defaultName = fmt::format("sub_{:x}", func->GetStart());
if (frame.m_functionName.empty())
{
if (!symName.empty())
frame.m_functionName = symName;
else
frame.m_functionName = defaultName;
}
else
{
if ((!symName.empty()) && symName != defaultName)
frame.m_functionName = symName;
}
}
continue;
}
}
Expand Down

0 comments on commit 8c9c129

Please sign in to comment.