summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-05-23 22:28:43 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-23 22:28:43 +0000
commita0962b687a20dace14b5b2e12d96141a51140cab (patch)
tree2d9a58d0be8641f49ea5f8fa6fe5628a1031f0af
parent21157abcd932e899032689dba120d4f7cb08aa23 (diff)
parentd917d64fafb2eca22c9c75a8527eb4e920a9f079 (diff)
downloadsystem_core-a0962b687a20dace14b5b2e12d96141a51140cab.zip
system_core-a0962b687a20dace14b5b2e12d96141a51140cab.tar.gz
system_core-a0962b687a20dace14b5b2e12d96141a51140cab.tar.bz2
am d917d64f: Merge "Only copy mcontext data from sigcontext."
* commit 'd917d64fafb2eca22c9c75a8527eb4e920a9f079': Only copy mcontext data from sigcontext.
-rw-r--r--libbacktrace/BacktraceThread.cpp8
-rw-r--r--libbacktrace/BacktraceThread.h6
2 files changed, 9 insertions, 5 deletions
diff --git a/libbacktrace/BacktraceThread.cpp b/libbacktrace/BacktraceThread.cpp
index 018d51f..b47cd2a 100644
--- a/libbacktrace/BacktraceThread.cpp
+++ b/libbacktrace/BacktraceThread.cpp
@@ -117,6 +117,12 @@ void ThreadEntry::Wake() {
futex(&futex_, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
}
+void ThreadEntry::CopyUcontextFromSigcontext(void* sigcontext) {
+ ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(sigcontext);
+ // The only thing the unwinder cares about is the mcontext data.
+ memcpy(&ucontext_.uc_mcontext, &ucontext->uc_mcontext, sizeof(ucontext->uc_mcontext));
+}
+
//-------------------------------------------------------------------------
// BacktraceThread functions.
//-------------------------------------------------------------------------
@@ -129,7 +135,7 @@ static void SignalHandler(int, siginfo_t*, void* sigcontext) {
return;
}
- entry->CopyUcontext(reinterpret_cast<ucontext_t*>(sigcontext));
+ entry->CopyUcontextFromSigcontext(sigcontext);
// Indicate the ucontext is now valid.
entry->Wake();
diff --git a/libbacktrace/BacktraceThread.h b/libbacktrace/BacktraceThread.h
index a75a807..ff3e9f3 100644
--- a/libbacktrace/BacktraceThread.h
+++ b/libbacktrace/BacktraceThread.h
@@ -40,14 +40,12 @@ public:
static void Remove(ThreadEntry* entry);
- inline void CopyUcontext(ucontext_t* ucontext) {
- memcpy(&ucontext_, ucontext, sizeof(ucontext_));
- }
-
void Wake();
void Wait(int);
+ void CopyUcontextFromSigcontext(void*);
+
inline void Lock() {
pthread_mutex_lock(&mutex_);
// Reset the futex value in case of multiple unwinds of the same thread.