libbacktrace: export offline unwinding failures.
This is to help debugging different offline unwiding failures.
Bug: http://b/69383534
Test: run backtrace_test.
Change-Id: I5ed4837027a9f17d032925e97e9f5927161444b3
diff --git a/libbacktrace/BacktraceCurrent.cpp b/libbacktrace/BacktraceCurrent.cpp
index fb76b85..474d099 100644
--- a/libbacktrace/BacktraceCurrent.cpp
+++ b/libbacktrace/BacktraceCurrent.cpp
@@ -67,11 +67,11 @@
bool BacktraceCurrent::Unwind(size_t num_ignore_frames, ucontext_t* ucontext) {
if (GetMap() == nullptr) {
// Without a map object, we can't do anything.
- error_ = BACKTRACE_UNWIND_ERROR_MAP_MISSING;
+ error_.error_code = BACKTRACE_UNWIND_ERROR_MAP_MISSING;
return false;
}
- error_ = BACKTRACE_UNWIND_NO_ERROR;
+ error_.error_code = BACKTRACE_UNWIND_NO_ERROR;
if (ucontext) {
return UnwindFromContext(num_ignore_frames, ucontext);
}
@@ -163,7 +163,7 @@
BACK_ASYNC_SAFE_LOGE("sigaction failed: %s", strerror(errno));
ThreadEntry::Remove(entry);
pthread_mutex_unlock(&g_sigaction_mutex);
- error_ = BACKTRACE_UNWIND_ERROR_INTERNAL;
+ error_.error_code = BACKTRACE_UNWIND_ERROR_INTERNAL;
return false;
}
@@ -171,9 +171,9 @@
// Do not emit an error message, this might be expected. Set the
// error and let the caller decide.
if (errno == ESRCH) {
- error_ = BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST;
+ error_.error_code = BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST;
} else {
- error_ = BACKTRACE_UNWIND_ERROR_INTERNAL;
+ error_.error_code = BACKTRACE_UNWIND_ERROR_INTERNAL;
}
sigaction(THREAD_SIGNAL, &oldact, nullptr);
@@ -218,9 +218,9 @@
} else {
// Check to see if the thread has disappeared.
if (tgkill(Pid(), Tid(), 0) == -1 && errno == ESRCH) {
- error_ = BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST;
+ error_.error_code = BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST;
} else {
- error_ = BACKTRACE_UNWIND_ERROR_THREAD_TIMEOUT;
+ error_.error_code = BACKTRACE_UNWIND_ERROR_THREAD_TIMEOUT;
BACK_ASYNC_SAFE_LOGE("Timed out waiting for signal handler to get ucontext data.");
}
}