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

Side by Side Diff: chrome/test/data/nacl/crash/nonsfi_crash_via_signal_handler.cc

Issue 230413002: NonSFI NaCl: Plumb Exception IRT enough for breakpad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
Mark Seaborn 2014/04/23 03:49:50 Could you name this file after the interface it te
Junichi Uekawa 2014/04/23 07:56:15 Done.
5 #include <sched.h>
6 #include <unistd.h>
7
8 #include "native_client/src/include/nacl/nacl_exception.h"
9 #include "native_client/src/shared/platform/nacl_check.h"
Mark Seaborn 2014/04/23 03:49:50 I don't think you use this?
Junichi Uekawa 2014/04/23 07:56:15 Done.
10 #include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
11
12 namespace {
13
14 static void MyNaClExceptionHandler(struct NaClExceptionContext *context) {
15 printf("--- MyNaClExceptionHandler\n");
16 TEST_PASSED;
17 // Wait for the javascript to realize that we have succeeded. If we
18 // exit from here we shall crash and it's hard to distinguish that
Mark Seaborn 2014/04/23 03:49:50 You could exit using setjmp()/longjmp() to exit fr
Junichi Uekawa 2014/04/23 07:56:15 Done.
19 // crash from a complete failure to register a fault handler.
20 while (1) {
21 sched_yield();
22 }
23 }
24
25 void CrashViaSignalHandler() {
26 printf("--- CrashViaSignalHandler\n");
27
28 int retval = nacl_exception_set_handler(MyNaClExceptionHandler);
29 if (retval != 0) {
30 printf("Unexpected return value from nacl_exception_set_handler: %d\n",
31 retval);
32 TEST_FAILED;
33 return;
34 }
35 CRASH;
Mark Seaborn 2014/04/23 03:49:50 I think it would be better to use __builtin_trap()
Junichi Uekawa 2014/04/23 07:56:15 It seemed to me that CRASH is more consistent with
36 }
37
38 } // namespace
39
40 void SetupTests() {
41 RegisterTest("CrashViaSignalHandler", CrashViaSignalHandler);
42 }
43
44 void SetupPluginInterfaces() {
45
Mark Seaborn 2014/04/23 03:49:50 Nit: remove empty line at start of function
Junichi Uekawa 2014/04/23 07:56:15 Done.
46 // none
Mark Seaborn 2014/04/23 03:49:50 Nit: maybe remove this? Empty functions aren't us
Junichi Uekawa 2014/04/23 07:56:15 Done.
47 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/nacl/crash/nonsfi_crash_via_signal_handler.html » ('j') | chrome/test/nacl/nacl_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698