[compiler-rt] r274010 - Adding a comment to explain r273886 ("Stop unwinding the stack when a close-to-zero PC is found"). NFC.

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 05:53:21 PDT 2016


Author: kuba.brecka
Date: Tue Jun 28 07:53:20 2016
New Revision: 274010

URL: http://llvm.org/viewvc/llvm-project?rev=274010&view=rev
Log:
Adding a comment to explain r273886 ("Stop unwinding the stack when a close-to-zero PC is found"). NFC.


Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=274010&r1=274009&r2=274010&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc Tue Jun 28 07:53:20 2016
@@ -93,6 +93,9 @@ void BufferedStackTrace::FastUnwindStack
 #else
     uhwptr pc1 = frame[1];
 #endif
+    // Let's assume that any pointer in the 0th page (i.e. <0x1000 on i386 and
+    // x86_64) is invalid and stop unwinding here.  If we're adding support for
+    // a platform where this isn't true, we need to reconsider this check.
     if (pc1 < kPageSize)
       break;
     if (pc1 != pc) {

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc?rev=274010&r1=274009&r2=274010&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc Tue Jun 28 07:53:20 2016
@@ -109,6 +109,9 @@ _Unwind_Reason_Code Unwind_Trace(struct
   CHECK_LT(arg->stack->size, arg->max_depth);
   uptr pc = Unwind_GetIP(ctx);
   const uptr kPageSize = GetPageSizeCached();
+  // Let's assume that any pointer in the 0th page (i.e. <0x1000 on i386 and
+  // x86_64) is invalid and stop unwinding here.  If we're adding support for
+  // a platform where this isn't true, we need to reconsider this check.
   if (pc < kPageSize) return UNWIND_STOP;
   arg->stack->trace_buffer[arg->stack->size++] = pc;
   if (arg->stack->size == arg->max_depth) return UNWIND_STOP;




More information about the llvm-commits mailing list