summaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-03-13 09:55:57 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:36:05 -0400
commitc142be8ebe0b7bf73c8a0063925623f3e4b980c0 (patch)
treeb4f05278ba776036475efe7bba7273568fd6c1bf /kernel/trace
parent3cd715de261182413b3487abfffe1b6af41b81b3 (diff)
downloadlinux-c142be8ebe0b7bf73c8a0063925623f3e4b980c0.tar.bz2
tracing: Add skip argument to trace_dump_stack()
Altough the trace_dump_stack() already skips three functions in the call to stack trace, which gets the stack trace to start at the caller of the function, the caller may want to skip some more too (as it may have helper functions). Add a skip argument to the trace_dump_stack() that lets the caller skip back tracing functions that it doesn't care about. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c5b844621562..8aa53213201f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1657,8 +1657,9 @@ void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
/**
* trace_dump_stack - record a stack back trace in the trace buffer
+ * @skip: Number of functions to skip (helper handlers)
*/
-void trace_dump_stack(void)
+void trace_dump_stack(int skip)
{
unsigned long flags;
@@ -1667,9 +1668,13 @@ void trace_dump_stack(void)
local_save_flags(flags);
- /* skipping 3 traces, seems to get us at the caller of this function */
- __ftrace_trace_stack(global_trace.trace_buffer.buffer, flags, 3,
- preempt_count(), NULL);
+ /*
+ * Skip 3 more, seems to get us at the caller of
+ * this function.
+ */
+ skip += 3;
+ __ftrace_trace_stack(global_trace.trace_buffer.buffer,
+ flags, skip, preempt_count(), NULL);
}
static DEFINE_PER_CPU(int, user_stack_count);