projects/linux·blob master · refs

57 lines · 1.7 KiB

1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __PERF_CAPSTONE_H
3#define __PERF_CAPSTONE_H
4
5#include <stdbool.h>
6#include <stdint.h>
7#include <stdio.h>
8#include <stdlib.h>
9#include <linux/compiler.h>
10#include <linux/types.h>
11
12struct annotate_args;
13struct machine;
14struct symbol;
15struct thread;
16
17#ifdef HAVE_LIBCAPSTONE_SUPPORT
18ssize_t capstone__fprintf_insn_asm(struct machine *machine, struct thread *thread, u8 cpumode,
19 bool is64bit, const uint8_t *code, size_t code_size,
20 uint64_t ip, int *lenp, int print_opts, FILE *fp);
21int symbol__disassemble_capstone(const char *filename, struct symbol *sym,
22 struct annotate_args *args);
23int symbol__disassemble_capstone_powerpc(const char *filename, struct symbol *sym,
24 struct annotate_args *args);
25
26#else /* !HAVE_LIBCAPSTONE_SUPPORT */
27static inline ssize_t capstone__fprintf_insn_asm(struct machine *machine __maybe_unused,
28 struct thread *thread __maybe_unused,
29 u8 cpumode __maybe_unused,
30 bool is64bit __maybe_unused,
31 const uint8_t *code __maybe_unused,
32 size_t code_size __maybe_unused,
33 uint64_t ip __maybe_unused,
34 int *lenp __maybe_unused,
35 int print_opts __maybe_unused,
36 FILE *fp __maybe_unused)
37{
38 return -1;
39}
40
41static inline int symbol__disassemble_capstone(const char *filename __maybe_unused,
42 struct symbol *sym __maybe_unused,
43 struct annotate_args *args __maybe_unused)
44{
45 return -1;
46}
47
48static inline int symbol__disassemble_capstone_powerpc(const char *filename __maybe_unused,
49 struct symbol *sym __maybe_unused,
50 struct annotate_args *args __maybe_unused)
51{
52 return -1;
53}
54
55#endif /* HAVE_LIBCAPSTONE_SUPPORT */
56
57#endif /* __PERF_CAPSTONE_H */