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

Side by Side Diff: src/untrusted/nacl/nacl_exception.c

Issue 14876015: Add wrapper library for the nacl_irt_exception_handling IRT interface (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Cleanup + remove minidump_generator.gyp for now because of pthread.h problem in Gyp build Created 7 years, 7 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
« no previous file with comments | « src/untrusted/nacl/nacl.scons ('k') | tests/exception_test/exception_crash_test.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #include "native_client/src/include/nacl/nacl_exception.h"
8
9 #include <errno.h>
10 #include <stdlib.h>
11
12 #include "native_client/src/untrusted/irt/irt.h"
13
14
15 static struct nacl_irt_exception_handling irt_exception_handling;
16
17 /*
18 * We don't do any locking here, but simultaneous calls are harmless enough.
19 * They'll all be writing the same values to the same words.
20 */
21 static int set_up_irt_exception_handling(void) {
22 return nacl_interface_query(NACL_IRT_EXCEPTION_HANDLING_v0_1,
23 &irt_exception_handling,
24 sizeof(irt_exception_handling))
25 == sizeof(irt_exception_handling);
26 }
27
28 int nacl_exception_set_handler(nacl_exception_handler_t handler) {
29 if (irt_exception_handling.exception_handler == NULL) {
30 if (!set_up_irt_exception_handling())
31 return ENOSYS;
32 }
33 return irt_exception_handling.exception_handler(handler, NULL);
34 }
35
36 int nacl_exception_set_stack(void *stack, size_t size) {
37 if (irt_exception_handling.exception_stack == NULL) {
38 if (!set_up_irt_exception_handling())
39 return ENOSYS;
40 }
41 return irt_exception_handling.exception_stack(stack, size);
42 }
43
44 int nacl_exception_clear_flag() {
45 if (irt_exception_handling.exception_clear_flag == NULL) {
46 if (!set_up_irt_exception_handling())
47 return ENOSYS;
48 }
49 return irt_exception_handling.exception_clear_flag();
50 }
OLDNEW
« no previous file with comments | « src/untrusted/nacl/nacl.scons ('k') | tests/exception_test/exception_crash_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698