[PATCH] D58861: [NFC][Sanitizer] Cleanup ASan's GetStackTrace implementation

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 21:59:23 PST 2019


vitalybuka updated this revision to Diff 189276.
vitalybuka added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58861/new/

https://reviews.llvm.org/D58861

Files:
  compiler-rt/lib/asan/asan_stack.cc
  compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h


Index: compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
@@ -134,6 +134,13 @@
   void UnwindSlow(uptr pc, u32 max_depth);
   void UnwindSlow(uptr pc, void *context, u32 max_depth);
 
+  void UnwindSlowWithOptionalContext(uptr pc, void *context, u32 max_depth) {
+    if (context)
+      UnwindSlow(pc, context, max_depth);
+    else
+      UnwindSlow(pc, max_depth);
+  }
+
   void PopStackFrames(uptr count);
   uptr LocatePcInTrace(uptr pc);
 
Index: compiler-rt/lib/asan/asan_stack.cc
===================================================================
--- compiler-rt/lib/asan/asan_stack.cc
+++ compiler-rt/lib/asan/asan_stack.cc
@@ -65,16 +65,16 @@
   if (!unwind_scope.CanUnwind())
     return;
   if (request_fast) {
-    if (t) {
-      Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(),
-             true);
-    }
+    if (t)
+      UnwindFast(pc, bp, t->stack_top(), t->stack_bottom(), max_depth);
     return;
   }
   if (SANITIZER_MIPS && t &&
       !IsValidFrame(bp, t->stack_top(), t->stack_bottom()))
     return;
-  Unwind(max_depth, pc, bp, context, 0, 0, false);
+#if SANITIZER_CAN_SLOW_UNWIND
+  UnwindSlowWithOptionalContext(pc, context, max_depth);
+#endif
 }
 
 // ------------------ Interface -------------- {{{1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58861.189276.patch
Type: text/x-patch
Size: 1451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190305/9618cf08/attachment.bin>


More information about the llvm-commits mailing list