Changes in kernel/generic/include/debug.h [f651e80:0843f02] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/debug.h
rf651e80 r0843f02 37 37 38 38 #include <panic.h> 39 #include < arch/debug.h>39 #include <symtab.h> 40 40 41 #define CALLER ((uintptr_t) __builtin_return_address(0))41 #define CALLER ((uintptr_t) __builtin_return_address(0)) 42 42 43 #ifndef HERE 44 /** Current Instruction Pointer address */ 45 # define HERE ((uintptr_t *) 0) 46 #endif 43 #ifdef CONFIG_DEBUG 47 44 48 45 /** Debugging ASSERT macro … … 55 52 * 56 53 */ 57 #ifdef CONFIG_DEBUG 58 # define ASSERT(expr) \ 59 if (!(expr)) { \ 60 panic("Assertion failed (%s), caller=%p.", #expr, CALLER); \ 61 } 62 #else 63 # define ASSERT(expr) 64 #endif 54 #define ASSERT(expr) \ 55 do { \ 56 if (!(expr)) \ 57 panic_assert("%s() at %s:%u:\n%s", \ 58 __func__, __FILE__, __LINE__, #expr); \ 59 } while (0) 60 61 /** Debugging verbose ASSERT macro 62 * 63 * If CONFIG_DEBUG is set, the ASSERT() macro 64 * evaluates expr and if it is false raises 65 * kernel panic. The panic message contains also 66 * the supplied message. 67 * 68 * @param expr Expression which is expected to be true. 69 * @param msg Additional message to show (string). 70 * 71 */ 72 #define ASSERT_VERBOSE(expr, msg) \ 73 do { \ 74 if (!(expr)) \ 75 panic_assert("%s() at %s:%u:\n%s, %s", \ 76 __func__, __FILE__, __LINE__, #expr, msg); \ 77 } while (0) 78 79 #else /* CONFIG_DEBUG */ 80 81 #define ASSERT(expr) 82 #define ASSERT_VERBOSE(expr, msg) 83 84 #endif /* CONFIG_DEBUG */ 85 86 #ifdef CONFIG_LOG 65 87 66 88 /** Extensive logging output macro … … 71 93 * 72 94 */ 95 #define LOG(format, ...) \ 96 do { \ 97 printf("%s() from %s at %s:%u: " format "\n", __func__, \ 98 symtab_fmt_name_lookup(CALLER), __FILE__, __LINE__, \ 99 ##__VA_ARGS__); \ 100 } while (0) 73 101 74 #ifdef CONFIG_LOG 75 # define LOG(format, ...) \ 76 printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \ 77 __LINE__, ##__VA_ARGS__); 78 #else 79 # define LOG(format, ...) 80 #endif 102 #else /* CONFIG_LOG */ 81 103 82 /** Extensive logging execute macro 83 * 84 * If CONFIG_LOG is set, the LOG_EXEC() macro 85 * will print an information about calling a given 86 * function and call it. 87 * 88 */ 104 #define LOG(format, ...) 89 105 90 #ifdef CONFIG_LOG 91 # define LOG_EXEC(fnc) \ 92 { \ 93 printf("%s() at %s:%u: " #fnc "\n", __func__, __FILE__, \ 94 __LINE__); \ 95 fnc; \ 96 } 97 #else 98 # define LOG_EXEC(fnc) fnc 99 #endif 106 #endif /* CONFIG_LOG */ 100 107 108 #ifdef CONFIG_TRACE 109 110 extern void __cyg_profile_func_enter(void *, void *); 111 extern void __cyg_profile_func_exit(void *, void *); 112 113 #endif /* CONFIG_TRACE */ 101 114 102 115 #endif
Note:
See TracChangeset
for help on using the changeset viewer.