Thread (47 messages) 47 messages, 6 authors, 2023-06-21

Re: [PATCH v3 bpf-next 02/10] bpftool: Dump the kernel symbol's module name

From: Yafang Shao <hidden>
Date: 2023-06-17 02:55:39
Also in: bpf

On Sat, Jun 17, 2023 at 1:25 AM Andrii Nakryiko
[off-list ref] wrote:
On Mon, Jun 12, 2023 at 8:16 AM Yafang Shao [off-list ref] wrote:
quoted
If the kernel symbol is in a module, we will dump the module name as
well.

Signed-off-by: Yafang Shao <redacted>
---
 tools/bpf/bpftool/xlated_dumper.c | 6 +++++-
 tools/bpf/bpftool/xlated_dumper.h | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/xlated_dumper.c b/tools/bpf/bpftool/xlated_dumper.c
index da608e1..dd917f3 100644
--- a/tools/bpf/bpftool/xlated_dumper.c
+++ b/tools/bpf/bpftool/xlated_dumper.c
@@ -46,7 +46,11 @@ void kernel_syms_load(struct dump_data *dd)
                }
                dd->sym_mapping = tmp;
                sym = &dd->sym_mapping[dd->sym_count];
-               if (sscanf(buff, "%p %*c %s", &address, sym->name) != 2)
+
+               /* module is optional */
+               sym->module[0] = '\0';
+               if (sscanf(buff, "%p %*c %s %s", &address, sym->name,
+                   sym->module) < 2)
nit: please keep it single line if it fits in under 100 characters
Will change it.
I thought it is 80 characters.

-- 
Regards
Yafang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help