diff options
| author | Christopher Ferris <cferris@google.com> | 2015-03-31 17:28:22 -0700 |
|---|---|---|
| committer | Christopher Ferris <cferris@google.com> | 2015-04-01 15:58:20 -0700 |
| commit | ca09ce902c17c2bffc02bfafaf0844204ac13333 (patch) | |
| tree | b2e3d6aee81be584523cc67b8117edb28276e961 /libbacktrace/BacktraceCurrent.cpp | |
| parent | 9dc41d5d34c792e7a05e1ddfeea99c6cfc02fffd (diff) | |
| download | system_core-ca09ce902c17c2bffc02bfafaf0844204ac13333.tar.gz system_core-ca09ce902c17c2bffc02bfafaf0844204ac13333.tar.bz2 system_core-ca09ce902c17c2bffc02bfafaf0844204ac13333.zip | |
Discards frames for code within library.
When doing a local unwind, do not include the frames that come
from either libunwind or libbacktrace.
Bug: 11518609
Change-Id: I0ec8d823aebbfa0903e61b16b7e5663f3fd65e78
Diffstat (limited to 'libbacktrace/BacktraceCurrent.cpp')
| -rw-r--r-- | libbacktrace/BacktraceCurrent.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libbacktrace/BacktraceCurrent.cpp b/libbacktrace/BacktraceCurrent.cpp index b7190e256..fd1f4da7b 100644 --- a/libbacktrace/BacktraceCurrent.cpp +++ b/libbacktrace/BacktraceCurrent.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#define _GNU_SOURCE 1 #include <errno.h> #include <stdint.h> #include <string.h> @@ -73,6 +74,16 @@ bool BacktraceCurrent::Unwind(size_t num_ignore_frames, ucontext_t* ucontext) { return UnwindFromContext(num_ignore_frames, nullptr); } +bool BacktraceCurrent::DiscardFrame(const backtrace_frame_data_t& frame) { + if (BacktraceMap::IsValid(frame.map)) { + const std::string library = basename(frame.map.name.c_str()); + if (library == "libunwind.so" || library == "libbacktrace.so") { + return true; + } + } + return false; +} + static pthread_mutex_t g_sigaction_mutex = PTHREAD_MUTEX_INITIALIZER; static void SignalHandler(int, siginfo_t*, void* sigcontext) { |
