Bug 1050185 - Make ThreadStackHelper::FillThreadContext Valgrind-friendly. r=nchen

This commit is contained in:
Julian Seward 2014-08-12 12:15:06 +02:00
parent 01e9603ddb
commit 39acca7bb0

View File

@ -22,6 +22,7 @@
#include "mozilla/Move.h"
#include "mozilla/Scoped.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/MemoryChecking.h"
#ifdef MOZ_THREADSTACKHELPER_NATIVE
#include "google_breakpad/processor/call_stack.h"
@ -770,6 +771,11 @@ ThreadStackHelper::FillThreadContext(void* aContext)
#ifndef MOZ_ASAN
memcpy(mContextToFill->mStack.get(), reinterpret_cast<void*>(sp), stackSize);
// Valgrind doesn't care about the access outside the stack frame, but
// the presence of uninitialised values on the stack does cause it to
// later report a lot of false errors when Breakpad comes to unwind it.
// So mark the extracted data as defined.
MOZ_MAKE_MEM_DEFINED(mContextToFill->mStack.get(), stackSize);
#else
// ASan will flag memcpy for access outside of stack frames,
// so roll our own memcpy here.