Commit | Line | Data |
---|---|---|
b728d87e | 1 | /* |
c0c0989a | 2 | * SPDX-License-Identifier: MIT |
b728d87e | 3 | * |
c0c0989a | 4 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
b728d87e MD |
5 | */ |
6 | ||
c0c0989a MJ |
7 | #ifndef _LTTNG_TRACEPOINT_H |
8 | #define _LTTNG_TRACEPOINT_H | |
9 | ||
76aca78d MD |
10 | #include <stdio.h> |
11 | #include <stdlib.h> | |
8fce9e2b | 12 | #include <lttng/tracepoint-types.h> |
40b2b5a4 | 13 | #include <lttng/tracepoint-rcu.h> |
b728d87e | 14 | #include <urcu/compiler.h> |
c082d14b | 15 | #include <urcu/system.h> |
deb6e540 | 16 | #include <dlfcn.h> /* for dlopen */ |
51920067 | 17 | #include <string.h> /* for memset */ |
3d3dc207 | 18 | |
b2f60c79 | 19 | #include <lttng/ust-config.h> /* for sdt */ |
a8909ba5 | 20 | #include <lttng/ust-compiler.h> |
3d3dc207 | 21 | #include <lttng/ust-tracer.h> |
b2f60c79 | 22 | |
81b16412 MD |
23 | #define LTTNG_UST_TRACEPOINT_NAME_LEN_MAX 256 |
24 | ||
b2f60c79 | 25 | #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION |
23b75ae5 MJ |
26 | /* |
27 | * Instead of using SDT_USE_VARIADIC from 'sys/sdt.h', use our own namespaced | |
28 | * macros since the instrumented application might already have included | |
29 | * 'sys/sdt.h' without variadic support. | |
30 | */ | |
b2f60c79 | 31 | #include <sys/sdt.h> |
23b75ae5 | 32 | |
b88f9167 MD |
33 | #define _LTTNG_UST_SDT_NARG(...) \ |
34 | __LTTNG_UST_SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0) | |
23b75ae5 | 35 | |
b88f9167 | 36 | #define __LTTNG_UST_SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N |
23b75ae5 | 37 | |
b88f9167 | 38 | #define _LTTNG_UST_SDT_PROBE_N(provider, name, N, ...) \ |
23b75ae5 MJ |
39 | _SDT_PROBE(provider, name, N, (__VA_ARGS__)) |
40 | ||
b88f9167 MD |
41 | #define LTTNG_UST_STAP_PROBEV(provider, name, ...) \ |
42 | _LTTNG_UST_SDT_PROBE_N(provider, name, _LTTNG_UST_SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__) | |
23b75ae5 | 43 | |
b2f60c79 | 44 | #else |
b88f9167 | 45 | #define LTTNG_UST_STAP_PROBEV(...) |
b2f60c79 | 46 | #endif |
b728d87e MD |
47 | |
48 | #ifdef __cplusplus | |
49 | extern "C" { | |
50 | #endif | |
51 | ||
8da6d0c8 | 52 | #define tracepoint_enabled(provider, name) \ |
c082d14b | 53 | caa_unlikely(CMM_LOAD_SHARED(__tracepoint_##provider##___##name.state)) |
8da6d0c8 DS |
54 | |
55 | #define do_tracepoint(provider, name, ...) \ | |
56 | __tracepoint_cb_##provider##___##name(__VA_ARGS__) | |
57 | ||
23c8854a MD |
58 | #define tracepoint(provider, name, ...) \ |
59 | do { \ | |
b88f9167 | 60 | LTTNG_UST_STAP_PROBEV(provider, name, ## __VA_ARGS__); \ |
8da6d0c8 DS |
61 | if (tracepoint_enabled(provider, name)) \ |
62 | do_tracepoint(provider, name, __VA_ARGS__); \ | |
b728d87e MD |
63 | } while (0) |
64 | ||
65 | #define TP_ARGS(...) __VA_ARGS__ | |
66 | ||
67 | /* | |
68 | * TP_ARGS takes tuples of type, argument separated by a comma. | |
69 | * It can take up to 10 tuples (which means that less than 10 tuples is | |
70 | * fine too). | |
71 | * Each tuple is also separated by a comma. | |
72 | */ | |
df854e41 MD |
73 | #define __TP_COMBINE_TOKENS(_tokena, _tokenb) \ |
74 | _tokena##_tokenb | |
75 | #define _TP_COMBINE_TOKENS(_tokena, _tokenb) \ | |
76 | __TP_COMBINE_TOKENS(_tokena, _tokenb) | |
77 | #define __TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ | |
78 | _tokena##_tokenb##_tokenc | |
79 | #define _TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ | |
80 | __TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) | |
81 | #define __TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ | |
82 | _tokena##_tokenb##_tokenc##_tokend | |
83 | #define _TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ | |
84 | __TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) | |
b728d87e | 85 | |
4495dd39 MD |
86 | /* |
87 | * _TP_EXVAR* extract the var names. | |
88 | * _TP_EXVAR1 and _TP_EXDATA_VAR1 are needed for -std=c99. | |
89 | */ | |
b728d87e | 90 | #define _TP_EXVAR0() |
4495dd39 | 91 | #define _TP_EXVAR1(a) |
b728d87e MD |
92 | #define _TP_EXVAR2(a,b) b |
93 | #define _TP_EXVAR4(a,b,c,d) b,d | |
94 | #define _TP_EXVAR6(a,b,c,d,e,f) b,d,f | |
95 | #define _TP_EXVAR8(a,b,c,d,e,f,g,h) b,d,f,h | |
96 | #define _TP_EXVAR10(a,b,c,d,e,f,g,h,i,j) b,d,f,h,j | |
97 | #define _TP_EXVAR12(a,b,c,d,e,f,g,h,i,j,k,l) b,d,f,h,j,l | |
98 | #define _TP_EXVAR14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) b,d,f,h,j,l,n | |
99 | #define _TP_EXVAR16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) b,d,f,h,j,l,n,p | |
100 | #define _TP_EXVAR18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) b,d,f,h,j,l,n,p,r | |
101 | #define _TP_EXVAR20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) b,d,f,h,j,l,n,p,r,t | |
102 | ||
103 | #define _TP_EXDATA_VAR0() __tp_data | |
4495dd39 | 104 | #define _TP_EXDATA_VAR1(a) __tp_data |
b728d87e MD |
105 | #define _TP_EXDATA_VAR2(a,b) __tp_data,b |
106 | #define _TP_EXDATA_VAR4(a,b,c,d) __tp_data,b,d | |
107 | #define _TP_EXDATA_VAR6(a,b,c,d,e,f) __tp_data,b,d,f | |
108 | #define _TP_EXDATA_VAR8(a,b,c,d,e,f,g,h) __tp_data,b,d,f,h | |
109 | #define _TP_EXDATA_VAR10(a,b,c,d,e,f,g,h,i,j) __tp_data,b,d,f,h,j | |
110 | #define _TP_EXDATA_VAR12(a,b,c,d,e,f,g,h,i,j,k,l) __tp_data,b,d,f,h,j,l | |
111 | #define _TP_EXDATA_VAR14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) __tp_data,b,d,f,h,j,l,n | |
112 | #define _TP_EXDATA_VAR16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) __tp_data,b,d,f,h,j,l,n,p | |
113 | #define _TP_EXDATA_VAR18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) __tp_data,b,d,f,h,j,l,n,p,r | |
114 | #define _TP_EXDATA_VAR20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) __tp_data,b,d,f,h,j,l,n,p,r,t | |
115 | ||
4495dd39 MD |
116 | /* |
117 | * _TP_EXPROTO* extract tuples of type, var. | |
118 | * _TP_EXPROTO1 and _TP_EXDATA_PROTO1 are needed for -std=c99. | |
119 | */ | |
86637aa6 | 120 | #define _TP_EXPROTO0() void |
4495dd39 | 121 | #define _TP_EXPROTO1(a) void |
b728d87e MD |
122 | #define _TP_EXPROTO2(a,b) a b |
123 | #define _TP_EXPROTO4(a,b,c,d) a b,c d | |
124 | #define _TP_EXPROTO6(a,b,c,d,e,f) a b,c d,e f | |
125 | #define _TP_EXPROTO8(a,b,c,d,e,f,g,h) a b,c d,e f,g h | |
126 | #define _TP_EXPROTO10(a,b,c,d,e,f,g,h,i,j) a b,c d,e f,g h,i j | |
127 | #define _TP_EXPROTO12(a,b,c,d,e,f,g,h,i,j,k,l) a b,c d,e f,g h,i j,k l | |
128 | #define _TP_EXPROTO14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) a b,c d,e f,g h,i j,k l,m n | |
129 | #define _TP_EXPROTO16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) a b,c d,e f,g h,i j,k l,m n,o p | |
130 | #define _TP_EXPROTO18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) a b,c d,e f,g h,i j,k l,m n,o p,q r | |
131 | #define _TP_EXPROTO20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) a b,c d,e f,g h,i j,k l,m n,o p,q r,s t | |
132 | ||
133 | #define _TP_EXDATA_PROTO0() void *__tp_data | |
4495dd39 | 134 | #define _TP_EXDATA_PROTO1(a) void *__tp_data |
b728d87e MD |
135 | #define _TP_EXDATA_PROTO2(a,b) void *__tp_data,a b |
136 | #define _TP_EXDATA_PROTO4(a,b,c,d) void *__tp_data,a b,c d | |
137 | #define _TP_EXDATA_PROTO6(a,b,c,d,e,f) void *__tp_data,a b,c d,e f | |
138 | #define _TP_EXDATA_PROTO8(a,b,c,d,e,f,g,h) void *__tp_data,a b,c d,e f,g h | |
139 | #define _TP_EXDATA_PROTO10(a,b,c,d,e,f,g,h,i,j) void *__tp_data,a b,c d,e f,g h,i j | |
140 | #define _TP_EXDATA_PROTO12(a,b,c,d,e,f,g,h,i,j,k,l) void *__tp_data,a b,c d,e f,g h,i j,k l | |
141 | #define _TP_EXDATA_PROTO14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) void *__tp_data,a b,c d,e f,g h,i j,k l,m n | |
142 | #define _TP_EXDATA_PROTO16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) void *__tp_data,a b,c d,e f,g h,i j,k l,m n,o p | |
143 | #define _TP_EXDATA_PROTO18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) void *__tp_data,a b,c d,e f,g h,i j,k l,m n,o p,q r | |
144 | #define _TP_EXDATA_PROTO20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) void *__tp_data,a b,c d,e f,g h,i j,k l,m n,o p,q r,s t | |
145 | ||
146 | /* Preprocessor trick to count arguments. Inspired from sdt.h. */ | |
147 | #define _TP_NARGS(...) __TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) | |
148 | #define __TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...) N | |
23c8854a MD |
149 | #define _TP_PROTO_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXPROTO, N)(__VA_ARGS__)) |
150 | #define _TP_VAR_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXVAR, N)(__VA_ARGS__)) | |
151 | #define _TP_DATA_PROTO_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXDATA_PROTO, N)(__VA_ARGS__)) | |
152 | #define _TP_DATA_VAR_N(N, ...) _TP_PARAMS(_TP_COMBINE_TOKENS(_TP_EXDATA_VAR, N)(__VA_ARGS__)) | |
b728d87e | 153 | #define _TP_ARGS_PROTO(...) _TP_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) |
23c8854a | 154 | #define _TP_ARGS_VAR(...) _TP_VAR_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) |
b728d87e | 155 | #define _TP_ARGS_DATA_PROTO(...) _TP_DATA_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) |
23c8854a | 156 | #define _TP_ARGS_DATA_VAR(...) _TP_DATA_VAR_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) |
b728d87e MD |
157 | #define _TP_PARAMS(...) __VA_ARGS__ |
158 | ||
81b16412 MD |
159 | /* |
160 | * sizeof(#_provider) - 1 : length of the provider string (excluding \0). | |
161 | * sizeof(#_name) - 1 : length of the name string (excluding \0). | |
162 | * + 1 : separator between provider and event name. | |
163 | * | |
164 | * Upper bound (inclusive) is LTTNG_UST_TRACEPOINT_NAME_LEN_MAX - 1 to | |
165 | * account for \0. | |
166 | * | |
167 | * The comparison is: | |
168 | * left hand side: sizeof(#_provider) - 1 + sizeof(#_name) - 1 + 1 | |
169 | * right hand side: LTTNG_UST_TRACEPOINT_NAME_LEN_MAX - 1 | |
170 | * operator: <= (inclusive) | |
171 | * Simplified in the code below. | |
172 | */ | |
173 | #define lttng_ust_tracepoint_validate_name_len(_provider, _name) \ | |
174 | lttng_ust_static_assert(sizeof(#_provider) + sizeof(#_name) <= LTTNG_UST_TRACEPOINT_NAME_LEN_MAX, \ | |
175 | "Tracepoint name length is too long", \ | |
176 | Tracepoint_name_length_is_too_long) | |
177 | ||
96f85541 MD |
178 | /* |
179 | * The tracepoint cb is marked always inline so we can distinguish | |
180 | * between caller's ip addresses within the probe using the return | |
181 | * address. | |
182 | */ | |
0f2f7e21 | 183 | #define _DECLARE_TRACEPOINT(_provider, _name, ...) \ |
1a206094 | 184 | extern struct lttng_ust_tracepoint __tracepoint_##_provider##___##_name; \ |
8da9deee MJ |
185 | static inline \ |
186 | void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ | |
187 | __attribute__((always_inline, unused)) lttng_ust_notrace; \ | |
96f85541 | 188 | static \ |
a8909ba5 | 189 | void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ |
b728d87e | 190 | { \ |
10544ee8 | 191 | struct lttng_ust_tracepoint_probe *__tp_probe; \ |
b728d87e | 192 | \ |
d3db6a40 | 193 | if (caa_unlikely(!TP_RCU_LINK_TEST())) \ |
deb6e540 | 194 | return; \ |
10544ee8 MD |
195 | tp_rcu_read_lock(); \ |
196 | __tp_probe = tp_rcu_dereference(__tracepoint_##_provider##___##_name.probes); \ | |
23c8854a | 197 | if (caa_unlikely(!__tp_probe)) \ |
b728d87e MD |
198 | goto end; \ |
199 | do { \ | |
1a206094 | 200 | void (*__tp_cb)(void) = __tp_probe->func; \ |
23c8854a | 201 | void *__tp_data = __tp_probe->data; \ |
b728d87e | 202 | \ |
23c8854a MD |
203 | URCU_FORCE_CAST(void (*)(_TP_ARGS_DATA_PROTO(__VA_ARGS__)), __tp_cb) \ |
204 | (_TP_ARGS_DATA_VAR(__VA_ARGS__)); \ | |
205 | } while ((++__tp_probe)->func); \ | |
b728d87e | 206 | end: \ |
10544ee8 | 207 | tp_rcu_read_unlock(); \ |
b728d87e | 208 | } \ |
106ff4da | 209 | static inline \ |
a8909ba5 | 210 | void __tracepoint_register_##_provider##___##_name(char *name, \ |
106ff4da MJ |
211 | void (*func)(void), void *data) \ |
212 | lttng_ust_notrace; \ | |
a8909ba5 PW |
213 | static inline \ |
214 | void __tracepoint_register_##_provider##___##_name(char *name, \ | |
215 | void (*func)(void), void *data) \ | |
b728d87e | 216 | { \ |
67e5f391 MD |
217 | __tracepoint_probe_register(name, func, data, \ |
218 | __tracepoint_##_provider##___##_name.signature); \ | |
b728d87e | 219 | } \ |
106ff4da | 220 | static inline \ |
a8909ba5 | 221 | void __tracepoint_unregister_##_provider##___##_name(char *name, \ |
106ff4da MJ |
222 | void (*func)(void), void *data) \ |
223 | lttng_ust_notrace; \ | |
a8909ba5 PW |
224 | static inline \ |
225 | void __tracepoint_unregister_##_provider##___##_name(char *name, \ | |
226 | void (*func)(void), void *data) \ | |
b728d87e | 227 | { \ |
23c8854a | 228 | __tracepoint_probe_unregister(name, func, data); \ |
b728d87e MD |
229 | } |
230 | ||
fbdeb5ec MD |
231 | extern int __tracepoint_probe_register(const char *name, void (*func)(void), |
232 | void *data, const char *signature); | |
233 | extern int __tracepoint_probe_unregister(const char *name, void (*func)(void), | |
234 | void *data); | |
deb6e540 | 235 | |
51920067 MD |
236 | /* |
237 | * tracepoint dynamic linkage handling (callbacks). Hidden visibility: | |
238 | * shared across objects in a module/main executable. | |
f641d544 MD |
239 | * |
240 | * IMPORTANT: this structure is part of the ABI between instrumented | |
241 | * applications and UST. Fields need to be only added at the end, never | |
242 | * reordered, never removed. | |
243 | * | |
244 | * The field @struct_size should be used to determine the size of the | |
245 | * structure. It should be queried before using additional fields added | |
246 | * at the end of the structure. | |
51920067 | 247 | */ |
1a206094 | 248 | struct lttng_ust_tracepoint_dlopen { |
f641d544 MD |
249 | uint32_t struct_size; |
250 | ||
51920067 MD |
251 | void *liblttngust_handle; |
252 | ||
1a206094 | 253 | int (*tracepoint_register_lib)(struct lttng_ust_tracepoint * const *tracepoints_start, |
51920067 | 254 | int tracepoints_count); |
1a206094 | 255 | int (*tracepoint_unregister_lib)(struct lttng_ust_tracepoint * const *tracepoints_start); |
10544ee8 MD |
256 | void (*rcu_read_lock_sym)(void); |
257 | void (*rcu_read_unlock_sym)(void); | |
258 | void *(*rcu_dereference_sym)(void *p); | |
f641d544 MD |
259 | |
260 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
51920067 MD |
261 | }; |
262 | ||
1a206094 | 263 | extern struct lttng_ust_tracepoint_dlopen tracepoint_dlopen; |
f4624de2 | 264 | extern struct lttng_ust_tracepoint_dlopen *tracepoint_dlopen_ptr; |
51920067 | 265 | |
46c881a7 MD |
266 | /* |
267 | * These weak symbols, the constructor, and destructor take care of | |
268 | * registering only _one_ instance of the tracepoints per shared-ojbect | |
269 | * (or for the whole main program). | |
270 | */ | |
271 | int __tracepoint_registered | |
272 | __attribute__((weak, visibility("hidden"))); | |
273 | int __tracepoint_ptrs_registered | |
274 | __attribute__((weak, visibility("hidden"))); | |
1a206094 | 275 | struct lttng_ust_tracepoint_dlopen tracepoint_dlopen |
f641d544 MD |
276 | __attribute__((weak, visibility("hidden"))) = { |
277 | .struct_size = sizeof(struct lttng_ust_tracepoint_dlopen), | |
278 | }; | |
9443a022 MD |
279 | /* |
280 | * Deal with gcc O1 optimisation issues with weak hidden symbols. gcc | |
281 | * 4.8 and prior does not have the same behavior for symbol scoping on | |
282 | * 32-bit powerpc depending on the object size: symbols for objects of 8 | |
283 | * bytes or less have the same address throughout a module, whereas they | |
284 | * have different addresses between compile units for objects larger | |
285 | * than 8 bytes. Add this pointer indirection to ensure that the symbol | |
286 | * scoping match that of the other weak hidden symbols found in this | |
287 | * header. | |
288 | */ | |
289 | struct lttng_ust_tracepoint_dlopen *tracepoint_dlopen_ptr | |
290 | __attribute__((weak, visibility("hidden"))); | |
46c881a7 | 291 | |
0fd0de10 FD |
292 | /* |
293 | * Tracepoint dynamic linkage handling (callbacks). Hidden visibility: shared | |
294 | * across objects in a module/main executable. The callbacks are used to | |
295 | * control and check if the destructors should be executed. | |
f641d544 MD |
296 | * |
297 | * IMPORTANT: this structure is part of the ABI between instrumented | |
298 | * applications and UST. Fields need to be only added at the end, never | |
299 | * reordered, never removed. | |
300 | * | |
301 | * The field @struct_size should be used to determine the size of the | |
302 | * structure. It should be queried before using additional fields added | |
303 | * at the end of the structure. | |
0fd0de10 FD |
304 | */ |
305 | struct lttng_ust_tracepoint_destructors_syms { | |
f641d544 MD |
306 | uint32_t struct_size; |
307 | ||
0fd0de10 FD |
308 | void (*tracepoint_disable_destructors)(void); |
309 | int (*tracepoint_get_destructors_state)(void); | |
f641d544 MD |
310 | |
311 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
0fd0de10 FD |
312 | }; |
313 | ||
314 | extern struct lttng_ust_tracepoint_destructors_syms tracepoint_destructors_syms; | |
315 | extern struct lttng_ust_tracepoint_destructors_syms *tracepoint_destructors_syms_ptr; | |
316 | ||
317 | struct lttng_ust_tracepoint_destructors_syms tracepoint_destructors_syms | |
f641d544 MD |
318 | __attribute__((weak, visibility("hidden"))) = { |
319 | .struct_size = sizeof(struct lttng_ust_tracepoint_destructors_syms), | |
320 | }; | |
0fd0de10 FD |
321 | struct lttng_ust_tracepoint_destructors_syms *tracepoint_destructors_syms_ptr |
322 | __attribute__((weak, visibility("hidden"))); | |
323 | ||
324 | static inline void tracepoint_disable_destructors(void) | |
325 | { | |
326 | if (!tracepoint_dlopen_ptr) | |
327 | tracepoint_dlopen_ptr = &tracepoint_dlopen; | |
328 | if (!tracepoint_destructors_syms_ptr) | |
329 | tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms; | |
330 | if (tracepoint_dlopen_ptr->liblttngust_handle | |
331 | && tracepoint_destructors_syms_ptr->tracepoint_disable_destructors) | |
332 | tracepoint_destructors_syms_ptr->tracepoint_disable_destructors(); | |
0fd0de10 FD |
333 | } |
334 | ||
99234da6 | 335 | #ifndef _LGPL_SOURCE |
106ff4da MJ |
336 | static inline void |
337 | __tracepoint__init_urcu_sym(void) | |
338 | lttng_ust_notrace; | |
99234da6 MD |
339 | static inline void |
340 | __tracepoint__init_urcu_sym(void) | |
341 | { | |
9443a022 MD |
342 | if (!tracepoint_dlopen_ptr) |
343 | tracepoint_dlopen_ptr = &tracepoint_dlopen; | |
99234da6 MD |
344 | /* |
345 | * Symbols below are needed by tracepoint call sites and probe | |
346 | * providers. | |
347 | */ | |
10544ee8 MD |
348 | if (!tracepoint_dlopen_ptr->rcu_read_lock_sym) |
349 | tracepoint_dlopen_ptr->rcu_read_lock_sym = | |
99234da6 | 350 | URCU_FORCE_CAST(void (*)(void), |
9443a022 | 351 | dlsym(tracepoint_dlopen_ptr->liblttngust_handle, |
10544ee8 MD |
352 | "tp_rcu_read_lock")); |
353 | if (!tracepoint_dlopen_ptr->rcu_read_unlock_sym) | |
354 | tracepoint_dlopen_ptr->rcu_read_unlock_sym = | |
99234da6 | 355 | URCU_FORCE_CAST(void (*)(void), |
9443a022 | 356 | dlsym(tracepoint_dlopen_ptr->liblttngust_handle, |
10544ee8 MD |
357 | "tp_rcu_read_unlock")); |
358 | if (!tracepoint_dlopen_ptr->rcu_dereference_sym) | |
359 | tracepoint_dlopen_ptr->rcu_dereference_sym = | |
99234da6 | 360 | URCU_FORCE_CAST(void *(*)(void *p), |
9443a022 | 361 | dlsym(tracepoint_dlopen_ptr->liblttngust_handle, |
10544ee8 | 362 | "tp_rcu_dereference_sym")); |
99234da6 MD |
363 | } |
364 | #else | |
106ff4da MJ |
365 | static inline void |
366 | __tracepoint__init_urcu_sym(void) | |
367 | lttng_ust_notrace; | |
99234da6 MD |
368 | static inline void |
369 | __tracepoint__init_urcu_sym(void) | |
370 | { | |
371 | } | |
372 | #endif | |
373 | ||
465a0d04 MJ |
374 | static void |
375 | __tracepoints__init(void) | |
376 | lttng_ust_notrace __attribute__((constructor)); | |
46c881a7 MD |
377 | static void |
378 | __tracepoints__init(void) | |
379 | { | |
8f0d1c78 MD |
380 | if (__tracepoint_registered++) { |
381 | if (!tracepoint_dlopen_ptr->liblttngust_handle) | |
382 | return; | |
383 | __tracepoint__init_urcu_sym(); | |
46c881a7 | 384 | return; |
8f0d1c78 | 385 | } |
46c881a7 | 386 | |
9443a022 MD |
387 | if (!tracepoint_dlopen_ptr) |
388 | tracepoint_dlopen_ptr = &tracepoint_dlopen; | |
389 | if (!tracepoint_dlopen_ptr->liblttngust_handle) | |
390 | tracepoint_dlopen_ptr->liblttngust_handle = | |
3d3dc207 | 391 | dlopen(LTTNG_UST_TRACEPOINT_LIB_SONAME, RTLD_NOW | RTLD_GLOBAL); |
9443a022 | 392 | if (!tracepoint_dlopen_ptr->liblttngust_handle) |
46c881a7 | 393 | return; |
99234da6 | 394 | __tracepoint__init_urcu_sym(); |
46c881a7 MD |
395 | } |
396 | ||
c589eca2 MJ |
397 | static void |
398 | __tracepoints__destroy(void) | |
399 | lttng_ust_notrace __attribute__((destructor)); | |
46c881a7 MD |
400 | static void |
401 | __tracepoints__destroy(void) | |
402 | { | |
403 | int ret; | |
404 | ||
405 | if (--__tracepoint_registered) | |
406 | return; | |
9443a022 MD |
407 | if (!tracepoint_dlopen_ptr) |
408 | tracepoint_dlopen_ptr = &tracepoint_dlopen; | |
0fd0de10 FD |
409 | if (!tracepoint_destructors_syms_ptr) |
410 | tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms; | |
411 | if (!tracepoint_dlopen_ptr->liblttngust_handle) | |
412 | return; | |
413 | if (__tracepoint_ptrs_registered) | |
414 | return; | |
415 | /* | |
416 | * Lookup if destructors must be executed using the new method. | |
417 | */ | |
418 | if (tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state | |
419 | && !tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state()) { | |
420 | /* | |
421 | * The tracepoint_get_destructors_state symbol was found with | |
422 | * dlsym but its returned value is 0 meaning that destructors | |
423 | * must not be executed. | |
424 | */ | |
425 | return; | |
426 | } | |
0fd0de10 FD |
427 | ret = dlclose(tracepoint_dlopen_ptr->liblttngust_handle); |
428 | if (ret) { | |
429 | fprintf(stderr, "Error (%d) in dlclose\n", ret); | |
430 | abort(); | |
431 | } | |
432 | memset(tracepoint_dlopen_ptr, 0, sizeof(*tracepoint_dlopen_ptr)); | |
46c881a7 MD |
433 | } |
434 | ||
deb6e540 MD |
435 | #ifdef TRACEPOINT_DEFINE |
436 | ||
558b9d86 MD |
437 | /* |
438 | * These weak symbols, the constructor, and destructor take care of | |
439 | * registering only _one_ instance of the tracepoints per shared-ojbect | |
440 | * (or for the whole main program). | |
441 | */ | |
1a206094 | 442 | extern struct lttng_ust_tracepoint * const __start___tracepoints_ptrs[] |
558b9d86 | 443 | __attribute__((weak, visibility("hidden"))); |
1a206094 | 444 | extern struct lttng_ust_tracepoint * const __stop___tracepoints_ptrs[] |
558b9d86 MD |
445 | __attribute__((weak, visibility("hidden"))); |
446 | ||
628e1d81 MD |
447 | /* |
448 | * When TRACEPOINT_PROBE_DYNAMIC_LINKAGE is defined, we do not emit a | |
449 | * unresolved symbol that requires the provider to be linked in. When | |
450 | * TRACEPOINT_PROBE_DYNAMIC_LINKAGE is not defined, we emit an | |
451 | * unresolved symbol that depends on having the provider linked in, | |
452 | * otherwise the linker complains. This deals with use of static | |
453 | * libraries, ensuring that the linker does not remove the provider | |
454 | * object from the executable. | |
455 | */ | |
456 | #ifdef TRACEPOINT_PROBE_DYNAMIC_LINKAGE | |
b4f3bc52 | 457 | #define _TRACEPOINT_UNDEFINED_REF(provider) NULL |
628e1d81 | 458 | #else /* TRACEPOINT_PROBE_DYNAMIC_LINKAGE */ |
b4f3bc52 | 459 | #define _TRACEPOINT_UNDEFINED_REF(provider) &__tracepoint_provider_##provider |
628e1d81 MD |
460 | #endif /* TRACEPOINT_PROBE_DYNAMIC_LINKAGE */ |
461 | ||
b728d87e MD |
462 | /* |
463 | * Note: to allow PIC code, we need to allow the linker to update the pointers | |
464 | * in the __tracepoints_ptrs section. | |
465 | * Therefore, this section is _not_ const (read-only). | |
466 | */ | |
b4f3bc52 MD |
467 | #define _TP_EXTRACT_STRING(...) #__VA_ARGS__ |
468 | ||
469 | #define _DEFINE_TRACEPOINT(_provider, _name, _args) \ | |
81b16412 | 470 | lttng_ust_tracepoint_validate_name_len(_provider, _name); \ |
b4f3bc52 MD |
471 | extern int __tracepoint_provider_##_provider; \ |
472 | static const char __tp_strtab_##_provider##___##_name[] \ | |
b728d87e | 473 | __attribute__((section("__tracepoints_strings"))) = \ |
b4f3bc52 | 474 | #_provider ":" #_name; \ |
1a206094 | 475 | struct lttng_ust_tracepoint __tracepoint_##_provider##___##_name \ |
f641d544 MD |
476 | __attribute__((section("__tracepoints"))) = { \ |
477 | sizeof(struct lttng_ust_tracepoint), \ | |
b4f3bc52 MD |
478 | __tp_strtab_##_provider##___##_name, \ |
479 | 0, \ | |
480 | NULL, \ | |
481 | _TRACEPOINT_UNDEFINED_REF(_provider), \ | |
482 | _TP_EXTRACT_STRING(_args), \ | |
483 | }; \ | |
1a206094 SM |
484 | static struct lttng_ust_tracepoint * \ |
485 | __tracepoint_ptr_##_provider##___##_name \ | |
4f74bc5e MD |
486 | __attribute__((section("__tracepoints_ptrs"), used)) \ |
487 | __lttng_ust_variable_attribute_no_sanitize_address = \ | |
b4f3bc52 | 488 | &__tracepoint_##_provider##___##_name; |
b728d87e | 489 | |
465a0d04 MJ |
490 | static void |
491 | __tracepoints__ptrs_init(void) | |
492 | lttng_ust_notrace __attribute__((constructor)); | |
a8909ba5 | 493 | static void |
46c881a7 | 494 | __tracepoints__ptrs_init(void) |
b728d87e | 495 | { |
46c881a7 | 496 | if (__tracepoint_ptrs_registered++) |
b728d87e | 497 | return; |
9443a022 MD |
498 | if (!tracepoint_dlopen_ptr) |
499 | tracepoint_dlopen_ptr = &tracepoint_dlopen; | |
500 | if (!tracepoint_dlopen_ptr->liblttngust_handle) | |
501 | tracepoint_dlopen_ptr->liblttngust_handle = | |
3d3dc207 | 502 | dlopen(LTTNG_UST_TRACEPOINT_LIB_SONAME, RTLD_NOW | RTLD_GLOBAL); |
9443a022 | 503 | if (!tracepoint_dlopen_ptr->liblttngust_handle) |
deb6e540 | 504 | return; |
0fd0de10 FD |
505 | if (!tracepoint_destructors_syms_ptr) |
506 | tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms; | |
9443a022 | 507 | tracepoint_dlopen_ptr->tracepoint_register_lib = |
1a206094 | 508 | URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint * const *, int), |
9443a022 | 509 | dlsym(tracepoint_dlopen_ptr->liblttngust_handle, |
ae14f822 | 510 | "tracepoint_register_lib")); |
9443a022 | 511 | tracepoint_dlopen_ptr->tracepoint_unregister_lib = |
1a206094 | 512 | URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint * const *), |
9443a022 | 513 | dlsym(tracepoint_dlopen_ptr->liblttngust_handle, |
ae14f822 | 514 | "tracepoint_unregister_lib")); |
0fd0de10 FD |
515 | tracepoint_destructors_syms_ptr->tracepoint_disable_destructors = |
516 | URCU_FORCE_CAST(void (*)(void), | |
517 | dlsym(tracepoint_dlopen_ptr->liblttngust_handle, | |
518 | "tp_disable_destructors")); | |
519 | tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state = | |
520 | URCU_FORCE_CAST(int (*)(void), | |
521 | dlsym(tracepoint_dlopen_ptr->liblttngust_handle, | |
522 | "tp_get_destructors_state")); | |
99234da6 | 523 | __tracepoint__init_urcu_sym(); |
9443a022 MD |
524 | if (tracepoint_dlopen_ptr->tracepoint_register_lib) { |
525 | tracepoint_dlopen_ptr->tracepoint_register_lib(__start___tracepoints_ptrs, | |
46c881a7 MD |
526 | __stop___tracepoints_ptrs - |
527 | __start___tracepoints_ptrs); | |
99234da6 | 528 | } |
b728d87e MD |
529 | } |
530 | ||
c589eca2 MJ |
531 | static void |
532 | __tracepoints__ptrs_destroy(void) | |
533 | lttng_ust_notrace __attribute__((destructor)); | |
a8909ba5 | 534 | static void |
46c881a7 | 535 | __tracepoints__ptrs_destroy(void) |
b728d87e | 536 | { |
deb6e540 | 537 | int ret; |
51920067 | 538 | |
46c881a7 | 539 | if (--__tracepoint_ptrs_registered) |
b728d87e | 540 | return; |
9443a022 MD |
541 | if (!tracepoint_dlopen_ptr) |
542 | tracepoint_dlopen_ptr = &tracepoint_dlopen; | |
0fd0de10 FD |
543 | if (!tracepoint_destructors_syms_ptr) |
544 | tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms; | |
9443a022 MD |
545 | if (tracepoint_dlopen_ptr->tracepoint_unregister_lib) |
546 | tracepoint_dlopen_ptr->tracepoint_unregister_lib(__start___tracepoints_ptrs); | |
0fd0de10 FD |
547 | if (tracepoint_dlopen_ptr->liblttngust_handle |
548 | && tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state | |
549 | && tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state() | |
664ccf24 | 550 | && !__tracepoint_ptrs_registered) { |
9443a022 | 551 | ret = dlclose(tracepoint_dlopen_ptr->liblttngust_handle); |
76aca78d MD |
552 | if (ret) { |
553 | fprintf(stderr, "Error (%d) in dlclose\n", ret); | |
554 | abort(); | |
555 | } | |
9443a022 | 556 | memset(tracepoint_dlopen_ptr, 0, sizeof(*tracepoint_dlopen_ptr)); |
deb6e540 | 557 | } |
b728d87e MD |
558 | } |
559 | ||
46c881a7 MD |
560 | #else /* TRACEPOINT_DEFINE */ |
561 | ||
562 | #define _DEFINE_TRACEPOINT(_provider, _name, _args) | |
563 | ||
564 | #endif /* #else TRACEPOINT_DEFINE */ | |
deb6e540 | 565 | |
b728d87e MD |
566 | #ifdef __cplusplus |
567 | } | |
568 | #endif | |
569 | ||
570 | #endif /* _LTTNG_TRACEPOINT_H */ | |
571 | ||
572 | /* The following declarations must be outside re-inclusion protection. */ | |
573 | ||
c785c634 MD |
574 | #ifndef TRACEPOINT_ENUM |
575 | ||
576 | /* | |
577 | * Tracepoint Enumerations | |
578 | * | |
579 | * The enumeration is a mapping between an integer, or range of integers, and | |
580 | * a string. It can be used to have a more compact trace in cases where the | |
581 | * possible values for a field are limited: | |
582 | * | |
583 | * An example: | |
584 | * | |
585 | * TRACEPOINT_ENUM(someproject_component, enumname, | |
586 | * TP_ENUM_VALUES( | |
587 | * ctf_enum_value("even", 0) | |
588 | * ctf_enum_value("uneven", 1) | |
589 | * ctf_enum_range("twoto4", 2, 4) | |
590 | * ctf_enum_value("five", 5) | |
591 | * ) | |
592 | * ) | |
593 | * | |
594 | * Where "someproject_component" is the name of the component this enumeration | |
595 | * belongs to and "enumname" identifies this enumeration. Inside the | |
596 | * TP_ENUM_VALUES macro is the actual mapping. Each string value can map | |
597 | * to either a single value with ctf_enum_value or a range of values | |
598 | * with ctf_enum_range. | |
599 | * | |
600 | * Enumeration ranges may overlap, but the behavior is implementation-defined, | |
601 | * each trace reader will handle overlapping as it wishes. | |
602 | * | |
603 | * That enumeration can then be used in a field inside the TP_FIELD macro using | |
604 | * the following line: | |
605 | * | |
606 | * ctf_enum(someproject_component, enumname, enumtype, enumfield, enumval) | |
607 | * | |
608 | * Where "someproject_component" and "enumname" match those in the | |
609 | * TRACEPOINT_ENUM, "enumtype" is a signed or unsigned integer type | |
610 | * backing the enumeration, "enumfield" is the name of the field and | |
611 | * "enumval" is the value. | |
612 | */ | |
613 | ||
614 | #define TRACEPOINT_ENUM(provider, name, values) | |
615 | ||
616 | #endif /* #ifndef TRACEPOINT_ENUM */ | |
617 | ||
b728d87e MD |
618 | #ifndef TRACEPOINT_EVENT |
619 | ||
620 | /* | |
621 | * How to use the TRACEPOINT_EVENT macro: | |
622 | * | |
623 | * An example: | |
a60af3a5 | 624 | * |
b728d87e MD |
625 | * TRACEPOINT_EVENT(someproject_component, event_name, |
626 | * | |
627 | * * TP_ARGS takes from 0 to 10 "type, field_name" pairs * | |
628 | * | |
629 | * TP_ARGS(int, arg0, void *, arg1, char *, string, size_t, strlen, | |
630 | * long *, arg4, size_t, arg4_len), | |
631 | * | |
632 | * * TP_FIELDS describes the event payload layout in the trace * | |
633 | * | |
634 | * TP_FIELDS( | |
a60af3a5 | 635 | * * Integer, printed in base 10 * |
b728d87e MD |
636 | * ctf_integer(int, field_a, arg0) |
637 | * | |
a60af3a5 | 638 | * * Integer, printed with 0x base 16 * |
b728d87e MD |
639 | * ctf_integer_hex(unsigned long, field_d, arg1) |
640 | * | |
c785c634 MD |
641 | * * Enumeration * |
642 | * ctf_enum(someproject_component, enum_name, int, field_e, arg0) | |
643 | * | |
a60af3a5 | 644 | * * Array Sequence, printed as UTF8-encoded array of bytes * |
b728d87e MD |
645 | * ctf_array_text(char, field_b, string, FIXED_LEN) |
646 | * ctf_sequence_text(char, field_c, string, size_t, strlen) | |
647 | * | |
a60af3a5 | 648 | * * String, printed as UTF8-encoded string * |
b728d87e MD |
649 | * ctf_string(field_e, string) |
650 | * | |
a60af3a5 | 651 | * * Array sequence of signed integer values * |
b728d87e MD |
652 | * ctf_array(long, field_f, arg4, FIXED_LEN4) |
653 | * ctf_sequence(long, field_g, arg4, size_t, arg4_len) | |
654 | * ) | |
655 | * ) | |
656 | * | |
657 | * More detailed explanation: | |
658 | * | |
659 | * The name of the tracepoint is expressed as a tuple with the provider | |
660 | * and name arguments. | |
661 | * | |
662 | * The provider and name should be a proper C99 identifier. | |
663 | * The "provider" and "name" MUST follow these rules to ensure no | |
664 | * namespace clash occurs: | |
665 | * | |
666 | * For projects (applications and libraries) for which an entity | |
667 | * specific to the project controls the source code and thus its | |
668 | * tracepoints (typically with a scope larger than a single company): | |
669 | * | |
670 | * either: | |
671 | * project_component, event | |
672 | * or: | |
673 | * project, event | |
674 | * | |
675 | * Where "project" is the name of the project, | |
676 | * "component" is the name of the project component (which may | |
677 | * include several levels of sub-components, e.g. | |
678 | * ...component_subcomponent_...) where the tracepoint is located | |
679 | * (optional), | |
680 | * "event" is the name of the tracepoint event. | |
681 | * | |
682 | * For projects issued from a single company wishing to advertise that | |
683 | * the company controls the source code and thus the tracepoints, the | |
684 | * "com_" prefix should be used: | |
685 | * | |
686 | * either: | |
687 | * com_company_project_component, event | |
688 | * or: | |
689 | * com_company_project, event | |
690 | * | |
691 | * Where "company" is the name of the company, | |
692 | * "project" is the name of the project, | |
693 | * "component" is the name of the project component (which may | |
694 | * include several levels of sub-components, e.g. | |
695 | * ...component_subcomponent_...) where the tracepoint is located | |
696 | * (optional), | |
697 | * "event" is the name of the tracepoint event. | |
698 | * | |
699 | * the provider:event identifier is limited to 127 characters. | |
700 | */ | |
701 | ||
b728d87e | 702 | #define TRACEPOINT_EVENT(provider, name, args, fields) \ |
deb6e540 | 703 | _DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ |
b4f3bc52 | 704 | _DEFINE_TRACEPOINT(provider, name, _TP_PARAMS(args)) |
b728d87e MD |
705 | |
706 | #define TRACEPOINT_EVENT_CLASS(provider, name, args, fields) | |
707 | ||
708 | #define TRACEPOINT_EVENT_INSTANCE(provider, _template, name, args) \ | |
deb6e540 | 709 | _DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ |
b4f3bc52 | 710 | _DEFINE_TRACEPOINT(provider, name, _TP_PARAMS(args)) |
b728d87e MD |
711 | |
712 | #endif /* #ifndef TRACEPOINT_EVENT */ | |
713 | ||
714 | #ifndef TRACEPOINT_LOGLEVEL | |
715 | ||
716 | /* | |
75c5ad79 | 717 | * Tracepoint Loglevels |
b728d87e MD |
718 | * |
719 | * Typical use of these loglevels: | |
720 | * | |
d8de1354 | 721 | * The loglevels go from 0 to 14. Higher numbers imply the most |
75c5ad79 MD |
722 | * verbosity (higher event throughput expected. |
723 | * | |
d8de1354 MD |
724 | * Loglevels 0 through 6, and loglevel 14, match syslog(3) loglevels |
725 | * semantic. Loglevels 7 through 13 offer more fine-grained selection of | |
726 | * debug information. | |
75c5ad79 | 727 | * |
d8de1354 | 728 | * TRACE_EMERG 0 |
75c5ad79 MD |
729 | * system is unusable |
730 | * | |
d8de1354 | 731 | * TRACE_ALERT 1 |
75c5ad79 MD |
732 | * action must be taken immediately |
733 | * | |
d8de1354 | 734 | * TRACE_CRIT 2 |
75c5ad79 MD |
735 | * critical conditions |
736 | * | |
d8de1354 | 737 | * TRACE_ERR 3 |
75c5ad79 MD |
738 | * error conditions |
739 | * | |
d8de1354 | 740 | * TRACE_WARNING 4 |
75c5ad79 MD |
741 | * warning conditions |
742 | * | |
d8de1354 | 743 | * TRACE_NOTICE 5 |
75c5ad79 MD |
744 | * normal, but significant, condition |
745 | * | |
d8de1354 | 746 | * TRACE_INFO 6 |
75c5ad79 MD |
747 | * informational message |
748 | * | |
d8de1354 MD |
749 | * TRACE_DEBUG_SYSTEM 7 |
750 | * debug information with system-level scope (set of programs) | |
75c5ad79 | 751 | * |
d8de1354 MD |
752 | * TRACE_DEBUG_PROGRAM 8 |
753 | * debug information with program-level scope (set of processes) | |
75c5ad79 | 754 | * |
d8de1354 MD |
755 | * TRACE_DEBUG_PROCESS 9 |
756 | * debug information with process-level scope (set of modules) | |
75c5ad79 | 757 | * |
d8de1354 MD |
758 | * TRACE_DEBUG_MODULE 10 |
759 | * debug information with module (executable/library) scope (set of units) | |
75c5ad79 | 760 | * |
d8de1354 MD |
761 | * TRACE_DEBUG_UNIT 11 |
762 | * debug information with compilation unit scope (set of functions) | |
75c5ad79 | 763 | * |
d8de1354 MD |
764 | * TRACE_DEBUG_FUNCTION 12 |
765 | * debug information with function-level scope | |
75c5ad79 | 766 | * |
d8de1354 MD |
767 | * TRACE_DEBUG_LINE 13 |
768 | * debug information with line-level scope (TRACEPOINT_EVENT default) | |
902e1379 | 769 | * |
d8de1354 | 770 | * TRACE_DEBUG 14 |
1e3b0059 | 771 | * debug-level message |
75c5ad79 MD |
772 | * |
773 | * Declare tracepoint loglevels for tracepoints. A TRACEPOINT_EVENT | |
774 | * should be declared prior to the the TRACEPOINT_LOGLEVEL for a given | |
853cda88 MD |
775 | * tracepoint name. The first field is the provider name, the second |
776 | * field is the name of the tracepoint, the third field is the loglevel | |
777 | * name. | |
b728d87e MD |
778 | * |
779 | * TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >, | |
780 | * < loglevel_name >) | |
781 | * | |
75c5ad79 MD |
782 | * The TRACEPOINT_PROVIDER must be already declared before declaring a |
783 | * TRACEPOINT_LOGLEVEL. | |
b728d87e MD |
784 | */ |
785 | ||
882a56d7 | 786 | enum { |
d8de1354 MD |
787 | TRACE_EMERG = 0, |
788 | TRACE_ALERT = 1, | |
789 | TRACE_CRIT = 2, | |
790 | TRACE_ERR = 3, | |
791 | TRACE_WARNING = 4, | |
792 | TRACE_NOTICE = 5, | |
793 | TRACE_INFO = 6, | |
794 | TRACE_DEBUG_SYSTEM = 7, | |
795 | TRACE_DEBUG_PROGRAM = 8, | |
796 | TRACE_DEBUG_PROCESS = 9, | |
797 | TRACE_DEBUG_MODULE = 10, | |
798 | TRACE_DEBUG_UNIT = 11, | |
799 | TRACE_DEBUG_FUNCTION = 12, | |
800 | TRACE_DEBUG_LINE = 13, | |
801 | TRACE_DEBUG = 14, | |
882a56d7 MD |
802 | }; |
803 | ||
05ceaafd | 804 | #define TRACEPOINT_LOGLEVEL(provider, name, loglevel) |
b728d87e MD |
805 | |
806 | #endif /* #ifndef TRACEPOINT_LOGLEVEL */ | |
6ddc916d MD |
807 | |
808 | #ifndef TRACEPOINT_MODEL_EMF_URI | |
809 | ||
810 | #define TRACEPOINT_MODEL_EMF_URI(provider, name, uri) | |
811 | ||
812 | #endif /* #ifndef TRACEPOINT_MODEL_EMF_URI */ |