diff options
-rw-r--r-- | include/linux/kernel.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace.c | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 3fa4c590cf12..5ad4199fb073 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -492,6 +492,8 @@ extern int | |||
492 | __trace_printk(unsigned long ip, const char *fmt, ...) | 492 | __trace_printk(unsigned long ip, const char *fmt, ...) |
493 | __attribute__ ((format (printf, 2, 3))); | 493 | __attribute__ ((format (printf, 2, 3))); |
494 | 494 | ||
495 | extern void trace_dump_stack(void); | ||
496 | |||
495 | /* | 497 | /* |
496 | * The double __builtin_constant_p is because gcc will give us an error | 498 | * The double __builtin_constant_p is because gcc will give us an error |
497 | * if we try to allocate the static variable to fmt if it is not a | 499 | * if we try to allocate the static variable to fmt if it is not a |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 88bd9ae2a9ed..f531301b7a3b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1151,6 +1151,22 @@ void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, | |||
1151 | __ftrace_trace_stack(tr->buffer, flags, skip, pc); | 1151 | __ftrace_trace_stack(tr->buffer, flags, skip, pc); |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | /** | ||
1155 | * trace_dump_stack - record a stack back trace in the trace buffer | ||
1156 | */ | ||
1157 | void trace_dump_stack(void) | ||
1158 | { | ||
1159 | unsigned long flags; | ||
1160 | |||
1161 | if (tracing_disabled || tracing_selftest_running) | ||
1162 | return 0; | ||
1163 | |||
1164 | local_save_flags(flags); | ||
1165 | |||
1166 | /* skipping 3 traces, seems to get us at the caller of this function */ | ||
1167 | __ftrace_trace_stack(global_trace.buffer, flags, 3, preempt_count()); | ||
1168 | } | ||
1169 | |||
1154 | void | 1170 | void |
1155 | ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) | 1171 | ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) |
1156 | { | 1172 | { |