| OLD | NEW |
| (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 | |
| 5 #include <setjmp.h> | |
| 6 #include <stdio.h> | |
| 7 | |
| 8 #include "native_client/src/include/nacl/nacl_exception.h" | |
| 9 #include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h" | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 jmp_buf g_jmp_buf; | |
| 14 | |
| 15 void MyNaClExceptionHandler(struct NaClExceptionContext* context) { | |
| 16 printf("--- MyNaClExceptionHandler\n"); | |
| 17 longjmp(g_jmp_buf, 1); | |
| 18 } | |
| 19 | |
| 20 void CrashViaSignalHandler() { | |
| 21 printf("--- CrashViaSignalHandler\n"); | |
| 22 | |
| 23 int retval = nacl_exception_set_handler(MyNaClExceptionHandler); | |
| 24 if (retval != 0) { | |
| 25 printf("Unexpected return value from nacl_exception_set_handler: %d\n", | |
| 26 retval); | |
| 27 TEST_FAILED; | |
| 28 return; | |
| 29 } | |
| 30 | |
| 31 if (setjmp(g_jmp_buf)) { | |
| 32 printf("Returned via longjmp\n"); | |
| 33 TEST_PASSED; | |
| 34 return; | |
| 35 } | |
| 36 printf("Going to crash\n"); | |
| 37 __builtin_trap(); | |
| 38 } | |
| 39 | |
| 40 } // namespace | |
| 41 | |
| 42 void SetupTests() { | |
| 43 RegisterTest("CrashViaSignalHandler", CrashViaSignalHandler); | |
| 44 } | |
| 45 | |
| 46 void SetupPluginInterfaces() {} | |
| OLD | NEW |