1 /* Simulator tracing support for Cpu tools GENerated simulators.
2 Copyright (C) 1996-2014 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/>. */
23 void trace_insn_init (SIM_CPU *, int);
24 void trace_insn_fini (SIM_CPU *, const struct argbuf *, int);
25 void trace_insn (SIM_CPU *, const struct cgen_insn *,
26 const struct argbuf *, IADDR);
27 void trace_extract (SIM_CPU *, IADDR, char *, ...);
28 void trace_result (SIM_CPU *, char *, int, ...);
29 void cgen_trace_printf (SIM_CPU *, char *fmt, ...);
31 /* Trace instruction results. */
32 #define TRACE_RESULT_P(cpu, abuf) (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf))
34 #define TRACE_INSN_INIT(cpu, abuf, first_p) \
36 if (TRACE_INSN_P (cpu)) \
37 trace_insn_init ((cpu), (first_p)); \
39 #define TRACE_INSN_FINI(cpu, abuf, last_p) \
41 if (TRACE_INSN_P (cpu)) \
42 trace_insn_fini ((cpu), (abuf), (last_p)); \
44 #define TRACE_PRINTF(cpu, what, args) \
46 if (TRACE_P ((cpu), (what))) \
47 cgen_trace_printf args ; \
49 #define TRACE_INSN(cpu, insn, abuf, pc) \
51 if (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) \
52 trace_insn ((cpu), (insn), (abuf), (pc)) ; \
54 #define TRACE_EXTRACT(cpu, abuf, args) \
56 if (TRACE_EXTRACT_P (cpu)) \
57 trace_extract args ; \
59 #define TRACE_RESULT(cpu, abuf, name, type, val) \
61 if (TRACE_RESULT_P ((cpu), (abuf))) \
62 trace_result ((cpu), (name), (type), (val)) ; \
65 /* Disassembly support. */
67 /* Function to use for cgen-based disassemblers. */
68 extern CGEN_DISASSEMBLER sim_cgen_disassemble_insn;
70 /* Pseudo FILE object for strings. */
76 /* String printer for the disassembler. */
77 extern int sim_disasm_sprintf (SFILE *, const char *, ...);
79 /* For opcodes based disassemblers. */
81 struct disassemble_info;
83 sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, unsigned int length_,
84 struct disassemble_info *info_);
86 sim_disasm_perror_memory (int status_, bfd_vma memaddr_,
87 struct disassemble_info *info_);
90 #endif /* CGEN_TRACE_H */