1 /* Simulator tracing support for Cpu tools GENerated simulators.
2 Copyright (C) 1996-2023 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GDB, the GNU debugger.
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
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
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.
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/>. */
26 void cgen_trace_insn_init (SIM_CPU
*, int);
27 void cgen_trace_insn_fini (SIM_CPU
*, const struct argbuf
*, int);
28 void cgen_trace_insn (SIM_CPU
*, const struct cgen_insn
*,
29 const struct argbuf
*, IADDR
);
30 void cgen_trace_extract (SIM_CPU
*, IADDR
, const char *, ...);
31 void cgen_trace_result (SIM_CPU
*, const char *, int, ...);
32 void cgen_trace_printf (SIM_CPU
*, const char *fmt
, ...) ATTRIBUTE_PRINTF_2
;
34 /* Trace instruction results. */
35 #define CGEN_TRACE_RESULT_P(cpu, abuf) \
36 (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf))
38 #define CGEN_TRACE_INSN_INIT(cpu, abuf, first_p) \
40 if (TRACE_INSN_P (cpu)) \
41 cgen_trace_insn_init ((cpu), (first_p)); \
43 #define CGEN_TRACE_INSN_FINI(cpu, abuf, last_p) \
45 if (TRACE_INSN_P (cpu)) \
46 cgen_trace_insn_fini ((cpu), (abuf), (last_p)); \
48 #define CGEN_TRACE_PRINTF(cpu, what, args) \
50 if (TRACE_P ((cpu), (what))) \
51 cgen_trace_printf args ; \
53 #define CGEN_TRACE_INSN(cpu, insn, abuf, pc) \
55 if (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) \
56 cgen_trace_insn ((cpu), (insn), (abuf), (pc)) ; \
58 #define CGEN_TRACE_EXTRACT(cpu, abuf, args) \
60 if (TRACE_EXTRACT_P (cpu)) \
61 cgen_trace_extract args ; \
63 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val) \
65 if (CGEN_TRACE_RESULT_P ((cpu), (abuf))) \
66 cgen_trace_result ((cpu), (name), (type), (val)) ; \
69 /* Disassembly support. */
71 /* Function to use for cgen-based disassemblers. */
72 extern CGEN_DISASSEMBLER sim_cgen_disassemble_insn
;
74 /* Pseudo FILE object for strings. */
80 /* String printer for the disassembler. */
81 extern int sim_disasm_sprintf (SFILE
*, const char *, ...) ATTRIBUTE_PRINTF_2
;
82 extern int sim_disasm_styled_sprintf (SFILE
*, enum disassembler_style
, const char *, ...) ATTRIBUTE_PRINTF_3
;
84 /* For opcodes based disassemblers. */
86 struct disassemble_info
;
88 sim_disasm_read_memory (bfd_vma memaddr_
, bfd_byte
*myaddr_
, unsigned int length_
,
89 struct disassemble_info
*info_
);
91 sim_disasm_perror_memory (int status_
, bfd_vma memaddr_
,
92 struct disassemble_info
*info_
);
95 #endif /* CGEN_TRACE_H */