1 |
24 |
jeremybenn |
/* Simulator tracing support for Cpu tools GENerated simulators.
|
2 |
|
|
Copyright (C) 1996, 1997, 1998, 1999, 2007, 2008
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
Contributed by Cygnus Support.
|
5 |
|
|
|
6 |
|
|
This file is part of GDB, the GNU debugger.
|
7 |
|
|
|
8 |
|
|
This program is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
This program is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
#ifndef CGEN_TRACE_H
|
22 |
|
|
#define CGEN_TRACE_H
|
23 |
|
|
|
24 |
|
|
void trace_insn_init (SIM_CPU *, int);
|
25 |
|
|
void trace_insn_fini (SIM_CPU *, const struct argbuf *, int);
|
26 |
|
|
void trace_insn (SIM_CPU *, const struct cgen_insn *,
|
27 |
|
|
const struct argbuf *, IADDR);
|
28 |
|
|
void trace_extract (SIM_CPU *, IADDR, char *, ...);
|
29 |
|
|
void trace_result (SIM_CPU *, char *, int, ...);
|
30 |
|
|
void cgen_trace_printf (SIM_CPU *, char *fmt, ...);
|
31 |
|
|
|
32 |
|
|
/* Trace instruction results. */
|
33 |
|
|
#define TRACE_RESULT_P(cpu, abuf) (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf))
|
34 |
|
|
|
35 |
|
|
#define TRACE_INSN_INIT(cpu, abuf, first_p) \
|
36 |
|
|
do { \
|
37 |
|
|
if (TRACE_INSN_P (cpu)) \
|
38 |
|
|
trace_insn_init ((cpu), (first_p)); \
|
39 |
|
|
} while (0)
|
40 |
|
|
#define TRACE_INSN_FINI(cpu, abuf, last_p) \
|
41 |
|
|
do { \
|
42 |
|
|
if (TRACE_INSN_P (cpu)) \
|
43 |
|
|
trace_insn_fini ((cpu), (abuf), (last_p)); \
|
44 |
|
|
} while (0)
|
45 |
|
|
#define TRACE_PRINTF(cpu, what, args) \
|
46 |
|
|
do { \
|
47 |
|
|
if (TRACE_P ((cpu), (what))) \
|
48 |
|
|
cgen_trace_printf args ; \
|
49 |
|
|
} while (0)
|
50 |
|
|
#define TRACE_INSN(cpu, insn, abuf, pc) \
|
51 |
|
|
do { \
|
52 |
|
|
if (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) \
|
53 |
|
|
trace_insn ((cpu), (insn), (abuf), (pc)) ; \
|
54 |
|
|
} while (0)
|
55 |
|
|
#define TRACE_EXTRACT(cpu, abuf, args) \
|
56 |
|
|
do { \
|
57 |
|
|
if (TRACE_EXTRACT_P (cpu)) \
|
58 |
|
|
trace_extract args ; \
|
59 |
|
|
} while (0)
|
60 |
|
|
#define TRACE_RESULT(cpu, abuf, name, type, val) \
|
61 |
|
|
do { \
|
62 |
|
|
if (TRACE_RESULT_P ((cpu), (abuf))) \
|
63 |
|
|
trace_result ((cpu), (name), (type), (val)) ; \
|
64 |
|
|
} while (0)
|
65 |
|
|
|
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. */
|
81 |
|
|
#ifdef __BFD_H_SEEN__
|
82 |
|
|
struct disassemble_info;
|
83 |
|
|
extern int
|
84 |
|
|
sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, unsigned int length_,
|
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 */
|