summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alk@tut.by>2015-09-28 10:27:49 -0700
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2015-10-05 20:56:28 -0700
commit5b62d38329f04ee30fb475a36b552c1ebc4e1e79 (patch)
treeda257b65f3ad494b49e226ee163691b5b821c6d6
parent7b9ded722e4cef9a44b8d8bfa80d3e1e108cf590 (diff)
downloadgperftools-5b62d38329f04ee30fb475a36b552c1ebc4e1e79.tar.gz
avoid checking for dup. entries on empty backtrace
This might fix issue #721. But it is right thing to do regardless. Since if depth is 0 we'll be reading random "garbage" on the stack.
-rw-r--r--src/profiler.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/profiler.cc b/src/profiler.cc
index b862ae6..f4f5990 100644
--- a/src/profiler.cc
+++ b/src/profiler.cc
@@ -360,7 +360,7 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
3, signal_ucontext);
void **used_stack;
- if (stack[1] == stack[0]) {
+ if (depth > 0 && stack[1] == stack[0]) {
// in case of non-frame-pointer-based unwinding we will get
// duplicate of PC in stack[1], which we don't want
used_stack = stack + 1;