Loading...
1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2/* Copyright (C) 2018 Netronome Systems, Inc. */
3
4#ifndef __BPF_TOOL_XLATED_DUMPER_H
5#define __BPF_TOOL_XLATED_DUMPER_H
6
7#define SYM_MAX_NAME 256
8#define MODULE_MAX_NAME 64
9
10struct bpf_prog_linfo;
11
12struct kernel_sym {
13 unsigned long address;
14 char name[SYM_MAX_NAME];
15 char module[MODULE_MAX_NAME];
16};
17
18struct dump_data {
19 unsigned long address_call_base;
20 struct kernel_sym *sym_mapping;
21 __u32 sym_count;
22 __u64 *jited_ksyms;
23 __u32 nr_jited_ksyms;
24 struct btf *btf;
25 void *func_info;
26 __u32 finfo_rec_size;
27 const struct bpf_prog_linfo *prog_linfo;
28 char scratch_buff[SYM_MAX_NAME + 8];
29};
30
31void kernel_syms_load(struct dump_data *dd);
32void kernel_syms_destroy(struct dump_data *dd);
33struct kernel_sym *kernel_syms_search(struct dump_data *dd, unsigned long key);
34void dump_xlated_json(struct dump_data *dd, void *buf, unsigned int len,
35 bool opcodes, bool linum);
36void dump_xlated_plain(struct dump_data *dd, void *buf, unsigned int len,
37 bool opcodes, bool linum);
38void dump_xlated_for_graph(struct dump_data *dd, void *buf, void *buf_end,
39 unsigned int start_index,
40 bool opcodes, bool linum);
41
42#endif
1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2/*
3 * Copyright (C) 2018 Netronome Systems, Inc.
4 *
5 * This software is dual licensed under the GNU General License Version 2,
6 * June 1991 as shown in the file COPYING in the top-level directory of this
7 * source tree or the BSD 2-Clause License provided below. You have the
8 * option to license this software under the complete terms of either license.
9 *
10 * The BSD 2-Clause License:
11 *
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
14 * conditions are met:
15 *
16 * 1. Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
19 *
20 * 2. Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef __BPF_TOOL_XLATED_DUMPER_H
39#define __BPF_TOOL_XLATED_DUMPER_H
40
41#define SYM_MAX_NAME 256
42
43struct kernel_sym {
44 unsigned long address;
45 char name[SYM_MAX_NAME];
46};
47
48struct dump_data {
49 unsigned long address_call_base;
50 struct kernel_sym *sym_mapping;
51 __u32 sym_count;
52 char scratch_buff[SYM_MAX_NAME + 8];
53};
54
55void kernel_syms_load(struct dump_data *dd);
56void kernel_syms_destroy(struct dump_data *dd);
57void dump_xlated_json(struct dump_data *dd, void *buf, unsigned int len,
58 bool opcodes);
59void dump_xlated_plain(struct dump_data *dd, void *buf, unsigned int len,
60 bool opcodes);
61void dump_xlated_for_graph(struct dump_data *dd, void *buf, void *buf_end,
62 unsigned int start_index);
63
64#endif