tracing/probes: Add symstr type for dynamic events
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Mon, 14 Nov 2022 04:47:56 +0000 (13:47 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Wed, 14 Dec 2022 23:48:57 +0000 (08:48 +0900)
commitb26a124cbfa80f42bfc4e63e1d5643ca98159d66
tree7ee46364505d3e2947596f13b731c752907f724e
parent3b7ddab8a19aefc768f345fd3782af35b4a68d9b
tracing/probes: Add symstr type for dynamic events

Add 'symstr' type for storing the kernel symbol as a string data
instead of the symbol address. This allows us to filter the
events by wildcard symbol name.

e.g.
  # echo 'e:wqfunc workqueue.workqueue_execute_start symname=$function:symstr' >> dynamic_events
  # cat events/eprobes/wqfunc/format
  name: wqfunc
  ID: 2110
  format:
   field:unsigned short common_type; offset:0; size:2; signed:0;
   field:unsigned char common_flags; offset:2; size:1; signed:0;
   field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
   field:int common_pid; offset:4; size:4; signed:1;

   field:__data_loc char[] symname; offset:8; size:4; signed:1;

  print fmt: " symname=\"%s\"", __get_str(symname)

Note that there is already 'symbol' type which just change the
print format (so it still stores the symbol address in the tracing
ring buffer.) On the other hand, 'symstr' type stores the actual
"symbol+offset/size" data as a string.

Link: https://lore.kernel.org/all/166679930847.1528100.4124308529180235965.stgit@devnote3/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Documentation/trace/kprobetrace.rst
kernel/trace/trace.c
kernel/trace/trace_probe.c
kernel/trace/trace_probe.h
kernel/trace/trace_probe_tmpl.h