[compiler-rt] f74ce00 - [tsan] Fallback to top frame (#77145)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 14:48:41 PST 2024


Author: Vitaly Buka
Date: 2024-01-05T14:48:37-08:00
New Revision: f74ce000752d565dbd9d6fcc1e2ed7f49ff7e398

URL: https://github.com/llvm/llvm-project/commit/f74ce000752d565dbd9d6fcc1e2ed7f49ff7e398
DIFF: https://github.com/llvm/llvm-project/commit/f74ce000752d565dbd9d6fcc1e2ed7f49ff7e398.diff

LOG: [tsan] Fallback to top frame (#77145)

Probably it's not important, as it should not happen often,
but if all frames are internal we should pick top, not
the bottom frame.

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_report.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
index cdcc20b9758f48..c6b764bd891752 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
@@ -275,7 +275,7 @@ static ReportStack *ChooseSummaryStack(const ReportDesc *rep) {
 
 static bool FrameIsInternal(const SymbolizedStack *frame) {
   if (!frame)
-    return false;
+    return true;
   const char *file = frame->info.file;
   const char *module = frame->info.module;
   if (file && (internal_strstr(file, "/compiler-rt/lib/")))
@@ -286,9 +286,10 @@ static bool FrameIsInternal(const SymbolizedStack *frame) {
 }
 
 static SymbolizedStack *SkipTsanInternalFrames(SymbolizedStack *frames) {
-  while (FrameIsInternal(frames) && frames->next)
-    frames = frames->next;
-  return frames;
+  for (SymbolizedStack *f = frames; f; f = f->next)
+    if (!FrameIsInternal(f))
+      return f;
+  return frames;  // Fallback to the top frame.
 }
 
 void PrintReport(const ReportDesc *rep) {


        


More information about the llvm-commits mailing list