Commit c142be8e authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

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: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 3cd715de
...@@ -597,7 +597,7 @@ extern int __trace_puts(unsigned long ip, const char *str, int size); ...@@ -597,7 +597,7 @@ extern int __trace_puts(unsigned long ip, const char *str, int size);
__trace_puts(_THIS_IP_, str, strlen(str)); \ __trace_puts(_THIS_IP_, str, strlen(str)); \
}) })
extern void trace_dump_stack(void); extern void trace_dump_stack(int skip);
/* /*
* The double __builtin_constant_p is because gcc will give us an error * The double __builtin_constant_p is because gcc will give us an error
......
...@@ -1657,8 +1657,9 @@ void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, ...@@ -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 * 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; unsigned long flags;
...@@ -1667,9 +1668,13 @@ void trace_dump_stack(void) ...@@ -1667,9 +1668,13 @@ void trace_dump_stack(void)
local_save_flags(flags); 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, * Skip 3 more, seems to get us at the caller of
preempt_count(), NULL); * 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); static DEFINE_PER_CPU(int, user_stack_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment