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 /* | 7 /* |
8 * NaCl Server Runtime logging code. | 8 * NaCl Server Runtime logging code. |
9 */ | 9 */ |
10 #include "native_client/src/include/nacl_compiler_annotations.h" | 10 #include "native_client/src/include/nacl_compiler_annotations.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 /* | 345 /* |
346 * run abort behavior only on edge transition when | 346 * run abort behavior only on edge transition when |
347 * g_abort_behavior_active is first set. | 347 * g_abort_behavior_active is first set. |
348 */ | 348 */ |
349 } | 349 } |
350 NaClXMutexUnlock(&log_mu); | 350 NaClXMutexUnlock(&log_mu); |
351 if (run_abort_behavior) { | 351 if (run_abort_behavior) { |
352 #ifdef __COVERITY__ | 352 #ifdef __COVERITY__ |
353 NaClAbort(); /* help coverity figure out that this is the default */ | 353 NaClAbort(); /* help coverity figure out that this is the default */ |
354 #else | 354 #else |
355 (*gNaClLogAbortBehavior)(); | 355 NaClLogRunAbortBehavior(); |
356 #endif | 356 #endif |
| 357 /* The abort behavior hook may not abort, so abort here in case. */ |
357 NaClAbort(); | 358 NaClAbort(); |
358 } | 359 } |
359 break; | 360 break; |
360 default: | 361 default: |
361 /* | 362 /* |
362 * Abort handling code in turn aborted. Eeep! | 363 * Abort handling code in turn aborted. Eeep! |
363 */ | 364 */ |
364 NaClAbort(); | 365 NaClAbort(); |
365 break; | 366 break; |
366 } | 367 } |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 va_start(ap, fmt); | 710 va_start(ap, fmt); |
710 NaClLogDoLogAndUnsetModuleV(detail_level, fmt, ap); | 711 NaClLogDoLogAndUnsetModuleV(detail_level, fmt, ap); |
711 va_end(ap); | 712 va_end(ap); |
712 } | 713 } |
713 | 714 |
714 void NaClLogSetAbortBehavior(void (*fn)(void)) { | 715 void NaClLogSetAbortBehavior(void (*fn)(void)) { |
715 NaClXMutexLock(&log_mu); | 716 NaClXMutexLock(&log_mu); |
716 gNaClLogAbortBehavior = fn; | 717 gNaClLogAbortBehavior = fn; |
717 NaClXMutexUnlock(&log_mu); | 718 NaClXMutexUnlock(&log_mu); |
718 } | 719 } |
| 720 |
| 721 void NaClLogRunAbortBehavior(void) { |
| 722 (*gNaClLogAbortBehavior)(); |
| 723 } |
OLD | NEW |