OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "native_client/src/include/nacl_macros.h" | 9 #include "native_client/src/include/nacl_macros.h" |
10 #include "native_client/src/shared/platform/nacl_exit.h" | 10 #include "native_client/src/shared/platform/nacl_exit.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 /* | 27 /* |
28 * Copy the last NACL_ERROR_GIO_MAX_BYTES of log output to the | 28 * Copy the last NACL_ERROR_GIO_MAX_BYTES of log output to the |
29 * calling thread's stack, so that breakpad will pick it up. | 29 * calling thread's stack, so that breakpad will pick it up. |
30 */ | 30 */ |
31 log_data_bytes = NaClErrorGioGetOutput(&g_NaCl_log_gio, | 31 log_data_bytes = NaClErrorGioGetOutput(&g_NaCl_log_gio, |
32 log_data, | 32 log_data, |
33 NACL_ARRAY_SIZE(log_data)); | 33 NACL_ARRAY_SIZE(log_data)); |
34 (*g_NaCl_log_abort_fn)(g_NaCl_log_abort_state, | 34 (*g_NaCl_log_abort_fn)(g_NaCl_log_abort_state, |
35 log_data, log_data_bytes); | 35 log_data, log_data_bytes); |
36 } | 36 } |
37 NaClAbort(); | |
38 } | 37 } |
39 | 38 |
40 void NaClErrorLogHookInit(void (*hook)(void *state, | 39 void NaClErrorLogHookInit(void (*hook)(void *state, |
41 char *buf, | 40 char *buf, |
42 size_t buf_bytes), | 41 size_t buf_bytes), |
43 void *state) { | 42 void *state) { |
44 NaClLog(2, "NaClErrorLogHookInit: entered\n"); | 43 NaClLog(2, "NaClErrorLogHookInit: entered\n"); |
45 if (!NaClErrorGioCtor(&g_NaCl_log_gio, NaClLogGetGio())) { | 44 if (!NaClErrorGioCtor(&g_NaCl_log_gio, NaClLogGetGio())) { |
46 fprintf(stderr, "sel_main_chrome: log reporting setup failed\n"); | 45 fprintf(stderr, "sel_main_chrome: log reporting setup failed\n"); |
47 NaClAbort(); | 46 NaClAbort(); |
48 } | 47 } |
49 | 48 |
50 g_NaCl_log_abort_fn = hook; | 49 g_NaCl_log_abort_fn = hook; |
51 g_NaCl_log_abort_state = state; | 50 g_NaCl_log_abort_state = state; |
52 | 51 |
53 NaClLogSetGio((struct Gio *) &g_NaCl_log_gio); | 52 NaClLogSetGio((struct Gio *) &g_NaCl_log_gio); |
54 | 53 |
55 NaClLogSetAbortBehavior(NaClReportLogMessages); | 54 NaClLogSetAbortBehavior(NaClReportLogMessages); |
56 } | 55 } |
OLD | NEW |