Changeset 31198c12 in mainline
- Timestamp:
- 2010-05-21T19:04:58Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5f0e39e8
- Parents:
- 7de7cde
- Location:
- kernel
- Files:
-
- 7 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/debug.h
r7de7cde r31198c12 37 37 38 38 #include <panic.h> 39 #include < arch/debug.h>39 #include <symtab.h> 40 40 41 41 #define CALLER ((uintptr_t) __builtin_return_address(0)) 42 43 44 #ifndef HERE45 46 /** Current Instruction Pointer address */47 #define HERE ((uintptr_t *) 0)48 49 #endif /* HERE */50 51 42 52 43 #ifdef CONFIG_DEBUG … … 62 53 */ 63 54 #define ASSERT(expr) \ 64 if (!(expr)) { \ 65 panic("Assertion failed (%s), caller=%p.", #expr, CALLER); \ 66 } 55 do { \ 56 if (!(expr)) \ 57 panic("Assertion failed (%s)", #expr); \ 58 } while (0) 67 59 68 60 /** Debugging verbose ASSERT macro … … 78 70 */ 79 71 #define ASSERT_VERBOSE(expr, msg) \ 80 if (!(expr)) { \ 81 panic("Assertion failed (%s, %s), caller=%p.", #expr, msg, CALLER); \ 82 } 72 do { \ 73 if (!(expr)) \ 74 panic("Assertion failed (%s, %s)", #expr, msg); \ 75 } while (0) 83 76 84 77 #else /* CONFIG_DEBUG */ … … 88 81 89 82 #endif /* CONFIG_DEBUG */ 90 91 83 92 84 #ifdef CONFIG_LOG … … 100 92 */ 101 93 #define LOG(format, ...) \ 102 printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \ 103 __LINE__, ##__VA_ARGS__); 94 do { \ 95 printf("%s->%s() at %s:%u: " format "\n", symtab_fmt_name_lookup(CALLER), \ 96 __func__, __FILE__, __LINE__, ##__VA_ARGS__); \ 97 } while (0) 104 98 105 99 /** Extensive logging execute macro … … 111 105 */ 112 106 #define LOG_EXEC(fnc) \ 113 { \114 printf("%s () at %s:%u: " #fnc "\n", __func__, __FILE__, \115 __ LINE__); \107 do { \ 108 printf("%s->%s() at %s:%u: " #fnc "\n", symtab_fmt_name_lookup(CALLER), \ 109 __func__, __FILE__, __LINE__); \ 116 110 fnc; \ 117 } 118 119 #else /* CONF OG_LOG */111 } while (0) 112 113 #else /* CONFIG_LOG */ 120 114 121 115 #define LOG(format, ...) 122 #define LOG_EXEC(fnc) fnc116 #define LOG_EXEC(fnc) fnc 123 117 124 118 #endif /* CONFOG_LOG */ -
kernel/generic/include/panic.h
r7de7cde r31198c12 41 41 42 42 #ifdef CONFIG_DEBUG 43 # define panic(format, ...) \ 44 do { \ 45 silent = false; \ 46 printf("Kernel panic in %s() at %s:%u.\n", \ 47 __func__, __FILE__, __LINE__); \ 48 stack_trace(); \ 49 panic_printf("Panic message: " format "\n", \ 50 ##__VA_ARGS__);\ 51 } while (0) 52 #else 53 # define panic(format, ...) \ 54 do { \ 55 silent = false; \ 56 panic_printf("Kernel panic: " format "\n", ##__VA_ARGS__); \ 57 } while (0) 58 #endif 43 44 #define panic(format, ...) \ 45 do { \ 46 silent = false; \ 47 printf("Kernel panic in %s() at %s:%u\n", \ 48 __func__, __FILE__, __LINE__); \ 49 stack_trace(); \ 50 panic_printf("Panic message: " format "\n", \ 51 ##__VA_ARGS__);\ 52 } while (0) 53 54 #else /* CONFIG_DEBUG */ 55 56 #define panic(format, ...) \ 57 do { \ 58 silent = false; \ 59 panic_printf("Kernel panic: " format "\n", ##__VA_ARGS__); \ 60 stack_trace(); \ 61 } while (0) 62 63 #endif /* CONFIG_DEBUG */ 59 64 60 65 extern bool silent;
Note:
See TracChangeset
for help on using the changeset viewer.