From ceaebb8ebbfd47f79d09167ac81c814cf10192c4 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Fri, 14 Nov 2014 15:13:23 +0000 Subject: [PATCH] [sanitizer] Extend a comment in SlowUnwind. This better explains a change in r221520. llvm-svn: 222000 --- .../lib/sanitizer_common/sanitizer_unwind_posix_libcdep.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_posix_libcdep.cc index 058f4e8dbc7a..a98e61771c02 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_posix_libcdep.cc @@ -115,7 +115,12 @@ void BufferedStackTrace::SlowUnwindStack(uptr pc, uptr max_depth) { _Unwind_Backtrace(Unwind_Trace, &arg); // 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. + // trace_buffer[0] belongs to the current function so we always pop it, + // unless there is only 1 frame in the stack trace (1 frame is always better + // than 0!). + // 1-frame stacks don't normally happen, but this depends on the actual + // unwinder implementation (libgcc, libunwind, etc) which is outside of our + // control. if (to_pop == 0 && size > 1) to_pop = 1; PopStackFrames(to_pop);