[compiler-rt] [rtsan] Only print out unique stack traces (PR #110028)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 11:19:43 PDT 2024


================
@@ -49,7 +50,21 @@ static auto OnViolationAction(DiagnosticsInfo info) {
   return [info]() {
     IncrementTotalErrorCount();
 
-    PrintDiagnostics(info);
+    BufferedStackTrace stack;
+    stack.Unwind(info.pc, info.bp, nullptr,
+                 /*request_fast*/ true);
+
+    StackDepotHandle handle = StackDepotPut_WithHandle(stack);
+
+    const bool is_stack_novel = handle.use_count() == 0;
+    if (UNLIKELY(is_stack_novel)) {
----------------
vitalybuka wrote:

How many OnViolationAction calls you expect in normal runs? I would expect 0 or a few, so `if (is_stack_novel) {` should be totally fine here.

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


More information about the llvm-commits mailing list