[Crash-utility] [PATCH] Fix trace extension for v3.15+
Dave Anderson
anderson at redhat.com
Thu Feb 5 14:39:19 UTC 2015
----- Original Message -----
> Hello Rabin,
>
> This patch looks good to me.
>
> Reviewed-by: Qiao Nuohan <qiaonuohan at cn.fujitsu.com>
Rabin, thanks for the patch, and Qiao, thanks for the quick review.
Queued for crash-7.1.0:
https://github.com/crash-utility/crash/commit/28a2bd99a9e514469ef61864e68212ebace613a6
Dave
>
> On 02/05/2015 05:40 AM, Rabin Vincent wrote:
> > Since Linux v3.15 (specifically, the following commit), the event name is
> > optionally moved to another structure.
> >
> > commit de7b2973903c6cc50b31ee5682a69b2219b9919d
> > Author: Mathieu Desnoyers<mathieu.desnoyers at efficios.com>
> > Date: Tue Apr 8 17:26:21 2014 -0400
> >
> > tracepoint: Use struct pointer instead of name hash for reg/unreg
> > tracepoints
> >
> > - char *name;
> > + union {
> > + char *name;
> > + /* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */
> > + struct tracepoint *tp;
> > + };
> >
> > This patch handles this in the trace extension so that both kernels with and
> > without that commit work.
> > ---
> > extensions/trace.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
> > 1 file changed, 42 insertions(+), 4 deletions(-)
> >
> > diff --git a/extensions/trace.c b/extensions/trace.c
> > index a09f6a1..8639fb2 100644
> > --- a/extensions/trace.c
> > +++ b/extensions/trace.c
> > @@ -988,19 +988,42 @@ static void ftrace_destroy_event_types(void)
> > free(ftrace_common_fields);
> > }
> >
> > +#define TRACE_EVENT_FL_TRACEPOINT 0x40
> > +
> > static
> > int ftrace_get_event_type_name(ulong call, char *name, int len)
> > {
> > static int inited;
> > static int name_offset;
> > + static int flags_offset;
> > + static int tp_name_offset;
> > + uint flags;
> >
> > ulong name_addr;
> >
> > - if (!inited) {
> > - inited = 1;
> > - name_offset = MEMBER_OFFSET("ftrace_event_call", "name");
> > - }
> > + if (inited)
> > + goto work;
> > +
> > + inited = 1;
> > + name_offset = MEMBER_OFFSET("ftrace_event_call", "name");
> > + if (name_offset>= 0)
> > + goto work;
> >
> > + name_offset = ANON_MEMBER_OFFSET("ftrace_event_call", "name");
> > + if (name_offset< 0)
> > + return -1;
> > +
> > + flags_offset = MEMBER_OFFSET("ftrace_event_call", "flags");
> > + if (flags_offset< 0)
> > + return -1;
> > +
> > + tp_name_offset = MEMBER_OFFSET("tracepoint", "name");
> > + if (tp_name_offset< 0)
> > + return -1;
> > +
> > + inited = 2;
> > +
> > +work:
> > if (name_offset< 0)
> > return -1;
> >
> > @@ -1008,6 +1031,21 @@ int ftrace_get_event_type_name(ulong call, char
> > *name, int len)
> > "read ftrace_event_call name_addr", RETURN_ON_ERROR))
> > return -1;
> >
> > + if (inited == 2) {
> > + if (!readmem(call + flags_offset, KVADDR,&flags,
> > + sizeof(flags), "read ftrace_event_call flags",
> > + RETURN_ON_ERROR))
> > + return -1;
> > +
> > + if (flags& TRACE_EVENT_FL_TRACEPOINT) {
> > + if (!readmem(name_addr + tp_name_offset, KVADDR,
> > + &name_addr, sizeof(name_addr),
> > + "read tracepoint name", RETURN_ON_ERROR))
> > + return -1;
> > + }
> > +
> > + }
> > +
> > if (!read_string(name_addr, name, len))
> > return -1;
> >
>
>
> --
> Regards
> Qiao Nuohan
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
>
More information about the Crash-utility
mailing list