[PATCH] [sanitizer] Do not fall back to SlowUnwindStack() in GetStackTrace()

Sergey Matveev earthdok at google.com
Thu Jun 6 07:15:44 PDT 2013


Hi kcc,

http://llvm-reviews.chandlerc.com/D928

Files:
  lib/lsan/lsan_common_linux.cc
  lib/sanitizer_common/sanitizer_posix_libcdep.cc

Index: lib/lsan/lsan_common_linux.cc
===================================================================
--- lib/lsan/lsan_common_linux.cc
+++ lib/lsan/lsan_common_linux.cc
@@ -96,8 +96,9 @@
   uptr size = 0;
   const uptr *trace = StackDepotGet(stack_id, &size);
   // The top frame is our malloc/calloc/etc. The next frame is the caller.
-  CHECK_GE(size, 2);
-  return trace[1];
+  if (size >= 2)
+    return trace[1];
+  return 0;
 }
 
 void ProcessPlatformSpecificAllocationsCb::operator()(void *p) const {
Index: lib/sanitizer_common/sanitizer_posix_libcdep.cc
===================================================================
--- lib/sanitizer_common/sanitizer_posix_libcdep.cc
+++ lib/sanitizer_common/sanitizer_posix_libcdep.cc
@@ -99,7 +99,7 @@
   // Always unwind fast on Mac.
   (void)fast;
 #else
-  if (!fast || (stack_top == stack_bottom))
+  if (!fast)
     return stack->SlowUnwindStack(pc, max_s);
 #endif  // SANITIZER_MAC
   stack->size = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D928.1.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130606/d4fe94c4/attachment.bin>


More information about the llvm-commits mailing list