trace: fix output of stack trace
authorSteven Rostedt <srostedt@redhat.com>
Wed, 3 Dec 2008 16:04:50 +0000 (11:04 -0500)
committerIngo Molnar <mingo@elte.hu>
Wed, 3 Dec 2008 16:15:02 +0000 (17:15 +0100)
Impact: fix to output of stack trace

If a function is not found in the stack of the stack tracer, the
number printed is quite strange. This fixes the algorithm to handle
missing functions better.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace_stack.c

index 06a16115be0fc441d7a17d2a891dbfa7e1d775a7..0b863f2cbc8e3ff04c9ea8347f4ffb6795dab446 100644 (file)
@@ -78,6 +78,7 @@ static inline void check_stack(void)
         * on a new max, so it is far from a fast path.
         */
        while (i < max_stack_trace.nr_entries) {
+               int found = 0;
 
                stack_dump_index[i] = this_size;
                p = start;
@@ -86,12 +87,14 @@ static inline void check_stack(void)
                        if (*p == stack_dump_trace[i]) {
                                this_size = stack_dump_index[i++] =
                                        (top - p) * sizeof(unsigned long);
+                               found = 1;
                                /* Start the search from here */
                                start = p + 1;
                        }
                }
 
-               i++;
+               if (!found)
+                       i++;
        }
 
  out: