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

Unified Diff: src/trusted/service_runtime/osx/mach_exception_handler.c

Issue 12278019: Mac: Enable Mach exception handler by default Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Rebase Created 7 years, 5 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
« no previous file with comments | « src/trusted/service_runtime/build.scons ('k') | src/trusted/service_runtime/sel_main.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/osx/mach_exception_handler.c
diff --git a/src/trusted/service_runtime/osx/mach_exception_handler.c b/src/trusted/service_runtime/osx/mach_exception_handler.c
index 3cbab30aea467c029509466bb7d90d74162ca2cb..2c0c7d0d46636bf3b43c6dda67c01cadc5af8023 100644
--- a/src/trusted/service_runtime/osx/mach_exception_handler.c
+++ b/src/trusted/service_runtime/osx/mach_exception_handler.c
@@ -44,7 +44,7 @@ boolean_t nacl_exc_server(
mach_msg_header_t *OutHeadP);
-/* Exception types to intercept. */
+/* Exception types to intercept. This should be a superset of what Breakpad handles... */
#define NACL_MACH_EXCEPTION_MASK \
(EXC_MASK_BAD_ACCESS | \
EXC_MASK_BAD_INSTRUCTION | \
@@ -406,6 +406,16 @@ static kern_return_t ForwardException(
}
+static void ReportCrash(int exception_type, int is_untrusted) {
+ char buf[128];
+ int len = snprintf(buf, sizeof(buf),
+ "\n** Mach exception %d from %s code\n",
+ exception_type,
+ is_untrusted ? "untrusted" : "trusted");
+ write(2, buf, len);
+}
+
+
kern_return_t nacl_catch_exception_raise(
mach_port_t exception_port,
mach_port_t thread,
@@ -498,6 +508,8 @@ kern_return_t nacl_catch_exception_raise_state_identity (
return MACH_RCV_PORT_DIED;
}
+ ReportCrash(exception, is_untrusted);
+
/*
* Don't forward if the crash is untrusted, but unhandled.
* (As we don't want things like Breakpad handling the crash.)
« no previous file with comments | « src/trusted/service_runtime/build.scons ('k') | src/trusted/service_runtime/sel_main.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698