]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/cgen-trace.h
Switch the license of all files explicitly copyright the FSF
[thirdparty/binutils-gdb.git] / sim / common / cgen-trace.h
CommitLineData
c906108c 1/* Simulator tracing support for Cpu tools GENerated simulators.
6aba47ca 2 Copyright (C) 1996, 1997, 1998, 1999, 2007 Free Software Foundation, Inc.
c906108c
SS
3 Contributed by Cygnus Support.
4
5This file is part of GDB, the GNU debugger.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
4744ac1b
JB
9the Free Software Foundation; either version 3 of the License, or
10(at your option) any later version.
c906108c
SS
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
4744ac1b
JB
17You should have received a copy of the GNU General Public License
18along 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
23void trace_insn_init (SIM_CPU *, int);
24void trace_insn_fini (SIM_CPU *, const struct argbuf *, int);
25void trace_insn (SIM_CPU *, const struct cgen_insn *,
26 const struct argbuf *, IADDR);
27void trace_extract (SIM_CPU *, IADDR, char *, ...);
28void trace_result (SIM_CPU *, char *, int, ...);
29void cgen_trace_printf (SIM_CPU *, char *fmt, ...);
30
31/* Trace instruction results. */
32#define TRACE_RESULT_P(cpu, abuf) (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf))
33
34#define TRACE_INSN_INIT(cpu, abuf, first_p) \
35do { \
36 if (TRACE_INSN_P (cpu)) \
37 trace_insn_init ((cpu), (first_p)); \
38} while (0)
39#define TRACE_INSN_FINI(cpu, abuf, last_p) \
40do { \
41 if (TRACE_INSN_P (cpu)) \
42 trace_insn_fini ((cpu), (abuf), (last_p)); \
43} while (0)
44#define TRACE_PRINTF(cpu, what, args) \
45do { \
46 if (TRACE_P ((cpu), (what))) \
47 cgen_trace_printf args ; \
48} while (0)
49#define TRACE_INSN(cpu, insn, abuf, pc) \
50do { \
51 if (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) \
52 trace_insn ((cpu), (insn), (abuf), (pc)) ; \
53} while (0)
54#define TRACE_EXTRACT(cpu, abuf, args) \
55do { \
56 if (TRACE_EXTRACT_P (cpu)) \
57 trace_extract args ; \
58} while (0)
59#define TRACE_RESULT(cpu, abuf, name, type, val) \
60do { \
61 if (TRACE_RESULT_P ((cpu), (abuf))) \
62 trace_result ((cpu), (name), (type), (val)) ; \
63} while (0)
64\f
65/* Disassembly support. */
66
67/* Function to use for cgen-based disassemblers. */
68extern CGEN_DISASSEMBLER sim_cgen_disassemble_insn;
69
70/* Pseudo FILE object for strings. */
71typedef struct {
72 char *buffer;
73 char *current;
74} SFILE;
75
76/* String printer for the disassembler. */
77extern int sim_disasm_sprintf (SFILE *, const char *, ...);
78
79/* For opcodes based disassemblers. */
7c3e3b33 80#ifdef __BFD_H_SEEN__
c906108c
SS
81struct disassemble_info;
82extern int
6ec8fa7a 83sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, unsigned int length_,
c906108c
SS
84 struct disassemble_info *info_);
85extern void
86sim_disasm_perror_memory (int status_, bfd_vma memaddr_,
87 struct disassemble_info *info_);
88#endif
89
90#endif /* CGEN_TRACE_H */