Changeset aac10f86 in mainline


Ignore:
Timestamp:
2008-06-03T14:56:47Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7ac426e
Parents:
419886f6
Message:

LOG, LOG_EXEC() macros (used if CONFIG_EDEBUG is set)
cosmetic changes

Location:
kernel/generic/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/debug.h

    r419886f6 raac10f86  
    3939#include <arch/debug.h>
    4040
    41 #define CALLER       ((uintptr_t)__builtin_return_address(0))
     41#define CALLER ((uintptr_t) __builtin_return_address(0))
    4242
    4343#ifndef HERE
    4444/** Current Instruction Pointer address */
    45 #  define HERE ((uintptr_t *) 0)
     45#       define HERE ((uintptr_t *) 0)
    4646#endif
    4747
     
    5656 */
    5757#ifdef CONFIG_DEBUG
    58 #       define ASSERT(expr) if (!(expr)) { panic("assertion failed (%s), caller=%.*p\n", #expr, sizeof(uintptr_t) * 2, CALLER); }
     58#       define ASSERT(expr) \
     59                if (!(expr)) { \
     60                        panic("assertion failed (%s), caller=%p\n", #expr, CALLER); \
     61                }
    5962#else
    6063#       define ASSERT(expr)
    6164#endif
     65
     66/** Extensive debugging output macro
     67 *
     68 * If CONFIG_EDEBUG is set, the LOG() macro
     69 * will print whatever message is indicated plus
     70 * an information about the location.
     71 *
     72 */
     73
     74#ifdef CONFIG_EDEBUG
     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
     81
     82/** Extensive debugging execute macro
     83 *
     84 * If CONFIG_EDEBUG is set, the LOG_EXEC() macro
     85 * will print an information about calling a given
     86 * function and call it.
     87 *
     88 */
     89
     90#ifdef CONFIG_EDEBUG
     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
     100
    62101
    63102#endif
  • kernel/generic/include/panic.h

    r419886f6 raac10f86  
    3737
    3838#ifdef CONFIG_DEBUG
    39 #define panic(format, ...) \
    40     panic_printf("Kernel panic in %s() at %s on line %d: " format, __func__, \
    41     __FILE__, __LINE__, ##__VA_ARGS__);
     39#       define panic(format, ...) \
     40                panic_printf("Kernel panic in %s() at %s:%u: " format, __func__, \
     41                __FILE__, __LINE__, ##__VA_ARGS__);
    4242#else
    43 #define panic(format, ...) \
    44     panic_printf("Kernel panic: " format, ##__VA_ARGS__);
     43#       define panic(format, ...) \
     44                panic_printf("Kernel panic: " format, ##__VA_ARGS__);
    4545#endif
    4646
    47 extern void panic_printf(char *fmt, ...) __attribute__((noreturn)) ;
     47extern void panic_printf(char *fmt, ...) __attribute__((noreturn));
    4848
    4949#endif
Note: See TracChangeset for help on using the changeset viewer.