Commit 2147c8d
libbpf: Allow Golang symbols in uprobe secdef
Golang symbols in ELF files are different from C/C++
which contains special characters like '*', '(' and ')'.
With generics, things get more complicated, there are
symbols like:
github.com/cilium/ebpf/internal.(*Deque[go.shape.interface { Format(fmt.State, int32); TypeName() string;github.com/cilium/ebpf/btf.copy() github.com/cilium/ebpf/btf.Type}]).Grow
Matching such symbols using `%m[^\n]` in sscanf, this
excludes newline which typically does not appear in ELF
symbols. This should work in most use-cases and also
work for unicode letters in identifiers. If newline do
show up in ELF symbols, users can still attach to such
symbol by specifying bpf_uprobe_opts::func_name.
A working example can be found at this repo ([0]).
[0]: https://github.com/chenhengqi/libbpf-go-symbols
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230929155954.92448-1-hengqi.chen@gmail.com1 parent 9e09b75 commit 2147c8d
1 file changed
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11114 | 11114 | | |
11115 | 11115 | | |
11116 | 11116 | | |
11117 | | - | |
| 11117 | + | |
11118 | 11118 | | |
11119 | 11119 | | |
11120 | 11120 | | |
| |||
11624 | 11624 | | |
11625 | 11625 | | |
11626 | 11626 | | |
11627 | | - | |
11628 | | - | |
| 11627 | + | |
| 11628 | + | |
11629 | 11629 | | |
11630 | 11630 | | |
11631 | 11631 | | |
11632 | 11632 | | |
11633 | | - | |
11634 | | - | |
| 11633 | + | |
| 11634 | + | |
11635 | 11635 | | |
11636 | 11636 | | |
11637 | 11637 | | |
| |||
11642 | 11642 | | |
11643 | 11643 | | |
11644 | 11644 | | |
11645 | | - | |
| 11645 | + | |
| 11646 | + | |
| 11647 | + | |
| 11648 | + | |
| 11649 | + | |
| 11650 | + | |
| 11651 | + | |
| 11652 | + | |
| 11653 | + | |
| 11654 | + | |
| 11655 | + | |
11646 | 11656 | | |
11647 | 11657 | | |
11648 | 11658 | | |
| |||
0 commit comments