[llvm] [llvm-gsymutil] Improve dumping of call sites for merged functions (PR #119759)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 13:08:44 PST 2024


https://github.com/alx32 created https://github.com/llvm/llvm-project/pull/119759

None

>From 1b8b97468a016c873fb92d1a1f71221e7d505fb4 Mon Sep 17 00:00:00 2001
From: Alex B <alexborcan at meta.com>
Date: Thu, 12 Dec 2024 13:08:05 -0800
Subject: [PATCH] [llvm-gsymutil] Improve dumping of callsites for merged
 functions

---
 llvm/include/llvm/DebugInfo/GSYM/GsymReader.h |  5 ++++-
 llvm/lib/DebugInfo/GSYM/GsymReader.cpp        | 10 +++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
index 72b7f3e7bfc42e..03324a45a10036 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
@@ -199,7 +199,10 @@ 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.
   ///
diff --git a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
index 7979f1f5d51928..2af7c654f5ca9a 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
@@ -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) {
@@ -454,10 +454,10 @@ 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 << "CallSites (by relative return offset):\n";
   for (const auto &CS : CSIC.CallSites) {
-    OS.indent(2);
+    OS.indent(Indent);
     dump(OS, CS);
     OS << "\n";
   }



More information about the llvm-commits mailing list