aboutsummaryrefslogtreecommitdiffstats
path: root/android/utils/panic.h
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-11-17 17:55:17 +0100
committerDavid 'Digit' Turner <digit@android.com>2010-11-17 17:55:17 +0100
commit4c0f745dc80d392fddea23eb8d4d7d86425ce0c6 (patch)
tree5da693710d1a3e81a7af3590619c8cbc6c7942d8 /android/utils/panic.h
parent44e750e6d0375543f0d91d0a68432ae9c8489ccd (diff)
downloadexternal_qemu-4c0f745dc80d392fddea23eb8d4d7d86425ce0c6.zip
external_qemu-4c0f745dc80d392fddea23eb8d4d7d86425ce0c6.tar.gz
external_qemu-4c0f745dc80d392fddea23eb8d4d7d86425ce0c6.tar.bz2
Update android/utils/ with misc. new features.
This introduces a few new features to android/utils/ that will be used in later patches. + <android/utils/assert.h> to handle assertions + <android/utils/vector.h> to handle dynamic arrays + <android/utils/reflist.h> slightly updated (more docs) + <android/utils/refset.h> implements a set of pointers Change-Id: Iebc14cfefd1c0e8aaecda9958a980d40f0be610a
Diffstat (limited to 'android/utils/panic.h')
-rw-r--r--android/utils/panic.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/android/utils/panic.h b/android/utils/panic.h
new file mode 100644
index 0000000..e141ef1
--- /dev/null
+++ b/android/utils/panic.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 The Android Open Source Project
+**
+** This software is licensed under the terms of the GNU General Public
+** License version 2, as published by the Free Software Foundation, and
+** may be copied, distributed, and modified under those terms.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+*/
+#ifndef ANDROID_UTILS_PANIC_H
+#define ANDROID_UTILS_PANIC_H
+
+#include <stdarg.h>
+
+/* Print formatted panic message and halts the process */
+void __attribute__((noreturn)) android_panic ( const char* fmt, ... );
+
+/* Variant of android_vpanic which take va_list formating arguments */
+void __attribute__((noreturn)) android_vpanic( const char* fmt, va_list args );
+
+/* Convenience macro */
+#define APANIC(...) android_panic(__VA_ARGS__)
+
+typedef void (*APanicHandlerFunc)(const char*, va_list) __attribute__((noreturn));
+
+#ifdef ACONFIG_UNIT_TEST
+/* Register a new panic handler. This should only be used for unit-testing */
+void android_panic_registerHandler( APanicHandlerFunc handler );
+#endif /* ACONFIG_UNIT_TEST */
+
+#endif /* ANDROID_UTILS_PANIC_H */