[PATCH v3 21/51] oprofile/x86: add regs->ip to oprofile trace
From: Josh Poimboeuf
Date: Fri Aug 12 2016 - 10:40:45 EST
dump_trace() doesn't add the interrupted instruction's address to the
trace, so add it manually.
Cc: Robert Richter <rric@xxxxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
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