diff options
-rw-r--r-- | include/linux/ftrace_event.h | 3 | ||||
-rw-r--r-- | include/trace/ftrace.h | 8 | ||||
-rw-r--r-- | kernel/trace/trace_output.c | 25 |
3 files changed, 36 insertions, 0 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4b58cf1a11c2..bbf40f624fc8 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -20,6 +20,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim, | |||
20 | unsigned long flags, | 20 | unsigned long flags, |
21 | const struct trace_print_flags *flag_array); | 21 | const struct trace_print_flags *flag_array); |
22 | 22 | ||
23 | const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | ||
24 | const struct trace_print_flags *symbol_array); | ||
25 | |||
23 | /* | 26 | /* |
24 | * The trace entry - the most basic unit of tracing. This is what | 27 | * The trace entry - the most basic unit of tracing. This is what |
25 | * is printed in the end as a single line in the trace output, such as: | 28 | * is printed in the end as a single line in the trace output, such as: |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 22c94719c569..87fc227c6fbe 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -130,6 +130,14 @@ | |||
130 | ftrace_print_flags_seq(p, delim, flag, flags); \ | 130 | ftrace_print_flags_seq(p, delim, flag, flags); \ |
131 | }) | 131 | }) |
132 | 132 | ||
133 | #undef __print_symbolic | ||
134 | #define __print_symbolic(value, symbol_array...) \ | ||
135 | ({ \ | ||
136 | static const struct trace_print_flags symbols[] = \ | ||
137 | { symbol_array, { -1, NULL }}; \ | ||
138 | ftrace_print_symbols_seq(p, value, symbols); \ | ||
139 | }) | ||
140 | |||
133 | #undef TRACE_EVENT | 141 | #undef TRACE_EVENT |
134 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ | 142 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ |
135 | enum print_line_t \ | 143 | enum print_line_t \ |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index a4840c260c89..c12d95db2f56 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -251,6 +251,31 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim, | |||
251 | return p->buffer; | 251 | return p->buffer; |
252 | } | 252 | } |
253 | 253 | ||
254 | const char * | ||
255 | ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | ||
256 | const struct trace_print_flags *symbol_array) | ||
257 | { | ||
258 | int i; | ||
259 | |||
260 | trace_seq_init(p); | ||
261 | |||
262 | for (i = 0; symbol_array[i].name; i++) { | ||
263 | |||
264 | if (val != symbol_array[i].mask) | ||
265 | continue; | ||
266 | |||
267 | trace_seq_puts(p, symbol_array[i].name); | ||
268 | break; | ||
269 | } | ||
270 | |||
271 | if (!p->len) | ||
272 | trace_seq_printf(p, "0x%lx", val); | ||
273 | |||
274 | trace_seq_putc(p, 0); | ||
275 | |||
276 | return p->buffer; | ||
277 | } | ||
278 | |||
254 | #ifdef CONFIG_KRETPROBES | 279 | #ifdef CONFIG_KRETPROBES |
255 | static inline const char *kretprobed(const char *name) | 280 | static inline const char *kretprobed(const char *name) |
256 | { | 281 | { |