blob: 54847e174273794291c4ce3fe5c6179a1e13f38f [file] [log] [blame]
Jakub Kicinskiafc7c942018-12-12 19:59:24 -08001/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
Jakub Kicinski02ff58d2018-12-12 19:59:25 -08002/* Copyright (C) 2018 Netronome Systems, Inc. */
Jiong Wang73bb5b42018-03-01 18:01:17 -08003
4#ifndef __BPF_TOOL_XLATED_DUMPER_H
5#define __BPF_TOOL_XLATED_DUMPER_H
6
7#define SYM_MAX_NAME 256
8
Martin KaFai Laub053b432018-12-07 16:42:32 -08009struct bpf_prog_linfo;
10
Jiong Wang73bb5b42018-03-01 18:01:17 -080011struct kernel_sym {
12 unsigned long address;
13 char name[SYM_MAX_NAME];
14};
15
16struct dump_data {
17 unsigned long address_call_base;
18 struct kernel_sym *sym_mapping;
19 __u32 sym_count;
Sandipan Dasf84192e2018-05-24 12:26:50 +053020 __u64 *jited_ksyms;
21 __u32 nr_jited_ksyms;
Yonghong Song254471e2018-11-19 15:29:21 -080022 struct btf *btf;
23 void *func_info;
24 __u32 finfo_rec_size;
Martin KaFai Laub053b432018-12-07 16:42:32 -080025 const struct bpf_prog_linfo *prog_linfo;
Jakub Kicinskid5fc73d2018-03-15 23:26:15 -070026 char scratch_buff[SYM_MAX_NAME + 8];
Jiong Wang73bb5b42018-03-01 18:01:17 -080027};
28
29void kernel_syms_load(struct dump_data *dd);
30void kernel_syms_destroy(struct dump_data *dd);
Sandipan Dasf7f62c72018-05-24 12:26:54 +053031struct kernel_sym *kernel_syms_search(struct dump_data *dd, unsigned long key);
Jiong Wang73bb5b42018-03-01 18:01:17 -080032void dump_xlated_json(struct dump_data *dd, void *buf, unsigned int len,
Martin KaFai Laub053b432018-12-07 16:42:32 -080033 bool opcodes, bool linum);
Jiong Wang73bb5b42018-03-01 18:01:17 -080034void dump_xlated_plain(struct dump_data *dd, void *buf, unsigned int len,
Martin KaFai Laub053b432018-12-07 16:42:32 -080035 bool opcodes, bool linum);
Jiong Wangefcef172018-03-01 18:01:21 -080036void dump_xlated_for_graph(struct dump_data *dd, void *buf, void *buf_end,
37 unsigned int start_index);
Jiong Wang73bb5b42018-03-01 18:01:17 -080038
39#endif