Merge "Only copy mcontext data from sigcontext."
This commit is contained in:
commit
d917d64faf
2 changed files with 9 additions and 5 deletions
|
|
@ -117,6 +117,12 @@ void ThreadEntry::Wake() {
|
||||||
futex(&futex_, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
|
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.
|
// BacktraceThread functions.
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
@ -129,7 +135,7 @@ static void SignalHandler(int, siginfo_t*, void* sigcontext) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->CopyUcontext(reinterpret_cast<ucontext_t*>(sigcontext));
|
entry->CopyUcontextFromSigcontext(sigcontext);
|
||||||
|
|
||||||
// Indicate the ucontext is now valid.
|
// Indicate the ucontext is now valid.
|
||||||
entry->Wake();
|
entry->Wake();
|
||||||
|
|
|
||||||
|
|
@ -40,14 +40,12 @@ public:
|
||||||
|
|
||||||
static void Remove(ThreadEntry* entry);
|
static void Remove(ThreadEntry* entry);
|
||||||
|
|
||||||
inline void CopyUcontext(ucontext_t* ucontext) {
|
|
||||||
memcpy(&ucontext_, ucontext, sizeof(ucontext_));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Wake();
|
void Wake();
|
||||||
|
|
||||||
void Wait(int);
|
void Wait(int);
|
||||||
|
|
||||||
|
void CopyUcontextFromSigcontext(void*);
|
||||||
|
|
||||||
inline void Lock() {
|
inline void Lock() {
|
||||||
pthread_mutex_lock(&mutex_);
|
pthread_mutex_lock(&mutex_);
|
||||||
// Reset the futex value in case of multiple unwinds of the same thread.
|
// Reset the futex value in case of multiple unwinds of the same thread.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue