• Masami Hiramatsu (Google)'s avatar
    tracing/probes: Support BTF field access from $retval · d157d769
    Masami Hiramatsu (Google) authored
    Support BTF argument on '$retval' for function return events including
    kretprobe and fprobe for accessing the return value.
    This also allows user to access its fields if the return value is a
    pointer of a data structure.
    
    E.g.
     # echo 'f getname_flags%return +0($retval->name):string' \
       > dynamic_events
     # echo 1 > events/fprobes/getname_flags__exit/enable
     # ls > /dev/null
     # head -n 40 trace | tail
                  ls-87      [000] ...1.  8067.616101: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./function_profile_enabled"
                  ls-87      [000] ...1.  8067.616108: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./trace_stat"
                  ls-87      [000] ...1.  8067.616115: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./set_graph_notrace"
                  ls-87      [000] ...1.  8067.616122: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./set_graph_function"
                  ls-87      [000] ...1.  8067.616129: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./set_ftrace_notrace"
                  ls-87      [000] ...1.  8067.616135: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./set_ftrace_filter"
                  ls-87      [000] ...1.  8067.616143: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./touched_functions"
                  ls-87      [000] ...1.  8067.616237: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./enabled_functions"
                  ls-87      [000] ...1.  8067.616245: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./available_filter_functions"
                  ls-87      [000] ...1.  8067.616253: getname_flags__exit: (vfs_fstatat+0x3c/0x70 <- getname_flags) arg1="./set_ftrace_notrace_pid"
    
    
    Link: https://lore.kernel.org/all/169272158234.160970.2446691104240645205.stgit@devnote2/Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
    Acked-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    d157d769
trace_probe.h 18.1 KB