Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Simulator tracing support for Cpu tools GENerated simulators. |
e2882c85 | 2 | Copyright (C) 1996-2018 Free Software Foundation, Inc. |
c906108c SS |
3 | Contributed by Cygnus Support. |
4 | ||
5 | This file is part of GDB, the GNU debugger. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
4744ac1b JB |
9 | the Free Software Foundation; either version 3 of the License, or |
10 | (at your option) any later version. | |
c906108c SS |
11 | |
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
4744ac1b JB |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
c906108c SS |
19 | |
20 | #ifndef CGEN_TRACE_H | |
21 | #define CGEN_TRACE_H | |
22 | ||
db7858e2 MF |
23 | void cgen_trace_insn_init (SIM_CPU *, int); |
24 | void cgen_trace_insn_fini (SIM_CPU *, const struct argbuf *, int); | |
25 | void cgen_trace_insn (SIM_CPU *, const struct cgen_insn *, | |
26 | const struct argbuf *, IADDR); | |
27 | void cgen_trace_extract (SIM_CPU *, IADDR, char *, ...); | |
28 | void cgen_trace_result (SIM_CPU *, char *, int, ...); | |
c906108c SS |
29 | void cgen_trace_printf (SIM_CPU *, char *fmt, ...); |
30 | ||
31 | /* Trace instruction results. */ | |
db7858e2 MF |
32 | #define CGEN_TRACE_RESULT_P(cpu, abuf) \ |
33 | (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) | |
c906108c | 34 | |
db7858e2 | 35 | #define CGEN_TRACE_INSN_INIT(cpu, abuf, first_p) \ |
c906108c SS |
36 | do { \ |
37 | if (TRACE_INSN_P (cpu)) \ | |
db7858e2 | 38 | cgen_trace_insn_init ((cpu), (first_p)); \ |
c906108c | 39 | } while (0) |
db7858e2 | 40 | #define CGEN_TRACE_INSN_FINI(cpu, abuf, last_p) \ |
c906108c SS |
41 | do { \ |
42 | if (TRACE_INSN_P (cpu)) \ | |
db7858e2 | 43 | cgen_trace_insn_fini ((cpu), (abuf), (last_p)); \ |
c906108c | 44 | } while (0) |
db7858e2 | 45 | #define CGEN_TRACE_PRINTF(cpu, what, args) \ |
c906108c SS |
46 | do { \ |
47 | if (TRACE_P ((cpu), (what))) \ | |
48 | cgen_trace_printf args ; \ | |
49 | } while (0) | |
db7858e2 | 50 | #define CGEN_TRACE_INSN(cpu, insn, abuf, pc) \ |
c906108c SS |
51 | do { \ |
52 | if (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) \ | |
db7858e2 | 53 | cgen_trace_insn ((cpu), (insn), (abuf), (pc)) ; \ |
c906108c | 54 | } while (0) |
db7858e2 | 55 | #define CGEN_TRACE_EXTRACT(cpu, abuf, args) \ |
c906108c SS |
56 | do { \ |
57 | if (TRACE_EXTRACT_P (cpu)) \ | |
db7858e2 | 58 | cgen_trace_extract args ; \ |
c906108c | 59 | } while (0) |
db7858e2 | 60 | #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val) \ |
c906108c | 61 | do { \ |
db7858e2 MF |
62 | if (CGEN_TRACE_RESULT_P ((cpu), (abuf))) \ |
63 | cgen_trace_result ((cpu), (name), (type), (val)) ; \ | |
c906108c SS |
64 | } while (0) |
65 | \f | |
66 | /* Disassembly support. */ | |
67 | ||
68 | /* Function to use for cgen-based disassemblers. */ | |
69 | extern CGEN_DISASSEMBLER sim_cgen_disassemble_insn; | |
70 | ||
71 | /* Pseudo FILE object for strings. */ | |
72 | typedef struct { | |
73 | char *buffer; | |
74 | char *current; | |
75 | } SFILE; | |
76 | ||
77 | /* String printer for the disassembler. */ | |
78 | extern int sim_disasm_sprintf (SFILE *, const char *, ...); | |
79 | ||
80 | /* For opcodes based disassemblers. */ | |
7c3e3b33 | 81 | #ifdef __BFD_H_SEEN__ |
c906108c SS |
82 | struct disassemble_info; |
83 | extern int | |
6ec8fa7a | 84 | sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, unsigned int length_, |
c906108c SS |
85 | struct disassemble_info *info_); |
86 | extern void | |
87 | sim_disasm_perror_memory (int status_, bfd_vma memaddr_, | |
88 | struct disassemble_info *info_); | |
89 | #endif | |
90 | ||
91 | #endif /* CGEN_TRACE_H */ |