]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Add ftrace_lookup_symbols function
authorJiri Olsa <jolsa@kernel.org>
Tue, 10 May 2022 12:26:13 +0000 (14:26 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 10 May 2022 21:42:06 +0000 (14:42 -0700)
commitcf4c31b22c422c62b1c2e2229c89eb23f7c691a9
treeb9cb3e2df9448906c6445c812033f6b3e4e92f3d
parent77968047b3d09c50918add609df63c06ceb87d5d
ftrace: Add ftrace_lookup_symbols function

Adding ftrace_lookup_symbols function that resolves array of symbols
with single pass over kallsyms.

The user provides array of string pointers with count and pointer to
allocated array for resolved values.

  int ftrace_lookup_symbols(const char **sorted_syms, size_t cnt,
                            unsigned long *addrs)

It iterates all kallsyms symbols and tries to loop up each in provided
symbols array with bsearch. The symbols array needs to be sorted by
name for this reason.

We also check each symbol to pass ftrace_location, because this API
will be used for fprobe symbols resolving.

Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220510122616.2652285-3-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/ftrace.h
kernel/kallsyms.c
kernel/trace/ftrace.c