dump_trace() doesn't add the interrupted instruction's address to the
trace, so add it manually.

Cc: Robert Richter <r...@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com>
---
 arch/x86/oprofile/backtrace.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index c594768..d950f9e 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -113,8 +113,14 @@ x86_backtrace(struct pt_regs * const regs, unsigned int 
depth)
        struct stack_frame *head = (struct stack_frame *)frame_pointer(regs);
 
        if (!user_mode(regs)) {
-               if (depth)
-                       dump_trace(NULL, regs, NULL, 0, &backtrace_ops, &depth);
+               if (!depth)
+                       return;
+
+               oprofile_add_trace(regs->ip);
+               if (!--depth)
+                       return;
+
+               dump_trace(NULL, regs, NULL, 0, &backtrace_ops, &depth);
                return;
        }
 
-- 
2.7.4

Reply via email to