diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-25 16:09:55 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-26 12:47:14 -0400 |
commit | 494e31e2a2b1cdc3efc60043fac5bbd39a6fb04f (patch) | |
tree | 003140a70c175f01b70767ea9a39a4b607fe6fbc /tools/lib | |
parent | 5cf88a6325ad75efe4f01204086d216b5d7f1ea8 (diff) |
tools lib symbols: Introduce kallsyms__is_function()
Out of symbol_type__is_a(type, MAP__FUNCTION), which is the only variant
used so far, useful in a kallsyms library and one more step in ditching
the MAP__FUNCTION/VARIABLE split.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-faonqs76n5808z9mq77edr94@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/symbol/kallsyms.c | 6 | ||||
-rw-r--r-- | tools/lib/symbol/kallsyms.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tools/lib/symbol/kallsyms.c b/tools/lib/symbol/kallsyms.c index 689b6a130dd7..96d830545bbb 100644 --- a/tools/lib/symbol/kallsyms.c +++ b/tools/lib/symbol/kallsyms.c | |||
@@ -10,6 +10,12 @@ u8 kallsyms2elf_type(char type) | |||
10 | return (type == 't' || type == 'w') ? STT_FUNC : STT_OBJECT; | 10 | return (type == 't' || type == 'w') ? STT_FUNC : STT_OBJECT; |
11 | } | 11 | } |
12 | 12 | ||
13 | bool kallsyms__is_function(char symbol_type) | ||
14 | { | ||
15 | symbol_type = toupper(symbol_type); | ||
16 | return symbol_type == 'T' || symbol_type == 'W'; | ||
17 | } | ||
18 | |||
13 | int kallsyms__parse(const char *filename, void *arg, | 19 | int kallsyms__parse(const char *filename, void *arg, |
14 | int (*process_symbol)(void *arg, const char *name, | 20 | int (*process_symbol)(void *arg, const char *name, |
15 | char type, u64 start)) | 21 | char type, u64 start)) |
diff --git a/tools/lib/symbol/kallsyms.h b/tools/lib/symbol/kallsyms.h index bc40101d72c1..72ab9870454b 100644 --- a/tools/lib/symbol/kallsyms.h +++ b/tools/lib/symbol/kallsyms.h | |||
@@ -20,6 +20,8 @@ static inline u8 kallsyms2elf_binding(char type) | |||
20 | 20 | ||
21 | u8 kallsyms2elf_type(char type); | 21 | u8 kallsyms2elf_type(char type); |
22 | 22 | ||
23 | bool kallsyms__is_function(char symbol_type); | ||
24 | |||
23 | int kallsyms__parse(const char *filename, void *arg, | 25 | int kallsyms__parse(const char *filename, void *arg, |
24 | int (*process_symbol)(void *arg, const char *name, | 26 | int (*process_symbol)(void *arg, const char *name, |
25 | char type, u64 start)); | 27 | char type, u64 start)); |