[compiler-rt] r317773 - [msan] Add context argument into GetStackTrace

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 23:48:53 PST 2017


Author: vitalybuka
Date: Wed Nov  8 23:48:53 2017
New Revision: 317773

URL: http://llvm.org/viewvc/llvm-project?rev=317773&view=rev
Log:
[msan] Add context argument into GetStackTrace

Modified:
    compiler-rt/trunk/lib/msan/msan.cc
    compiler-rt/trunk/lib/msan/msan.h

Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=317773&r1=317772&r2=317773&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Wed Nov  8 23:48:53 2017
@@ -218,14 +218,14 @@ static void InitializeFlags() {
 }
 
 void GetStackTrace(BufferedStackTrace *stack, uptr max_s, uptr pc, uptr bp,
-                   bool request_fast_unwind) {
+                   void *context, bool request_fast_unwind) {
   MsanThread *t = GetCurrentThread();
   if (!t || !StackTrace::WillUseFastUnwind(request_fast_unwind)) {
     // Block reports from our interceptors during _Unwind_Backtrace.
     SymbolizerScope sym_scope;
-    return stack->Unwind(max_s, pc, bp, nullptr, 0, 0, request_fast_unwind);
+    return stack->Unwind(max_s, pc, bp, context, 0, 0, request_fast_unwind);
   }
-  stack->Unwind(max_s, pc, bp, nullptr, t->stack_top(), t->stack_bottom(),
+  stack->Unwind(max_s, pc, bp, context, t->stack_top(), t->stack_bottom(),
                 request_fast_unwind);
 }
 

Modified: compiler-rt/trunk/lib/msan/msan.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.h?rev=317773&r1=317772&r2=317773&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.h (original)
+++ compiler-rt/trunk/lib/msan/msan.h Wed Nov  8 23:48:53 2017
@@ -310,7 +310,7 @@ void PrintWarning(uptr pc, uptr bp);
 void PrintWarningWithOrigin(uptr pc, uptr bp, u32 origin);
 
 void GetStackTrace(BufferedStackTrace *stack, uptr max_s, uptr pc, uptr bp,
-                   bool request_fast_unwind);
+                   void *context, bool request_fast_unwind);
 
 void ReportUMR(StackTrace *stack, u32 origin);
 void ReportExpectedUMRNotFound(StackTrace *stack);
@@ -330,32 +330,32 @@ u32 ChainOrigin(u32 id, StackTrace *stac
 
 const int STACK_TRACE_TAG_POISON = StackTrace::TAG_CUSTOM + 1;
 
-#define GET_MALLOC_STACK_TRACE                                                 \
-  BufferedStackTrace stack;                                                    \
-  if (__msan_get_track_origins() && msan_inited)                               \
-  GetStackTrace(&stack, common_flags()->malloc_context_size,                   \
-                StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(),               \
+#define GET_MALLOC_STACK_TRACE                                            \
+  BufferedStackTrace stack;                                               \
+  if (__msan_get_track_origins() && msan_inited)                          \
+  GetStackTrace(&stack, common_flags()->malloc_context_size,              \
+                StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), nullptr, \
                 common_flags()->fast_unwind_on_malloc)
 
 // For platforms which support slow unwinder only, we restrict the store context
 // size to 1, basically only storing the current pc. We do this because the slow
 // unwinder which is based on libunwind is not async signal safe and causes
 // random freezes in forking applications as well as in signal handlers.
-#define GET_STORE_STACK_TRACE_PC_BP(pc, bp)                                    \
-  BufferedStackTrace stack;                                                    \
-  if (__msan_get_track_origins() > 1 && msan_inited) {                         \
-    if (!SANITIZER_CAN_FAST_UNWIND)                                            \
-      GetStackTrace(&stack, Min(1, flags()->store_context_size), pc, bp,       \
-                    false);                                                    \
-    else                                                                       \
-      GetStackTrace(&stack, flags()->store_context_size, pc, bp,               \
-                    common_flags()->fast_unwind_on_malloc);                    \
+#define GET_STORE_STACK_TRACE_PC_BP(pc, bp)                               \
+  BufferedStackTrace stack;                                               \
+  if (__msan_get_track_origins() > 1 && msan_inited) {                    \
+    if (!SANITIZER_CAN_FAST_UNWIND)                                       \
+      GetStackTrace(&stack, Min(1, flags()->store_context_size), pc, bp,  \
+                    nullptr, false);                                      \
+    else                                                                  \
+      GetStackTrace(&stack, flags()->store_context_size, pc, bp, nullptr, \
+                    common_flags()->fast_unwind_on_malloc);               \
   }
 
-#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp)                                    \
-  BufferedStackTrace stack;                                                    \
-  if (msan_inited)                                                             \
-  GetStackTrace(&stack, kStackTraceMax, pc, bp,                                \
+#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp)              \
+  BufferedStackTrace stack;                              \
+  if (msan_inited)                                       \
+  GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr, \
                 common_flags()->fast_unwind_on_fatal)
 
 #define GET_STORE_STACK_TRACE \




More information about the llvm-commits mailing list