[sanitizer] Never remove the last frame off the stack trace.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 7 Nov 2014 12:03:07 +0000 (12:03 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 7 Nov 2014 12:03:07 +0000 (12:03 +0000)
It can only make it worse.

llvm-svn: 221520

compiler-rt/lib/sanitizer_common/sanitizer_unwind_posix_libcdep.cc

index 4dc1309..058f4e8 100644 (file)
@@ -116,7 +116,7 @@ void BufferedStackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
   // We need to pop a few frames so that pc is on top.
   uptr to_pop = LocatePcInTrace(pc);
   // trace_buffer[0] belongs to the current function so we always pop it.
-  if (to_pop == 0)
+  if (to_pop == 0 && size > 1)
     to_pop = 1;
   PopStackFrames(to_pop);
   trace_buffer[0] = pc;