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

Stephen Tozer via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 14:06:52 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
----------------
SLTozer wrote:

Possibly - my goal to start off here was to keep this as "out of the way" as possible, by purely inserting new code into conditionally compiled blocks whenever possible; I can see if there's a clean way to share the code.

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


More information about the cfe-commits mailing list