File: debug.h

package info (click to toggle)
systemtap 5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,552 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (116 lines) | stat: -rw-r--r-- 3,113 bytes parent folder | download | duplicates (2)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* Systemtap Debug Macros
 * Copyright (C) 2014 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_LINUX_DEBUG_H_
#define _STP_LINUX_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)

/*
 * To use these, enable them from the command line when compiling. 
 * For example, "stap -DDEBUG_UNWIND=3"
 * will activate dbug_unwind() and print messages with level <= 3.
 */

/* Note: DEBUG_MEM is implemented in alloc.c */

#ifdef DEBUG_TRANS /* transport */
/* Note: transport is debugged using printk() */
#define dbug_trans(level, args...) do {					\
		if ((level) <= DEBUG_TRANS) {				\
			printk("%s:%d ",__FUNCTION__, __LINE__);	\
			printk(args);					\
		}							\
	} while (0)

#define dbug_trans2(args...) do {					\
		printk("%s:%d ",__FUNCTION__, __LINE__);		\
		printk(args);						\
	} while (0)
#else
#define dbug_trans(level, args...) do { } while (0)
#define dbug_trans2(args...) do { } while (0)
#endif

#ifdef DEBUG_STP_ON_THE_FLY
#define dbug_otf(args...) do {						\
		_stp_dbug(__FUNCTION__, __LINE__, args);		\
	} while (0)
#else
#define dbug_otf(args...) do { } while (0)
#endif

#ifdef DEBUG_UPROBES
#define dbug_uprobes(args...) do {						\
		_stp_dbug(__FUNCTION__, __LINE__, args);		\
	} while (0)
#else
#define dbug_uprobes(args...) do { } while (0)
#endif

#ifdef DEBUG_UNWIND /* stack unwinder */
#define dbug_unwind(level, args...) do {					\
		if ((level) <= DEBUG_UNWIND)				\
			_stp_dbug(__FUNCTION__, __LINE__, args);	\
	} while (0)
#else
#define dbug_unwind(level, args...) do { } while (0)
#endif


#ifdef DEBUG_TASK_FINDER
#define dbug_task(level, args...) do {                              \
		if ((level) <= DEBUG_TASK_FINDER)		    \
			_stp_dbug(__FUNCTION__, __LINE__, args);    \
	} while (0)
#else
#define dbug_task(level, args...) do { } while (0)
#endif


#if defined(DEBUG_TASK_FINDER_VMA)
#define dbug_task_vma(level, args...) do {                                     \
               if ((level) <= DEBUG_TASK_FINDER_VMA)                               \
                       _stp_dbug(__FUNCTION__, __LINE__, args);        \
       } while (0)
#else
#define dbug_task_vma(level, args...) do { } while (0)
#endif


#ifdef DEBUG_SYMBOLS
#define dbug_sym(level, args...) do {					\
		if ((level) <= DEBUG_SYMBOLS)				\
			_stp_dbug(__FUNCTION__, __LINE__, args);	\
	} while (0)
#else
#define dbug_sym(level, args...) do { } while (0)
#endif


#ifdef DEBUG_TRACEPOINTS
#define dbug_tp(level, args...) do {					\
		if ((level) <= DEBUG_TRACEPOINTS)			\
			_stp_dbug(__FUNCTION__, __LINE__, args);	\
	} while (0)
#else
#define dbug_tp(level, args...) do { } while (0)
#endif

#endif /* _STP_LINUX_DEBUG_H_ */