From 1b47da733e2553ba58eab708a7ecd62789c89708 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Thu, 23 Mar 2017 14:53:40 -0700 Subject: Fix problem finding if in a signal handler. Bug: 34468756 Test: Wrote a new test in system/core/libbacktrace that passes with Test: this fix. Ran all of the other backtrace unit tests. Change-Id: I0be65192f85f05593738a4d3f00c3a2b95d69df5 --- src/x86/Gos-linux.c | 4 ++++ src/x86/Gstep.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/x86/Gos-linux.c b/src/x86/Gos-linux.c index 884c7fde..66440aee 100644 --- a/src/x86/Gos-linux.c +++ b/src/x86/Gos-linux.c @@ -57,6 +57,10 @@ unw_is_signal_frame (unw_cursor_t *cursor) if SA_SIGINFO is specified. */ ip = c->dwarf.ip; + if (c->dwarf.frame != 0) { + /* Need to adjust the ip because we adjusted it down in the step call. */ + ip++; + } if ((*a->access_mem) (as, ip, &w0, 0, arg) < 0 || (*a->access_mem) (as, ip + 4, &w1, 0, arg) < 0) ret = 0; diff --git a/src/x86/Gstep.c b/src/x86/Gstep.c index b037b71a..74fd32de 100644 --- a/src/x86/Gstep.c +++ b/src/x86/Gstep.c @@ -115,6 +115,10 @@ unw_step (unw_cursor_t *cursor) } else c->dwarf.ip = 0; + + /* Adjust the return value because the functions above return zero for success. */ + if (ret == 0) + ret = 1; } #endif -- cgit v1.2.3