aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/trace_helpers.h
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2021-09-10 11:33:52 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-09-13 10:53:50 -0700
commit025bd7c753aab18cd594924a46ab46ac47209df9 (patch)
tree2d03c43e8c339f5b95a134cfe802862b65d45d8b /tools/testing/selftests/bpf/trace_helpers.h
parentbpf: Introduce helper bpf_get_branch_snapshot (diff)
downloadlinux-dev-025bd7c753aab18cd594924a46ab46ac47209df9.tar.xz
linux-dev-025bd7c753aab18cd594924a46ab46ac47209df9.zip
selftests/bpf: Add test for bpf_get_branch_snapshot
This test uses bpf_get_branch_snapshot from a fexit program. The test uses a target function (bpf_testmod_loop_test) and compares the record against kallsyms. If there isn't enough record matching kallsyms, the test fails. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20210910183352.3151445-4-songliubraving@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/trace_helpers.h')
-rw-r--r--tools/testing/selftests/bpf/trace_helpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/trace_helpers.h b/tools/testing/selftests/bpf/trace_helpers.h
index d907b445524d..bc8ed86105d9 100644
--- a/tools/testing/selftests/bpf/trace_helpers.h
+++ b/tools/testing/selftests/bpf/trace_helpers.h
@@ -16,6 +16,11 @@ long ksym_get_addr(const char *name);
/* open kallsyms and find addresses on the fly, faster than load + search. */
int kallsyms_find(const char *sym, unsigned long long *addr);
+/* find the address of the next symbol, this can be used to determine the
+ * end of a function
+ */
+int kallsyms_find_next(const char *sym, unsigned long long *addr);
+
void read_trace_pipe(void);
ssize_t get_uprobe_offset(const void *addr, ssize_t base);