Re: [PATCH 11/20 v2] tracing: Add symbol type to function based events
From: Jiri Olsa
Date: Thu Feb 08 2018 - 06:20:42 EST
On Wed, Feb 07, 2018 at 03:24:13PM -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>
>
> Add a special type "symbol" that will use %pS to display the field of a
> function based event.
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
> ---
> Documentation/trace/function-based-events.rst | 26 +++++++++++++++++++++++++-
> kernel/trace/trace_event_ftrace.c | 13 ++++++++++---
> 2 files changed, 35 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/trace/function-based-events.rst b/Documentation/trace/function-based-events.rst
> index bdb28f433bfb..f18c8f3ef330 100644
> --- a/Documentation/trace/function-based-events.rst
> +++ b/Documentation/trace/function-based-events.rst
> @@ -98,7 +98,8 @@ as follows:
> ATOM := 'u8' | 'u16' | 'u32' | 'u64' |
> 's8' | 's16' | 's32' | 's64' |
> 'x8' | 'x16' | 'x32' | 'x64' |
> - 'char' | 'short' | 'int' | 'long' | 'size_t'
> + 'char' | 'short' | 'int' | 'long' | 'size_t' |
> + 'symbol'
>
> FIELD := <name> | <name> INDEX | <name> OFFSET | <name> OFFSET INDEX
>
> @@ -243,3 +244,26 @@ The above will take the parameter value, add it by 4, then index it by two
> 8 byte words. It's the same in C as: (u64 *)((void *)param + 4)[2]
>
> Note: "int skb[32]" is the same as "int skb+4[31]".
> +
> +
> +Symbols (function names)
> +========================
> +
> +To display kallsyms "%pS" type of output, use the special type "symbol".
> +
> +Again, using gdb to find the offset of the "func" field of struct work_struct
> +
> +(gdb) printf "%d\n", &((struct work_struct *)0)->func
> +24
you could also use Arnaldo's pahole for this, seems like less typing:
$ pahole ./vmlinux -C work_struct
die__process_function: tag not supported (INVALID)!
struct work_struct {
atomic_long_t data; /* 0 8 */
struct list_head entry; /* 8 16 */
work_func_t func; /* 24 8 */
it's in 'dwarves' package
jirka