Changeset b060ca9 in mainline for kernel/generic/include/debug.h
- Timestamp:
- 2010-05-20T16:01:00Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b10e6e31
- Parents:
- 9e56e65
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/debug.h
r9e56e65 rb060ca9 39 39 #include <arch/debug.h> 40 40 41 #define CALLER ((uintptr_t) __builtin_return_address(0)) 41 #define CALLER ((uintptr_t) __builtin_return_address(0)) 42 42 43 43 44 #ifndef HERE 45 44 46 /** Current Instruction Pointer address */ 45 # define HERE ((uintptr_t *) 0) 46 #endif 47 #define HERE ((uintptr_t *) 0) 48 49 #endif /* HERE */ 50 51 52 #ifdef CONFIG_DEBUG 47 53 48 54 /** Debugging ASSERT macro … … 55 61 * 56 62 */ 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 63 #define ASSERT(expr) \ 64 if (!(expr)) { \ 65 panic("Assertion failed (%s), caller=%p.", #expr, CALLER); \ 66 } 67 68 /** Debugging verbose ASSERT macro 69 * 70 * If CONFIG_DEBUG is set, the ASSERT() macro 71 * evaluates expr and if it is false raises 72 * kernel panic. The panic message contains also 73 * the supplied message. 74 * 75 * @param expr Expression which is expected to be true. 76 * @param msg Additional message to show (string). 77 * 78 */ 79 #define ASSERT_VERBOSE(expr, msg) \ 80 if (!(expr)) { \ 81 panic("Assertion failed (%s, %s), caller=%p.", #expr, msg, CALLER); \ 82 } 83 84 #else /* CONFIG_DEBUG */ 85 86 #define ASSERT(expr) 87 #define ASSERT_VERBOSE(expr, msg) 88 89 #endif /* CONFIG_DEBUG */ 90 91 92 #ifdef CONFIG_LOG 65 93 66 94 /** Extensive logging output macro … … 71 99 * 72 100 */ 73 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 101 #define LOG(format, ...) \ 102 printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \ 103 __LINE__, ##__VA_ARGS__); 81 104 82 105 /** Extensive logging execute macro … … 87 110 * 88 111 */ 112 #define LOG_EXEC(fnc) \ 113 { \ 114 printf("%s() at %s:%u: " #fnc "\n", __func__, __FILE__, \ 115 __LINE__); \ 116 fnc; \ 117 } 118 119 #else /* CONFOG_LOG */ 89 120 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 121 #define LOG(format, ...) 122 #define LOG_EXEC(fnc) fnc 100 123 124 #endif /* CONFOG_LOG */ 101 125 102 126 #endif
Note:
See TracChangeset
for help on using the changeset viewer.