lkml.org 
[lkml]   [2021]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/4] tracing: add error_report trace points
    On Thu, 14 Jan 2021 08:49:57 +0100
    Alexander Potapenko <glider@google.com> wrote:

    > We'll need to explicitly list the enum values once again in
    > __print_symbolic(), right? E.g.:
    >
    > enum debugging_tool {
    > TOOL_KFENCE,
    > TOOL_KASAN,
    > ...
    > }
    >
    > TP_printk(__print_symbolic(__entry->error_detector, TOOL_KFENCE,
    > TOOL_KASAN, ...),

    Usually what is done is to make this into a macro:

    #define REPORT_TOOL_LIST \
    EM(KFENCE, kfence) \
    EMe(KASAN, kasan)

    #undef EM
    #undef EMe

    #define EM(a,b) TRACE_DEFINE_ENUM(a)
    #define EMe(a,b) TRACE_DEFINE_ENUM(a)

    REPORT_TOOL_LIST

    #undef EM
    #undef EMe

    #define EM(a, b) { a, b },
    #define EMe(a, b) { a, b }

    #define show_report_tool_list(val) \
    __print_symbolic(val, REPORT_TOOL_LIST)


    [..]

    TP_printk("[%s] %lx", show_report_tool_list(__entry->error_detector),
    __entry->id)


    This is done in several other trace event files. For example, see
    include/trace/events/sock.h


    -- Steve

    \
     
     \ /
      Last update: 2021-01-14 15:54    [W:3.135 / U:0.884 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site