1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* Systemtap Debug Macros
* Copyright (C) 2008 Red Hat Inc.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
* Public License (GPL); either version 2, or (at your option) any
* later version.
*/
#ifndef _STP_DEBUG_H_
#define _STP_DEBUG_H_
/* These are always on.
* _dbug() writes to systemtap stderr.
* errk() writes to the system log.
*/
#define _dbug(args...) _stp_dbug(__FUNCTION__, __LINE__, args)
#define errk(args...) do { \
printk("Systemtap Error at %s:%d ",__FUNCTION__, __LINE__); \
printk(args); \
} while (0)
#ifdef DEBUG_TRANSPORT
#undef DEBUG_TRANSPORT
#define DEBUG_TRANSPORT 1
#else
#define DEBUG_TRANSPORT 0
#endif
#ifdef DEBUG_UNWIND
#undef DEBUG_UNWIND
#define DEBUG_UNWIND 2
#else
#define DEBUG_UNWIND 0
#endif
#ifdef DEBUG_SYMBOLS
#undef DEBUG_SYMBOLS
#define DEBUG_SYMBOLS 4
#else
#define DEBUG_SYMBOLS 0
#endif
#define DEBUG_TYPE (DEBUG_TRANSPORT|DEBUG_UNWIND|DEBUG_SYMBOLS)
#if DEBUG_TYPE > 0
#define dbug(type, args...) do { \
if ((type) & DEBUG_TYPE) \
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#define kbug(type, args...) do { \
if ((type) & DEBUG_TYPE) { \
printk("%s:%d ",__FUNCTION__, __LINE__); \
printk(args); \
} \
} while (0)
#else
#define dbug(type, args...) ;
#define kbug(type, args...) ;
#endif /* DEBUG_TYPE > 0 */
#endif /* _STP_DEBUG_H_ */
|