Skip to content

[llvm-gsymutil] Fix dumping of call sites for merged functions #119759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ class GsymReader {
/// \param OS The output stream to dump to.
///
/// \param CSIC The CallSiteInfoCollection object to dump.
void dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC);
///
/// \param Indent The indentation as number of spaces. Used when dumping as an
/// item from within MergedFunctionsInfo.
void dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC,
uint32_t Indent = 0);

/// Dump a LineTable object.
///
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ StringMap<FunctionInfo *> CallSiteInfoLoader::buildFunctionMap() {
StringMap<FunctionInfo *> FuncMap;
for (auto &Func : Funcs) {
FuncMap.try_emplace(GCreator.getString(Func.Name), &Func);
if (auto MFuncs = Func.MergedFunctions)
if (auto &MFuncs = Func.MergedFunctions)
for (auto &MFunc : MFuncs->MergedFunctions)
FuncMap.try_emplace(GCreator.getString(MFunc.Name), &MFunc);
}
Expand Down
13 changes: 8 additions & 5 deletions llvm/lib/DebugInfo/GSYM/GsymReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,13 @@ void GsymReader::dump(raw_ostream &OS, const FunctionInfo &FI,
if (FI.Inline)
dump(OS, *FI.Inline, Indent);

if (FI.CallSites)
dump(OS, *FI.CallSites, Indent);

if (FI.MergedFunctions) {
assert(Indent == 0 && "MergedFunctionsInfo should only exist at top level");
dump(OS, *FI.MergedFunctions);
}

if (FI.CallSites)
dump(OS, *FI.CallSites);
}

void GsymReader::dump(raw_ostream &OS, const MergedFunctionsInfo &MFI) {
Expand Down Expand Up @@ -454,10 +454,13 @@ void GsymReader::dump(raw_ostream &OS, const CallSiteInfo &CSI) {
}
}

void GsymReader::dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC) {
void GsymReader::dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC,
uint32_t Indent) {
OS.indent(Indent);
OS << "CallSites (by relative return offset):\n";
for (const auto &CS : CSIC.CallSites) {
OS.indent(2);
OS.indent(Indent);
OS << " ";
dump(OS, CS);
OS << "\n";
}
Expand Down
Loading
Loading