[compiler-rt] r317774 - [sanitizers] Rename GetStackTraceWithPcBpAndContext

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


Author: vitalybuka
Date: Wed Nov  8 23:53:06 2017
New Revision: 317774

URL: http://llvm.org/viewvc/llvm-project?rev=317774&view=rev
Log:
[sanitizers] Rename GetStackTraceWithPcBpAndContext

Name does not need to enumerate arguments.

Modified:
    compiler-rt/trunk/lib/asan/asan_errors.cc
    compiler-rt/trunk/lib/asan/asan_stack.h
    compiler-rt/trunk/lib/lsan/lsan.cc
    compiler-rt/trunk/lib/lsan/lsan.h
    compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
    compiler-rt/trunk/lib/ubsan/ubsan_diag.h
    compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc

Modified: compiler-rt/trunk/lib/asan/asan_errors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_errors.cc?rev=317774&r1=317773&r2=317774&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_errors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_errors.cc Wed Nov  8 23:53:06 2017
@@ -37,8 +37,7 @@ static void OnStackUnwind(const SignalCo
   // corresponding code in the sanitizer_common and we use this callback to
   // print it.
   static_cast<const ScarinessScoreBase *>(callback_context)->Print();
-  GetStackTraceWithPcBpAndContext(stack, kStackTraceMax, sig.pc, sig.bp,
-                                  sig.context, fast);
+  GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, sig.context, fast);
 }
 
 void ErrorDeadlySignal::Print() {

Modified: compiler-rt/trunk/lib/asan/asan_stack.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.h?rev=317774&r1=317773&r2=317774&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_stack.h (original)
+++ compiler-rt/trunk/lib/asan/asan_stack.h Wed Nov  8 23:53:06 2017
@@ -31,9 +31,8 @@ u32 GetMallocContextSize();
 // The pc will be in the position 0 of the resulting stack trace.
 // The bp may refer to the current frame or to the caller's frame.
 ALWAYS_INLINE
-void GetStackTraceWithPcBpAndContext(BufferedStackTrace *stack, uptr max_depth,
-                                     uptr pc, uptr bp, void *context,
-                                     bool fast) {
+void GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc, uptr bp,
+                   void *context, bool fast) {
 #if SANITIZER_WINDOWS
   stack->Unwind(max_depth, pc, bp, context, 0, 0, fast);
 #else
@@ -62,32 +61,29 @@ void GetStackTraceWithPcBpAndContext(Buf
 // as early as possible (in functions exposed to the user), as we generally
 // don't want stack trace to contain functions from ASan internals.
 
-#define GET_STACK_TRACE(max_size, fast)                                        \
-  BufferedStackTrace stack;                                                    \
-  if (max_size <= 2) {                                                         \
-    stack.size = max_size;                                                     \
-    if (max_size > 0) {                                                        \
-      stack.top_frame_bp = GET_CURRENT_FRAME();                                \
-      stack.trace_buffer[0] = StackTrace::GetCurrentPc();                      \
-      if (max_size > 1)                                                        \
-        stack.trace_buffer[1] = GET_CALLER_PC();                               \
-    }                                                                          \
-  } else {                                                                     \
-    GetStackTraceWithPcBpAndContext(&stack, max_size,                          \
-                                    StackTrace::GetCurrentPc(),                \
-                                    GET_CURRENT_FRAME(), 0, fast);             \
+#define GET_STACK_TRACE(max_size, fast)                          \
+  BufferedStackTrace stack;                                      \
+  if (max_size <= 2) {                                           \
+    stack.size = max_size;                                       \
+    if (max_size > 0) {                                          \
+      stack.top_frame_bp = GET_CURRENT_FRAME();                  \
+      stack.trace_buffer[0] = StackTrace::GetCurrentPc();        \
+      if (max_size > 1) stack.trace_buffer[1] = GET_CALLER_PC(); \
+    }                                                            \
+  } else {                                                       \
+    GetStackTrace(&stack, max_size, StackTrace::GetCurrentPc(),  \
+                  GET_CURRENT_FRAME(), 0, fast);                 \
   }
 
-#define GET_STACK_TRACE_FATAL(pc, bp)                                          \
-  BufferedStackTrace stack;                                                    \
-  GetStackTraceWithPcBpAndContext(&stack, kStackTraceMax, pc, bp, 0,           \
-                                  common_flags()->fast_unwind_on_fatal)
-
-#define GET_STACK_TRACE_SIGNAL(sig)                                            \
-  BufferedStackTrace stack;                                                    \
-  GetStackTraceWithPcBpAndContext(&stack, kStackTraceMax,                      \
-                                  (sig).pc, (sig).bp, (sig).context,           \
-                                  common_flags()->fast_unwind_on_fatal)
+#define GET_STACK_TRACE_FATAL(pc, bp)              \
+  BufferedStackTrace stack;                        \
+  GetStackTrace(&stack, kStackTraceMax, pc, bp, 0, \
+                common_flags()->fast_unwind_on_fatal)
+
+#define GET_STACK_TRACE_SIGNAL(sig)                                        \
+  BufferedStackTrace stack;                                                \
+  GetStackTrace(&stack, kStackTraceMax, (sig).pc, (sig).bp, (sig).context, \
+                common_flags()->fast_unwind_on_fatal)
 
 #define GET_STACK_TRACE_FATAL_HERE                                \
   GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)

Modified: compiler-rt/trunk/lib/lsan/lsan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan.cc?rev=317774&r1=317773&r2=317774&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan.cc Wed Nov  8 23:53:06 2017
@@ -70,9 +70,8 @@ static void InitializeFlags() {
 
 static void OnStackUnwind(const SignalContext &sig, const void *,
                           BufferedStackTrace *stack) {
-  GetStackTraceWithPcBpAndContext(stack, kStackTraceMax, sig.pc, sig.bp,
-                                  sig.context,
-                                  common_flags()->fast_unwind_on_fatal);
+  GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, sig.context,
+                common_flags()->fast_unwind_on_fatal);
 }
 
 static void LsanOnDeadlySignal(int signo, void *siginfo, void *context) {

Modified: compiler-rt/trunk/lib/lsan/lsan.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan.h?rev=317774&r1=317773&r2=317774&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan.h (original)
+++ compiler-rt/trunk/lib/lsan/lsan.h Wed Nov  8 23:53:06 2017
@@ -18,9 +18,8 @@
 
 #define GET_STACK_TRACE(max_size, fast)                       \
   __sanitizer::BufferedStackTrace stack;                      \
-  GetStackTraceWithPcBpAndContext(&stack, max_size,           \
-                                  StackTrace::GetCurrentPc(), \
-                                  GET_CURRENT_FRAME(), nullptr, fast);
+  GetStackTrace(&stack, max_size, StackTrace::GetCurrentPc(), \
+                GET_CURRENT_FRAME(), nullptr, fast);
 
 #define GET_STACK_TRACE_FATAL \
   GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
@@ -46,10 +45,9 @@ void ReplaceSystemMalloc();
 // The pc will be in the position 0 of the resulting stack trace.
 // The bp may refer to the current frame or to the caller's frame.
 ALWAYS_INLINE
-void GetStackTraceWithPcBpAndContext(__sanitizer::BufferedStackTrace *stack,
-                                     __sanitizer::uptr max_depth,
-                                     __sanitizer::uptr pc, __sanitizer::uptr bp,
-                                     void *context, bool fast) {
+void GetStackTrace(__sanitizer::BufferedStackTrace *stack,
+                   __sanitizer::uptr max_depth, __sanitizer::uptr pc,
+                   __sanitizer::uptr bp, void *context, bool fast) {
   uptr stack_top = 0, stack_bottom = 0;
   ThreadContext *t;
   if (fast && (t = CurrentThreadContext())) {

Modified: compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_diag.cc?rev=317774&r1=317773&r2=317774&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.cc Wed Nov  8 23:53:06 2017
@@ -26,9 +26,8 @@
 
 using namespace __ubsan;
 
-void __ubsan::GetStackTraceWithPcBpAndContext(BufferedStackTrace *stack,
-                                              uptr max_depth, uptr pc, uptr bp,
-                                              void *context, bool fast) {
+void __ubsan::GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc,
+                            uptr bp, void *context, bool fast) {
   uptr top = 0;
   uptr bottom = 0;
   if (fast)
@@ -43,8 +42,8 @@ static void MaybePrintStackTrace(uptr pc
     return;
 
   BufferedStackTrace stack;
-  GetStackTraceWithPcBpAndContext(&stack, kStackTraceMax, pc, bp, nullptr,
-                                  common_flags()->fast_unwind_on_fatal);
+  GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr,
+                common_flags()->fast_unwind_on_fatal);
   stack.Print();
 }
 

Modified: compiler-rt/trunk/lib/ubsan/ubsan_diag.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_diag.h?rev=317774&r1=317773&r2=317774&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.h (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.h Wed Nov  8 23:53:06 2017
@@ -231,9 +231,8 @@ bool ignoreReport(SourceLocation SLoc, R
     GET_CALLER_PC_BP; \
     ReportOptions Opts = {unrecoverable_handler, pc, bp}
 
-void GetStackTraceWithPcBpAndContext(BufferedStackTrace *stack, uptr max_depth,
-                                     uptr pc, uptr bp, void *context,
-                                     bool fast);
+void GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc, uptr bp,
+                   void *context, bool fast);
 
 /// \brief Instantiate this class before printing diagnostics in the error
 /// report. This class ensures that reports from different threads and from

Modified: compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc?rev=317774&r1=317773&r2=317774&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc Wed Nov  8 23:53:06 2017
@@ -29,9 +29,8 @@ void InitializeDeadlySignals() {}
 #else
 static void OnStackUnwind(const SignalContext &sig, const void *,
                           BufferedStackTrace *stack) {
-  GetStackTraceWithPcBpAndContext(stack, kStackTraceMax, sig.pc, sig.bp,
-                                  sig.context,
-                                  common_flags()->fast_unwind_on_fatal);
+  GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, sig.context,
+                common_flags()->fast_unwind_on_fatal);
 }
 
 static void UBsanOnDeadlySignal(int signo, void *siginfo, void *context) {




More information about the llvm-commits mailing list