Hi Qiao,

This patch looks OK to me, but can you check it for backwards-compatibity or
whatever other purposes, and if OK, give me your ACK so I can check it in?

Thanks,
  Dave

----- Original Message -----
> The recent kernel change dcb0b5575d24 ("tracing: Remove
> TRACE_EVENT_FL_USE_CALL_FILTER logic") changed the bit index so it makes
> checking TRACE_EVENT_FL_TRACEPOINT flag failed.  It should be 0x20 for
> newer kernels.  Without this patch, the crash tool refused to load
> trace.so extension due to invalid access to event names:
> 
>   crash> extend trace.so
>   extend: /path/to/crash/extensions/trace.so: no commands registered: shared
>   object unloaded
> 
> Instead of using the hard-coded value, read the enum value from the
> kernel dynamically.
> 
> Reported-by: Minchan Kim <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Signed-off-by: Namhyung Kim <[email protected]>
> ---
>  extensions/trace.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/extensions/trace.c b/extensions/trace.c
> index 782d62f..f8ccd91 100644
> --- a/extensions/trace.c
> +++ b/extensions/trace.c
> @@ -1015,8 +1015,6 @@ 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)
>  {
> @@ -1024,8 +1022,9 @@ int ftrace_get_event_type_name(ulong call, char *name,
> int len)
>       static int name_offset;
>       static int flags_offset;
>       static int tp_name_offset;
> -     uint flags;
> +     static long tracepoint_flag;
>  
> +     uint flags;
>       ulong name_addr;
>  
>       if (inited)
> @@ -1051,6 +1050,9 @@ int ftrace_get_event_type_name(ulong call, char *name,
> int len)
>       if (tp_name_offset < 0)
>               return -1;
>  
> +     if (!enumerator_value("TRACE_EVENT_FL_TRACEPOINT", &tracepoint_flag))
> +             return -1;
> +
>       inited = 2;
>  
>  work:
> @@ -1067,7 +1069,7 @@ work:
>                            RETURN_ON_ERROR))
>                       return -1;
>  
> -             if (flags & TRACE_EVENT_FL_TRACEPOINT) {
> +             if (flags & (uint)tracepoint_flag) {
>                       if (!readmem(name_addr + tp_name_offset, KVADDR,
>                                    &name_addr, sizeof(name_addr),
>                                    "read tracepoint name", RETURN_ON_ERROR))
> --
> 2.8.0
> 
> --
> Crash-utility mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/crash-utility
> 

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to