[RFC][PATCH 2/2] ftrace: Test arguments by adding trace_printk in function tracer

From: Steven Rostedt
Date: Wed Oct 28 2020 - 20:59:28 EST


From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
kernel/trace/trace_functions.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 89c414ce1388..4bd3194540f1 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -129,7 +129,7 @@ static void function_trace_start(struct trace_array *tr)

static void
function_trace_call(unsigned long ip, unsigned long parent_ip,
- struct ftrace_ops *op, struct pt_regs *pt_regs)
+ struct ftrace_ops *op, struct pt_regs *regs)
{
struct trace_array *tr = op->private;
struct trace_array_cpu *data;
@@ -153,6 +153,17 @@ function_trace_call(unsigned long ip, unsigned long parent_ip,
if (!atomic_read(&data->disabled)) {
local_save_flags(flags);
trace_function(tr, ip, parent_ip, flags, pc);
+#ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
+ trace_printk("%pS %lx %lx %lx %lx %lx %lx %lx\n",
+ (void *)ip,
+ kernel_stack_pointer(regs),
+ regs_get_kernel_argument(regs, 0),
+ regs_get_kernel_argument(regs, 1),
+ regs_get_kernel_argument(regs, 2),
+ regs_get_kernel_argument(regs, 3),
+ regs_get_kernel_argument(regs, 4),
+ regs_get_kernel_argument(regs, 5));
+#endif
}
ftrace_test_recursion_unlock(bit);
preempt_enable_notrace();
--
2.28.0