Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: components/nacl/loader/nonsfi/irt_thread.cc

Issue 230413002: NonSFI NaCl: Plumb Exception IRT enough for breakpad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revise Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/nacl/loader/nonsfi/irt_thread.cc
diff --git a/components/nacl/loader/nonsfi/irt_thread.cc b/components/nacl/loader/nonsfi/irt_thread.cc
index 3351bdc48b1dbbfee29eb063a668f6f1c7e102b6..e6303de7f8bc85aed6fef33709e3411784d92c50 100644
--- a/components/nacl/loader/nonsfi/irt_thread.cc
+++ b/components/nacl/loader/nonsfi/irt_thread.cc
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "components/nacl/loader/nonsfi/irt_interfaces.h"
+#include "native_client/src/trusted/service_runtime/nacl_signal.h"
namespace nacl {
namespace nonsfi {
@@ -33,6 +34,7 @@ class ScopedPthreadAttrPtr {
struct ThreadContext {
void (*start_func)();
void* thread_ptr;
+ void* signal_stack;
};
// A thread local pointer to support nacl_irt_tls.
@@ -45,6 +47,10 @@ void* ThreadMain(void *arg) {
::scoped_ptr<ThreadContext> context(static_cast<ThreadContext*>(arg));
g_thread_ptr = context->thread_ptr;
+ // NaClLog(4, "Registering alternate signal stack: %p\n",
+ // context->signal_stack);
+ NaClSignalStackRegister(context->signal_stack);
+
// Release the memory of context before running start_func.
void (*start_func)() = context->start_func;
context.reset();
@@ -72,6 +78,10 @@ int IrtThreadCreate(void (*start_func)(), void* stack, void* thread_ptr) {
::scoped_ptr<ThreadContext> context(new ThreadContext);
context->start_func = start_func;
context->thread_ptr = thread_ptr;
+ if (!NaClSignalStackAllocate(&context->signal_stack)) {
+ // NaClLog(4, "Failed to allocate alternate stack\n");
+ return error;
+ }
pthread_t tid;
error = pthread_create(&tid, &attr, ThreadMain, context.get());

Powered by Google App Engine
This is Rietveld 408576698