Skip to content

Commit 1961138

Browse files
author
Alex B
committed
[llvm-gsymutil] Improve dumping of callsites for merged functions
1 parent 92a15dd commit 1961138

File tree

4 files changed

+1539
-7
lines changed

4 files changed

+1539
-7
lines changed

llvm/include/llvm/DebugInfo/GSYM/GsymReader.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ class GsymReader {
199199
/// \param OS The output stream to dump to.
200200
///
201201
/// \param CSIC The CallSiteInfoCollection object to dump.
202-
void dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC);
202+
///
203+
/// \param Indent The indentation as number of spaces. Used when dumping as an
204+
/// item from within MergedFunctionsInfo.
205+
void dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC,
206+
uint32_t Indent = 0);
203207

204208
/// Dump a LineTable object.
205209
///

llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ StringMap<FunctionInfo *> CallSiteInfoLoader::buildFunctionMap() {
181181
StringMap<FunctionInfo *> FuncMap;
182182
for (auto &Func : Funcs) {
183183
FuncMap.try_emplace(GCreator.getString(Func.Name), &Func);
184-
if (auto MFuncs = Func.MergedFunctions)
184+
if (auto &MFuncs = Func.MergedFunctions)
185185
for (auto &MFunc : MFuncs->MergedFunctions)
186186
FuncMap.try_emplace(GCreator.getString(MFunc.Name), &MFunc);
187187
}

llvm/lib/DebugInfo/GSYM/GsymReader.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,13 @@ void GsymReader::dump(raw_ostream &OS, const FunctionInfo &FI,
406406
if (FI.Inline)
407407
dump(OS, *FI.Inline, Indent);
408408

409+
if (FI.CallSites)
410+
dump(OS, *FI.CallSites, Indent);
411+
409412
if (FI.MergedFunctions) {
410413
assert(Indent == 0 && "MergedFunctionsInfo should only exist at top level");
411414
dump(OS, *FI.MergedFunctions);
412415
}
413-
414-
if (FI.CallSites)
415-
dump(OS, *FI.CallSites);
416416
}
417417

418418
void GsymReader::dump(raw_ostream &OS, const MergedFunctionsInfo &MFI) {
@@ -454,10 +454,13 @@ void GsymReader::dump(raw_ostream &OS, const CallSiteInfo &CSI) {
454454
}
455455
}
456456

457-
void GsymReader::dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC) {
457+
void GsymReader::dump(raw_ostream &OS, const CallSiteInfoCollection &CSIC,
458+
uint32_t Indent) {
459+
OS.indent(Indent);
458460
OS << "CallSites (by relative return offset):\n";
459461
for (const auto &CS : CSIC.CallSites) {
460-
OS.indent(2);
462+
OS.indent(Indent);
463+
OS << " ";
461464
dump(OS, CS);
462465
OS << "\n";
463466
}

0 commit comments

Comments
 (0)