[compiler-rt] r355381 - [NFC] Simplify BufferedStackTrace::UnwindImpl

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 21:52:34 PST 2019


Author: vitalybuka
Date: Mon Mar  4 21:52:34 2019
New Revision: 355381

URL: http://llvm.org/viewvc/llvm-project?rev=355381&view=rev
Log:
[NFC] Simplify BufferedStackTrace::UnwindImpl

Modified:
    compiler-rt/trunk/lib/asan/asan_stack.cc

Modified: compiler-rt/trunk/lib/asan/asan_stack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.cc?rev=355381&r1=355380&r2=355381&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_stack.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_stack.cc Mon Mar  4 21:52:34 2019
@@ -59,31 +59,22 @@ void __sanitizer::BufferedStackTrace::Un
   size = 0;
   if (UNLIKELY(!asan_inited))
     return;
-#if SANITIZER_WINDOWS
-  Unwind(max_depth, pc, bp, context, 0, 0, false);
-#else
+  request_fast = StackTrace::WillUseFastUnwind(request_fast);
   AsanThread *t = GetCurrentThread();
   ScopedUnwinding unwind_scope(t);
   if (!unwind_scope.CanUnwind())
     return;
-  if (!t) {
-    if (!request_fast) {
-      /* If GetCurrentThread() has failed, try to do slow unwind anyways. */
-      Unwind(max_depth, pc, bp, context, 0, 0, false);
+  if (request_fast) {
+    if (t) {
+      Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(),
+             true);
     }
     return;
   }
-
-  uptr stack_top = t->stack_top();
-  uptr stack_bottom = t->stack_bottom();
-
-  if (SANITIZER_MIPS && !IsValidFrame(bp, stack_top, stack_bottom))
+  if (SANITIZER_MIPS && t &&
+      !IsValidFrame(bp, t->stack_top(), t->stack_bottom()))
     return;
-  if (StackTrace::WillUseFastUnwind(request_fast))
-    Unwind(max_depth, pc, bp, nullptr, stack_top, stack_bottom, true);
-  else
-    Unwind(max_depth, pc, bp, context, 0, 0, false);
-#endif // SANITIZER_WINDOWS
+  Unwind(max_depth, pc, bp, context, 0, 0, false);
 }
 
 // ------------------ Interface -------------- {{{1




More information about the llvm-commits mailing list