summaryrefslogtreecommitdiffstats
path: root/common/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/debug.h')
-rw-r--r--common/debug.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/common/debug.h b/common/debug.h
new file mode 100644
index 0000000..882072d
--- /dev/null
+++ b/common/debug.h
@@ -0,0 +1,53 @@
1/*
2 * debug.h
3 * contains utilitary functions for debugging
4 *
5 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
6 * Copyright (c) 2010 Martin S. All Rights Reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef __DEBUG_H
24#define __DEBUG_H
25
26#include <plist/plist.h>
27
28#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(STRIP_DEBUG_CODE)
29#define debug_info(...) debug_info_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
30#define debug_plist(a) debug_plist_real (__func__, __FILE__, __LINE__, a)
31#elif defined(__GNUC__) && __GNUC__ >= 3 && !defined(STRIP_DEBUG_CODE)
32#define debug_info(...) debug_info_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
33#define debug_plist(a) debug_plist_real (__FUNCTION__, __FILE__, __LINE__, a)
34#else
35#define debug_info(...)
36#define debug_plist(a)
37#endif
38
39void debug_info_real(const char *func,
40 const char *file,
41 int line,
42 const char *format, ...);
43
44void debug_buffer(const char *data, const int length);
45void debug_buffer_to_file(const char *file, const char *data, const int length);
46void debug_plist_real(const char *func,
47 const char *file,
48 int line,
49 plist_t plist);
50
51void internal_set_debug_level(int level);
52
53#endif