[clang] [llvm] [DLCov 3/5] Implement DebugLoc origin-tracking (PR #107369)

J. Ryan Stinnett via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 10:30:47 PDT 2024


================
@@ -253,6 +253,122 @@ static bool printSymbolizedStackTrace(StringRef Argv0, void **StackTrace,
   return true;
 }
 
+#if ENABLE_DEBUGLOC_ORIGIN_TRACKING
+void sys::symbolizeAddresses(AddressSet &Addresses,
+                             SymbolizedAddressMap &SymbolizedAddresses) {
+  assert(!DisableSymbolicationFlag && !getenv(DisableSymbolizationEnv) &&
+         "Debugify origin stacktraces require symbolization to be enabled.");
+
+  // Convert Set of Addresses to ordered list.
+  SmallVector<void *, 0> AddressList(Addresses.begin(), Addresses.end());
+  if (AddressList.empty())
+    return;
+  int NumAddresses = AddressList.size();
+  llvm::sort(AddressList);
+
+  // Use llvm-symbolizer tool to symbolize the stack traces. First look for it
----------------
jryans wrote:

It seems like this copies code from `printSymbolizedStackTrace` above...? Can we rework this to share common code instead of duplicating it?

https://github.com/llvm/llvm-project/pull/107369


More information about the cfe-commits mailing list