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#include "android/utils/compiler.h"
18
19ANDROID_BEGIN_HEADER
20
21/* Print formatted panic message and halts the process */
22void __attribute__((noreturn)) android_panic ( const char*  fmt, ... );
23
24/* Variant of android_vpanic which take va_list formating arguments */
25void __attribute__((noreturn)) android_vpanic( const char*  fmt, va_list  args );
26
27/* Convenience macro */
28#define  APANIC(...)    android_panic(__VA_ARGS__)
29
30typedef void (*APanicHandlerFunc)(const char*, va_list) __attribute__((noreturn));
31
32/* Register a new panic handler. This should only be used for unit-testing */
33void android_panic_registerHandler( APanicHandlerFunc  handler );
34
35ANDROID_END_HEADER
36
37#endif /* ANDROID_UTILS_PANIC_H */
38