oprofile/x86: Add regs->ip to oprofile trace
[cascardo/linux.git] / arch / x86 / oprofile / backtrace.c
index cb31a44..2ef6c8b 100644 (file)
@@ -114,9 +114,16 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)
 
        if (!user_mode(regs)) {
                unsigned long stack = kernel_stack_pointer(regs);
-               if (depth)
-                       dump_trace(NULL, regs, (unsigned long *)stack, 0,
-                                  &backtrace_ops, &depth);
+
+               if (!depth)
+                       return;
+
+               oprofile_add_trace(regs->ip);
+               if (!--depth)
+                       return;
+
+               dump_trace(NULL, regs, (unsigned long *)stack, 0,
+                          &backtrace_ops, &depth);
                return;
        }