mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
bpftool: Dump the kernel symbol's module name
If the kernel symbol is in a module, we will dump the module name as well. The square brackets around the module name are trimmed. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20230709025630.3735-3-laoar.shao@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
7ac8d0d261
commit
dc6519445b
2 changed files with 7 additions and 1 deletions
|
@ -46,7 +46,11 @@ out:
|
||||||
}
|
}
|
||||||
dd->sym_mapping = tmp;
|
dd->sym_mapping = tmp;
|
||||||
sym = &dd->sym_mapping[dd->sym_count];
|
sym = &dd->sym_mapping[dd->sym_count];
|
||||||
if (sscanf(buff, "%p %*c %s", &address, sym->name) != 2)
|
|
||||||
|
/* module is optional */
|
||||||
|
sym->module[0] = '\0';
|
||||||
|
/* trim the square brackets around the module name */
|
||||||
|
if (sscanf(buff, "%p %*c %s [%[^]]s", &address, sym->name, sym->module) < 2)
|
||||||
continue;
|
continue;
|
||||||
sym->address = (unsigned long)address;
|
sym->address = (unsigned long)address;
|
||||||
if (!strcmp(sym->name, "__bpf_call_base")) {
|
if (!strcmp(sym->name, "__bpf_call_base")) {
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
#define __BPF_TOOL_XLATED_DUMPER_H
|
#define __BPF_TOOL_XLATED_DUMPER_H
|
||||||
|
|
||||||
#define SYM_MAX_NAME 256
|
#define SYM_MAX_NAME 256
|
||||||
|
#define MODULE_MAX_NAME 64
|
||||||
|
|
||||||
struct bpf_prog_linfo;
|
struct bpf_prog_linfo;
|
||||||
|
|
||||||
struct kernel_sym {
|
struct kernel_sym {
|
||||||
unsigned long address;
|
unsigned long address;
|
||||||
char name[SYM_MAX_NAME];
|
char name[SYM_MAX_NAME];
|
||||||
|
char module[MODULE_MAX_NAME];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dump_data {
|
struct dump_data {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue