diff options
author | Jiri Olsa <[email protected]> | 2023-08-09 10:34:22 +0200 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2023-08-21 15:51:26 -0700 |
commit | 3774705db1718a671a4ed2ac5066fea839b1d7d1 (patch) | |
tree | 2d8d2529beb35b7d8ee46affad45c5ae8744d9f1 /tools/perf/scripts/python/stackcollapse.py | |
parent | f90eb70d4489ea6fa6f3a7638aa614e15ad7181f (diff) |
libbpf: Add elf symbol iterator
Adding elf symbol iterator object (and some functions) that follow
open-coded iterator pattern and some functions to ease up iterating
elf object symbols.
The idea is to iterate single symbol section with:
struct elf_sym_iter iter;
struct elf_sym *sym;
if (elf_sym_iter_new(&iter, elf, binary_path, SHT_DYNSYM))
goto error;
while ((sym = elf_sym_iter_next(&iter))) {
...
}
I considered opening the elf inside the iterator and iterate all symbol
sections, but then it gets more complicated wrt user checks for when
the next section is processed.
Plus side is the we don't need 'exit' function, because caller/user is
in charge of that.
The returned iterated symbol object from elf_sym_iter_next function
is placed inside the struct elf_sym_iter, so no extra allocation or
argument is needed.
Suggested-by: Andrii Nakryiko <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions