From: Cyrill Gorcunov Date: Tue, 20 Dec 2011 16:58:35 +0000 (+0400) Subject: kvm tool: Introduce own BUG_ON handler X-Git-Tag: next-20120402~5^2~81 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c2d6d89bae3b2ec3fb854b64d3ac81acb4ba3bdd;p=karo-tx-linux.git kvm tool: Introduce own BUG_ON handler Raise SIGABRT in case if run-time crtitical problem found. Proposed-by: Ingo Molnar Signed-off-by: Cyrill Gorcunov Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/include/kvm/util.h b/tools/kvm/include/kvm/util.h index cfa3d9057b41..dabf544c6d0c 100644 --- a/tools/kvm/include/kvm/util.h +++ b/tools/kvm/include/kvm/util.h @@ -9,7 +9,6 @@ * Some bits are stolen from perf tool :) */ -#include #include #include #include @@ -17,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -51,9 +51,20 @@ extern void set_die_routine(void (*routine)(const char *err, va_list params) NOR __func__, __LINE__, ##__VA_ARGS__); \ } while (0) -# + #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) -#define BUG_ON(condition) assert(!(condition)) + +#ifndef BUG_ON_HANDLER +# define BUG_ON_HANDLER(condition) \ + do { \ + if ((condition)) { \ + pr_err("BUG at %s:%d", __FILE__, __LINE__); \ + raise(SIGABRT); \ + } \ + } while (0) +#endif + +#define BUG_ON(condition) BUG_ON_HANDLER((condition)) #define DIE_IF(cnd) \ do { \