debug.h¶
Debug-header.
If ENABLE_DEBUG is defined inside an implementation file, all calls to debug.h::DEBUG
will work the same as printf and output the given information to stdout. If ENABLE_DEBUG is not defined, all calls to debug.h::DEBUG
will be ignored.
-
DEBUG_FUNC
¶ Contains the function name if given compiler supports it.
1
""
Otherwise it is an empty string.
-
DEBUG
( …)¶ Print debug information to stdout.
1
if (ENABLE_DEBUG) DEBUG_PRINT(__VA_ARGS__)
Note
Another name for
debug.h::DEBUG_PRINT
-
DEBUG_PRINT
( …)¶ Print debug information if the calling thread stack is large enough.
1 2 3 4 5 6 7 8
do { \ if ((sched_active_thread == NULL) || (sched_active_thread->stack_size >= THREAD_EXTRA_STACKSIZE_PRINTF)) { \ printf(__VA_ARGS__); \ } \ else { \ puts("Cannot debug, stack too small"); \ } \ } while (0)
Use this macro the same as
printf
. WhenDEVELHELP
is defined inside an implementation file, all usages ofdebug.h::DEBUG_PRINT
will print the given information to stdout after verifying the stack is big enough. IfDEVELHELP
is not set, this check is not performed. (CPU exception may occur)
-
DEBUG_EXTRA_STACKSIZE
¶ Extra stacksize needed when ENABLE_DEBUG==1.
1
THREAD_EXTRA_STACKSIZE_PRINTF