Home | History | Annotate | Download | only in utils
      1 /* Copyright (C) 2008 The Android Open Source Project
      2 **
      3 ** This software is licensed under the terms of the GNU General Public
      4 ** License version 2, as published by the Free Software Foundation, and
      5 ** may be copied, distributed, and modified under those terms.
      6 **
      7 ** This program is distributed in the hope that it will be useful,
      8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 ** GNU General Public License for more details.
     11 */
     12 #ifndef ANDROID_UTILS_PANIC_H
     13 #define ANDROID_UTILS_PANIC_H
     14 
     15 #include <stdarg.h>
     16 
     17 /* Print formatted panic message and halts the process */
     18 void __attribute__((noreturn)) android_panic ( const char*  fmt, ... );
     19 
     20 /* Variant of android_vpanic which take va_list formating arguments */
     21 void __attribute__((noreturn)) android_vpanic( const char*  fmt, va_list  args );
     22 
     23 /* Convenience macro */
     24 #define  APANIC(...)    android_panic(__VA_ARGS__)
     25 
     26 typedef void (*APanicHandlerFunc)(const char*, va_list) __attribute__((noreturn));
     27 
     28 #ifdef ACONFIG_UNIT_TEST
     29 /* Register a new panic handler. This should only be used for unit-testing */
     30 void android_panic_registerHandler( APanicHandlerFunc  handler );
     31 #endif /* ACONFIG_UNIT_TEST */
     32 
     33 #endif /* ANDROID_UTILS_PANIC_H */
     34