lkml.org 
[lkml]   [2010]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: kernelshark plugins and ftrace array fields
From
Date
On Thu, 2010-09-02 at 14:38 -0400, Steven Rostedt wrote:

> I think I will add a:
>
> void *pevent_get_field_raw(stuct trace_seq *s,
> struct event_format *event,
> char *field_name,
> struct record *record,
> int **field_len);
>
> which will return a pointer into record->data and set the field_len to
> the actual size.
>
> This will be useful for dynamic arrays too, since it is more complex
> than just using a field->offset.

I just pushed out the changes and my new example looks like this:

static int
kvm_emulate_insn_handler(struct trace_seq *s, struct record *record,
struct event_format *event, void *context)
{
unsigned char *data;
int len;
int i;

data = pevent_get_field_raw(s, event, "insn", record,
&len, 1);
if (!data)
return -1;

trace_seq_puts(s, "insn: ");
for (i = 0; i < len; i++) {
trace_seq_printf(s, "%s%02x",
i ? "," : "",
data[i]);
}

return 0;
}




\
 
 \ /
  Last update: 2010-09-02 21:27    [W:0.048 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site