diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2017-12-20 18:09:41 -0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2017-12-20 18:09:42 -0800 |
| commit | 7466177635be4d5f2452284085b5c2cc299367fe (patch) | |
| tree | 47cca432779b910dab12ee5cc81b792f6e432a76 /kernel/bpf/disasm.h | |
| parent | 7d9890ef505a8c2a778d304535e26e827d58c466 (diff) | |
| parent | 7105e828c087de970fcb5a9509db51bfe6bd7894 (diff) | |
Merge branch 'bpftool-improvements-kallsymfix'
Daniel Borkmann says:
====================
This work adds correlation of maps and calls into the bpftool
xlated dump in order to help debugging and introspection of
loaded BPF progs. First patch makes kallsyms work on subprogs
with bpf calls, and second implements the actual correlation.
Details and example output can be found in the 2nd patch.
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/disasm.h')
| -rw-r--r-- | kernel/bpf/disasm.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/kernel/bpf/disasm.h b/kernel/bpf/disasm.h index 8de977e420b6..e0857d016f89 100644 --- a/kernel/bpf/disasm.h +++ b/kernel/bpf/disasm.h @@ -17,16 +17,35 @@ #include <linux/bpf.h> #include <linux/kernel.h> #include <linux/stringify.h> +#ifndef __KERNEL__ +#include <stdio.h> +#include <string.h> +#endif + +struct bpf_verifier_env; extern const char *const bpf_alu_string[16]; extern const char *const bpf_class_string[8]; const char *func_id_name(int id); -struct bpf_verifier_env; -typedef void (*bpf_insn_print_cb)(struct bpf_verifier_env *env, - const char *, ...); -void print_bpf_insn(bpf_insn_print_cb verbose, struct bpf_verifier_env *env, - const struct bpf_insn *insn, bool allow_ptr_leaks); +typedef void (*bpf_insn_print_t)(struct bpf_verifier_env *env, + const char *, ...); +typedef const char *(*bpf_insn_revmap_call_t)(void *private_data, + const struct bpf_insn *insn); +typedef const char *(*bpf_insn_print_imm_t)(void *private_data, + const struct bpf_insn *insn, + __u64 full_imm); + +struct bpf_insn_cbs { + bpf_insn_print_t cb_print; + bpf_insn_revmap_call_t cb_call; + bpf_insn_print_imm_t cb_imm; + void *private_data; +}; +void print_bpf_insn(const struct bpf_insn_cbs *cbs, + struct bpf_verifier_env *env, + const struct bpf_insn *insn, + bool allow_ptr_leaks); #endif |
