aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
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/trace.c
parent3cd715de261182413b3487abfffe1b6af41b81b3 (diff)
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/trace.c')
-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,
1657 1657
1658/** 1658/**
1659 * trace_dump_stack - record a stack back trace in the trace buffer 1659 * trace_dump_stack - record a stack back trace in the trace buffer
1660 * @skip: Number of functions to skip (helper handlers)
1660 */ 1661 */
1661void trace_dump_stack(void) 1662void trace_dump_stack(int skip)
1662{ 1663{
1663 unsigned long flags; 1664 unsigned long flags;
1664 1665
@@ -1667,9 +1668,13 @@ void trace_dump_stack(void)
1667 1668
1668 local_save_flags(flags); 1669 local_save_flags(flags);
1669 1670
1670 /* skipping 3 traces, seems to get us at the caller of this function */ 1671 /*
1671 __ftrace_trace_stack(global_trace.trace_buffer.buffer, flags, 3, 1672 * Skip 3 more, seems to get us at the caller of
1672 preempt_count(), NULL); 1673 * this function.
1674 */
1675 skip += 3;
1676 __ftrace_trace_stack(global_trace.trace_buffer.buffer,
1677 flags, skip, preempt_count(), NULL);
1673} 1678}
1674 1679
1675static DEFINE_PER_CPU(int, user_stack_count); 1680static DEFINE_PER_CPU(int, user_stack_count);