debug.h File Reference

Debug-header. More...

Detailed Description

Debug-header.

If ENABLE_DEBUG is defined inside an implementation file, all calls to DEBUG will work the same as printf and output the given information to stdout. If ENABLE_DEBUG is not defined, all calls to DEBUG will be ignored.

Author
Kaspar Schleiser kaspa.nosp@m.r@sc.nosp@m.hleis.nosp@m.er.d.nosp@m.e

Definition in file debug.h.

#include <stdio.h>
#include "sched.h"
#include "thread.h"
#include "cpu_conf.h"
+ Include dependency graph for debug.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUG_EXTRA_STACKSIZE   THREAD_EXTRA_STACKSIZE_PRINTF
 Extra stacksize needed when ENABLE_DEBUG==1.
 
#define DEBUG_PRINT(...)
 Print debug information if the calling thread stack is large enough. More...
 

Debugging defines

#define DEBUG_FUNC   ""
 Contains the function name if given compiler supports it. More...
 
#define DEBUG(...)   if (ENABLE_DEBUG) DEBUG_PRINT(__VA_ARGS__)
 Print debug information to stdout. More...
 

Macro Definition Documentation

◆ DEBUG

#define DEBUG (   ...)    if (ENABLE_DEBUG) DEBUG_PRINT(__VA_ARGS__)

Print debug information to stdout.

Note
Another name for DEBUG_PRINT

Definition at line 97 of file debug.h.

◆ DEBUG_FUNC

#define DEBUG_FUNC   ""

Contains the function name if given compiler supports it.

Otherwise it is an empty string.

Definition at line 87 of file debug.h.

◆ DEBUG_PRINT

#define DEBUG_PRINT (   ...)
Value:
do { \
printf(__VA_ARGS__); \
} \
else { \
puts("Cannot debug, stack too small"); \
} \
} while (0)
volatile thread_t * sched_active_thread
Currently active thread.
#define THREAD_EXTRA_STACKSIZE_PRINTF
Size of the task&#39;s printf stack in bytes.
Definition: thread.h:223
int stack_size
thread&#39;s stack size
Definition: thread.h:177

Print debug information if the calling thread stack is large enough.

Use this macro the same as printf. When DEVELHELP is defined inside an implementation file, all usages of DEBUG_PRINT will print the given information to stdout after verifying the stack is big enough. If DEVELHELP is not set, this check is not performed. (CPU exception may occur)

Definition at line 53 of file debug.h.