]> Pileus Git - ~andy/linux/commitdiff
tracing: Add skip argument to trace_dump_stack()
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Wed, 13 Mar 2013 13:55:57 +0000 (09:55 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Mar 2013 04:36:05 +0000 (00:36 -0400)
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>
include/linux/kernel.h
kernel/trace/trace.c

index d0a16fe03fefdc5b4edf207192b05890f3716f71..239dbb9627caecdd0e1b59d5a218d5ad83a0380f 100644 (file)
@@ -597,7 +597,7 @@ extern int __trace_puts(unsigned long ip, const char *str, int size);
                __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
index c5b844621562074bb25d332b6f734af79736d657..8aa53213201ff985e766b30541b243d9d93ead53 100644 (file)
@@ -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);