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

Unified Diff: src/trap-handler/v8-api.cc

Issue 2371833007: [wasm] Initial signal handler (Closed)
Patch Set: Addressing some of Jochen's feedback Created 3 years, 12 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: src/trap-handler/v8-api.cc
diff --git a/src/trap-handler/v8-api.cc b/src/trap-handler/v8-api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d1c99ff718acc9e30ae3e32f44fdda1b70aef903
--- /dev/null
+++ b/src/trap-handler/v8-api.cc
@@ -0,0 +1,34 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <signal.h>
+#include <stdlib.h>
+
+#include "include/v8.h"
+#include "src/trap-handler/trap-handler-internal.h"
+
+namespace {
+
+void HandleSignal(int signum, siginfo_t* info, void* arg) {
+ if (!v8::V8::MaybeHandleFault(signum, info, arg)) {
+ abort();
+ }
+}
+} // namespace
+
+namespace v8 {
+
+bool V8::MaybeHandleFault(int signum, void* info, void* context) {
+ return v8::internal::trap_handler::MaybeHandleFault(signum, info, context);
+}
+
+bool V8::RegisterDefaultSignalHandler() {
+ struct sigaction action;
+ action.sa_sigaction = HandleSignal;
+ action.sa_flags = SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ return sigaction(SIGSEGV, &action, nullptr) == 0;
+}
+
+} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698