lkml.org 
[lkml]   [2018]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/18] tracing: Add simple arguments to function based events
On Fri, Feb 02, 2018 at 06:05:01PM -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> The function based events can now have arguments passed in. A weak function
> arch_get_func_args() is created so that archs can fill in the arguments
> based on pt_regs. Currently no arch implements this function, so no
> arguments are returned. Passing NULL for pt_regs into this function returns
> the number of supported args that can be processed, and the format will
> only allow the user to add valid args. Which currently are all arguments
> until an arch implements the arg_get_func_args() function.
>
> [ missing 'static' found by Fengguang Wu's kbuild test robot ]
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---

[SNIP]
> @@ -129,9 +284,14 @@ static void func_event_trace(struct trace_event_file *trace_file,
> struct trace_event_call *call = &func_event->call;
> struct ring_buffer_event *event;
> struct ring_buffer *buffer;
> + struct func_arg *arg;
> + long args[func_event->arg_cnt];
> + long long val = 1;
> unsigned long irq_flags;
> + int nr_args;
> int size;
> int pc;
> + int i = 0;
>
> if (trace_trigger_soft_disabled(trace_file))
> return;
> @@ -139,7 +299,7 @@ static void func_event_trace(struct trace_event_file *trace_file,
> local_save_flags(irq_flags);
> pc = preempt_count();
>
> - size = sizeof(*entry);
> + size = func_event->arg_offset + sizeof(*entry);
>
> event = trace_event_buffer_lock_reserve(&buffer, trace_file,
> call->event.type,
> @@ -150,6 +310,15 @@ static void func_event_trace(struct trace_event_file *trace_file,
> entry = ring_buffer_event_data(event);
> entry->ip = ip;
> entry->parent_ip = parent_ip;
> + nr_args = arch_get_func_args(pt_regs, 0, func_event->arg_cnt, args);
> +
> + list_for_each_entry(arg, &func_event->args, list) {
> + if (i < nr_args)
> + val = args[i];
> + else
> + val = 0;
> + memcpy(&entry->data[arg->offset], &val, arg->size);
> + }

Where is the 'i' increased?

Thanks,
Namhyung

\
 
 \ /
  Last update: 2018-02-08 11:19    [W:0.445 / U:13.956 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site