]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/cgen-trace.h
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / sim / common / cgen-trace.h
CommitLineData
c906108c 1/* Simulator tracing support for Cpu tools GENerated simulators.
1d506c26 2 Copyright (C) 1996-2024 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
843bf754 23#include "ansidecl.h"
6cf3ddd2 24#include "bfd.h"
843bf754 25
db7858e2
MF
26void cgen_trace_insn_init (SIM_CPU *, int);
27void cgen_trace_insn_fini (SIM_CPU *, const struct argbuf *, int);
28void cgen_trace_insn (SIM_CPU *, const struct cgen_insn *,
29 const struct argbuf *, IADDR);
ded82565
MF
30void cgen_trace_extract (SIM_CPU *, IADDR, const char *, ...);
31void cgen_trace_result (SIM_CPU *, const char *, int, ...);
a7ffa88d 32void cgen_trace_printf (SIM_CPU *, const char *fmt, ...) ATTRIBUTE_PRINTF_2;
c906108c
SS
33
34/* Trace instruction results. */
db7858e2
MF
35#define CGEN_TRACE_RESULT_P(cpu, abuf) \
36 (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf))
c906108c 37
db7858e2 38#define CGEN_TRACE_INSN_INIT(cpu, abuf, first_p) \
c906108c
SS
39do { \
40 if (TRACE_INSN_P (cpu)) \
db7858e2 41 cgen_trace_insn_init ((cpu), (first_p)); \
c906108c 42} while (0)
db7858e2 43#define CGEN_TRACE_INSN_FINI(cpu, abuf, last_p) \
c906108c
SS
44do { \
45 if (TRACE_INSN_P (cpu)) \
db7858e2 46 cgen_trace_insn_fini ((cpu), (abuf), (last_p)); \
c906108c 47} while (0)
db7858e2 48#define CGEN_TRACE_PRINTF(cpu, what, args) \
c906108c
SS
49do { \
50 if (TRACE_P ((cpu), (what))) \
51 cgen_trace_printf args ; \
52} while (0)
db7858e2 53#define CGEN_TRACE_INSN(cpu, insn, abuf, pc) \
c906108c
SS
54do { \
55 if (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) \
db7858e2 56 cgen_trace_insn ((cpu), (insn), (abuf), (pc)) ; \
c906108c 57} while (0)
db7858e2 58#define CGEN_TRACE_EXTRACT(cpu, abuf, args) \
c906108c
SS
59do { \
60 if (TRACE_EXTRACT_P (cpu)) \
db7858e2 61 cgen_trace_extract args ; \
c906108c 62} while (0)
db7858e2 63#define CGEN_TRACE_RESULT(cpu, abuf, name, type, val) \
c906108c 64do { \
db7858e2
MF
65 if (CGEN_TRACE_RESULT_P ((cpu), (abuf))) \
66 cgen_trace_result ((cpu), (name), (type), (val)) ; \
c906108c
SS
67} while (0)
68\f
69/* Disassembly support. */
70
71/* Function to use for cgen-based disassemblers. */
72extern CGEN_DISASSEMBLER sim_cgen_disassemble_insn;
73
74/* Pseudo FILE object for strings. */
75typedef struct {
76 char *buffer;
77 char *current;
78} SFILE;
79
80/* String printer for the disassembler. */
a7ffa88d 81extern int sim_disasm_sprintf (SFILE *, const char *, ...) ATTRIBUTE_PRINTF_2;
7b01c1cc 82extern int sim_disasm_styled_sprintf (SFILE *, enum disassembler_style, const char *, ...) ATTRIBUTE_PRINTF_3;
c906108c
SS
83
84/* For opcodes based disassemblers. */
7c3e3b33 85#ifdef __BFD_H_SEEN__
c906108c
SS
86struct disassemble_info;
87extern int
6ec8fa7a 88sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, unsigned int length_,
c906108c
SS
89 struct disassemble_info *info_);
90extern void
91sim_disasm_perror_memory (int status_, bfd_vma memaddr_,
92 struct disassemble_info *info_);
93#endif
94
95#endif /* CGEN_TRACE_H */