Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
debug.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2014 Freie Universität Berlin
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
24
#ifndef DEBUG_H
25
#define DEBUG_H
26
27
#include <stdio.h>
28
#include "
sched.h
"
29
#include "
thread.h
"
30
31
#ifdef __cplusplus
32
extern
"C"
{
33
#endif
34
51
#ifdef DEVELHELP
52
#include "cpu_conf.h"
53
#define DEBUG_PRINT(...) \
54
do { \
55
if ((sched_active_thread == NULL) || (sched_active_thread->stack_size >= THREAD_EXTRA_STACKSIZE_PRINTF)) { \
56
printf(__VA_ARGS__); \
57
} \
58
else { \
59
puts("Cannot debug, stack too small. Consider using DEBUG_PUTS()."); \
60
} \
61
} while (0)
62
#else
63
#define DEBUG_PRINT(...) printf(__VA_ARGS__)
64
#endif
65
70
#ifndef ENABLE_DEBUG
71
#define ENABLE_DEBUG (0)
72
#endif
73
80
# if defined(__cplusplus) && defined(__GNUC__)
81
# define DEBUG_FUNC __PRETTY_FUNCTION__
82
# elif __STDC_VERSION__ >= 199901L
83
# define DEBUG_FUNC __func__
84
# elif __GNUC__ >= 2
85
# define DEBUG_FUNC __FUNCTION__
86
# else
87
# define DEBUG_FUNC ""
88
# endif
89
97
#define DEBUG(...) if (ENABLE_DEBUG) DEBUG_PRINT(__VA_ARGS__)
98
105
#define DEBUG_PUTS(str) if (ENABLE_DEBUG) puts(str)
106
113
#if ENABLE_DEBUG
114
#define DEBUG_EXTRA_STACKSIZE THREAD_EXTRA_STACKSIZE_PRINTF
115
#else
116
#define DEBUG_EXTRA_STACKSIZE (0)
117
#endif
118
119
#ifdef __cplusplus
120
}
121
#endif
122
123
#endif
/* DEBUG_H */
124
thread.h
Threading API.
sched.h
Scheduler API definition.
Generated on Mon Dec 9 2019 06:00:17 by
1.8.13