1 |
106 |
markom |
/* Simulator tracing/debugging support.
|
2 |
|
|
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Cygnus Support.
|
4 |
|
|
|
5 |
|
|
This file is part of GDB, the GNU debugger.
|
6 |
|
|
|
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 2, or (at your option)
|
10 |
|
|
any later version.
|
11 |
|
|
|
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.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License along
|
18 |
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
19 |
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
20 |
|
|
|
21 |
|
|
/* This file is meant to be included by sim-basics.h. */
|
22 |
|
|
|
23 |
|
|
#ifndef SIM_TRACE_H
|
24 |
|
|
#define SIM_TRACE_H
|
25 |
|
|
|
26 |
|
|
/* Standard traceable entities. */
|
27 |
|
|
|
28 |
|
|
enum {
|
29 |
|
|
/* Trace insn execution. */
|
30 |
|
|
TRACE_INSN_IDX = 1,
|
31 |
|
|
|
32 |
|
|
/* Trace insn decoding.
|
33 |
|
|
??? This is more of a simulator debugging operation and might best be
|
34 |
|
|
moved to --debug-decode. */
|
35 |
|
|
TRACE_DECODE_IDX,
|
36 |
|
|
|
37 |
|
|
/* Trace insn extraction.
|
38 |
|
|
??? This is more of a simulator debugging operation and might best be
|
39 |
|
|
moved to --debug-extract. */
|
40 |
|
|
TRACE_EXTRACT_IDX,
|
41 |
|
|
|
42 |
|
|
/* Trace insn execution but include line numbers. */
|
43 |
|
|
TRACE_LINENUM_IDX,
|
44 |
|
|
|
45 |
|
|
/* Trace memory operations.
|
46 |
|
|
The difference between this and TRACE_CORE_IDX is (I think) that this
|
47 |
|
|
is intended to apply to a higher level. TRACE_CORE_IDX applies to the
|
48 |
|
|
low level core operations. */
|
49 |
|
|
TRACE_MEMORY_IDX,
|
50 |
|
|
|
51 |
|
|
/* Include model performance data in tracing output. */
|
52 |
|
|
TRACE_MODEL_IDX,
|
53 |
|
|
|
54 |
|
|
/* Trace ALU operations. */
|
55 |
|
|
TRACE_ALU_IDX,
|
56 |
|
|
|
57 |
|
|
/* Trace memory core operations. */
|
58 |
|
|
TRACE_CORE_IDX,
|
59 |
|
|
|
60 |
|
|
/* Trace events. */
|
61 |
|
|
TRACE_EVENTS_IDX,
|
62 |
|
|
|
63 |
|
|
/* Trace fpu operations. */
|
64 |
|
|
TRACE_FPU_IDX,
|
65 |
|
|
|
66 |
|
|
/* Trace branching. */
|
67 |
|
|
TRACE_BRANCH_IDX,
|
68 |
|
|
|
69 |
|
|
/* Add information useful for debugging the simulator to trace output. */
|
70 |
|
|
TRACE_DEBUG_IDX,
|
71 |
|
|
|
72 |
|
|
/* Simulator specific trace bits begin here. */
|
73 |
|
|
TRACE_NEXT_IDX,
|
74 |
|
|
|
75 |
|
|
};
|
76 |
|
|
/* Maximum number of traceable entities. */
|
77 |
|
|
#ifndef MAX_TRACE_VALUES
|
78 |
|
|
#define MAX_TRACE_VALUES 32
|
79 |
|
|
#endif
|
80 |
|
|
|
81 |
|
|
/* The -t option only prints useful values. It's easy to type and shouldn't
|
82 |
|
|
splat on the screen everything under the sun making nothing easy to
|
83 |
|
|
find. */
|
84 |
|
|
#define TRACE_USEFUL_MASK \
|
85 |
|
|
((1 << TRACE_INSN_IDX) \
|
86 |
|
|
| (1 << TRACE_LINENUM_IDX) \
|
87 |
|
|
| (1 << TRACE_MEMORY_IDX) \
|
88 |
|
|
| (1 << TRACE_MODEL_IDX) \
|
89 |
|
|
| (1 << TRACE_EVENTS_IDX))
|
90 |
|
|
|
91 |
|
|
/* Masks so WITH_TRACE can have symbolic values.
|
92 |
|
|
The case choice here is on purpose. The lowercase parts are args to
|
93 |
|
|
--with-trace. */
|
94 |
|
|
#define TRACE_insn (1 << TRACE_INSN_IDX)
|
95 |
|
|
#define TRACE_decode (1 << TRACE_DECODE_IDX)
|
96 |
|
|
#define TRACE_extract (1 << TRACE_EXTRACT_IDX)
|
97 |
|
|
#define TRACE_linenum (1 << TRACE_LINENUM_IDX)
|
98 |
|
|
#define TRACE_memory (1 << TRACE_MEMORY_IDX)
|
99 |
|
|
#define TRACE_model (1 << TRACE_MODEL_IDX)
|
100 |
|
|
#define TRACE_alu (1 << TRACE_ALU_IDX)
|
101 |
|
|
#define TRACE_core (1 << TRACE_CORE_IDX)
|
102 |
|
|
#define TRACE_events (1 << TRACE_EVENTS_IDX)
|
103 |
|
|
#define TRACE_fpu (1 << TRACE_FPU_IDX)
|
104 |
|
|
#define TRACE_branch (1 << TRACE_BRANCH_IDX)
|
105 |
|
|
#define TRACE_debug (1 << TRACE_DEBUG_IDX)
|
106 |
|
|
|
107 |
|
|
/* Preprocessor macros to simplify tests of WITH_TRACE. */
|
108 |
|
|
#define WITH_TRACE_INSN_P (WITH_TRACE & TRACE_insn)
|
109 |
|
|
#define WITH_TRACE_DECODE_P (WITH_TRACE & TRACE_decode)
|
110 |
|
|
#define WITH_TRACE_EXTRACT_P (WITH_TRACE & TRACE_extract)
|
111 |
|
|
#define WITH_TRACE_LINENUM_P (WITH_TRACE & TRACE_linenum)
|
112 |
|
|
#define WITH_TRACE_MEMORY_P (WITH_TRACE & TRACE_memory)
|
113 |
|
|
#define WITH_TRACE_MODEL_P (WITH_TRACE & TRACE_model)
|
114 |
|
|
#define WITH_TRACE_ALU_P (WITH_TRACE & TRACE_alu)
|
115 |
|
|
#define WITH_TRACE_CORE_P (WITH_TRACE & TRACE_core)
|
116 |
|
|
#define WITH_TRACE_EVENTS_P (WITH_TRACE & TRACE_events)
|
117 |
|
|
#define WITH_TRACE_FPU_P (WITH_TRACE & TRACE_fpu)
|
118 |
|
|
#define WITH_TRACE_BRANCH_P (WITH_TRACE & TRACE_branch)
|
119 |
|
|
#define WITH_TRACE_DEBUG_P (WITH_TRACE & TRACE_debug)
|
120 |
|
|
|
121 |
|
|
/* Tracing install handler. */
|
122 |
|
|
MODULE_INSTALL_FN trace_install;
|
123 |
|
|
|
124 |
|
|
/* Struct containing all system and cpu trace data.
|
125 |
|
|
|
126 |
|
|
System trace data is stored with the associated module.
|
127 |
|
|
System and cpu tracing must share the same space of bitmasks as they
|
128 |
|
|
are arguments to --with-trace. One could have --with-trace and
|
129 |
|
|
--with-cpu-trace or some such but that's an over-complication at this point
|
130 |
|
|
in time. Also, there may be occasions where system and cpu tracing may
|
131 |
|
|
wish to share a name. */
|
132 |
|
|
|
133 |
|
|
typedef struct _trace_data {
|
134 |
|
|
|
135 |
|
|
/* Global summary of all the current trace options */
|
136 |
|
|
char trace_any_p;
|
137 |
|
|
|
138 |
|
|
/* Boolean array of specified tracing flags. */
|
139 |
|
|
/* ??? It's not clear that using an array vs a bit mask is faster.
|
140 |
|
|
Consider the case where one wants to test whether any of several bits
|
141 |
|
|
are set. */
|
142 |
|
|
char trace_flags[MAX_TRACE_VALUES];
|
143 |
|
|
#define TRACE_FLAGS(t) ((t)->trace_flags)
|
144 |
|
|
|
145 |
|
|
/* Tracing output goes to this or stderr if NULL.
|
146 |
|
|
We can't store `stderr' here as stderr goes through a callback. */
|
147 |
|
|
FILE *trace_file;
|
148 |
|
|
#define TRACE_FILE(t) ((t)->trace_file)
|
149 |
|
|
|
150 |
|
|
/* Buffer to store the prefix to be printed before any trace line. */
|
151 |
|
|
char trace_prefix[256];
|
152 |
|
|
#define TRACE_PREFIX(t) ((t)->trace_prefix)
|
153 |
|
|
|
154 |
|
|
/* Buffer to save the inputs for the current instruction. Use a
|
155 |
|
|
union to force the buffer into correct alignment */
|
156 |
|
|
union {
|
157 |
|
|
unsigned8 i8;
|
158 |
|
|
unsigned16 i16;
|
159 |
|
|
unsigned32 i32;
|
160 |
|
|
unsigned64 i64;
|
161 |
|
|
} trace_input_data[16];
|
162 |
|
|
unsigned8 trace_input_fmt[16];
|
163 |
|
|
unsigned8 trace_input_size[16];
|
164 |
|
|
int trace_input_idx;
|
165 |
|
|
#define TRACE_INPUT_DATA(t) ((t)->trace_input_data)
|
166 |
|
|
#define TRACE_INPUT_FMT(t) ((t)->trace_input_fmt)
|
167 |
|
|
#define TRACE_INPUT_SIZE(t) ((t)->trace_input_size)
|
168 |
|
|
#define TRACE_INPUT_IDX(t) ((t)->trace_input_idx)
|
169 |
|
|
|
170 |
|
|
/* Category of trace being performed */
|
171 |
|
|
int trace_idx;
|
172 |
|
|
#define TRACE_IDX(t) ((t)->trace_idx)
|
173 |
|
|
|
174 |
|
|
/* Trace range.
|
175 |
|
|
??? Not all cpu's support this. */
|
176 |
|
|
ADDR_RANGE range;
|
177 |
|
|
#define TRACE_RANGE(t) (& (t)->range)
|
178 |
|
|
} TRACE_DATA;
|
179 |
|
|
|
180 |
|
|
/* System tracing support. */
|
181 |
|
|
|
182 |
|
|
#define STATE_TRACE_FLAGS(sd) TRACE_FLAGS (STATE_TRACE_DATA (sd))
|
183 |
|
|
|
184 |
|
|
/* Return non-zero if tracing of IDX is enabled for non-cpu specific
|
185 |
|
|
components. The "S" in "STRACE" refers to "System". */
|
186 |
|
|
#define STRACE_P(sd,idx) \
|
187 |
|
|
((WITH_TRACE & (1 << (idx))) != 0 \
|
188 |
|
|
&& STATE_TRACE_FLAGS (sd)[idx] != 0)
|
189 |
|
|
|
190 |
|
|
/* Non-zero if --trace-<xxxx> was specified for SD. */
|
191 |
|
|
#define STRACE_DEBUG_P(sd) STRACE_P (sd, TRACE_DEBUG_IDX)
|
192 |
|
|
|
193 |
|
|
/* CPU tracing support. */
|
194 |
|
|
|
195 |
|
|
#define CPU_TRACE_FLAGS(cpu) TRACE_FLAGS (CPU_TRACE_DATA (cpu))
|
196 |
|
|
|
197 |
|
|
/* Return non-zero if tracing of IDX is enabled for CPU. */
|
198 |
|
|
#define TRACE_P(cpu,idx) \
|
199 |
|
|
((WITH_TRACE & (1 << (idx))) != 0 \
|
200 |
|
|
&& CPU_TRACE_FLAGS (cpu)[idx] != 0)
|
201 |
|
|
|
202 |
|
|
/* Non-zero if --trace-<xxxx> was specified for CPU. */
|
203 |
|
|
#define TRACE_ANY_P(cpu) ((WITH_TRACE) && (CPU_TRACE_DATA (cpu)->trace_any_p))
|
204 |
|
|
#define TRACE_INSN_P(cpu) TRACE_P (cpu, TRACE_INSN_IDX)
|
205 |
|
|
#define TRACE_DECODE_P(cpu) TRACE_P (cpu, TRACE_DECODE_IDX)
|
206 |
|
|
#define TRACE_EXTRACT_P(cpu) TRACE_P (cpu, TRACE_EXTRACT_IDX)
|
207 |
|
|
#define TRACE_LINENUM_P(cpu) TRACE_P (cpu, TRACE_LINENUM_IDX)
|
208 |
|
|
#define TRACE_MEMORY_P(cpu) TRACE_P (cpu, TRACE_MEMORY_IDX)
|
209 |
|
|
#define TRACE_MODEL_P(cpu) TRACE_P (cpu, TRACE_MODEL_IDX)
|
210 |
|
|
#define TRACE_ALU_P(cpu) TRACE_P (cpu, TRACE_ALU_IDX)
|
211 |
|
|
#define TRACE_CORE_P(cpu) TRACE_P (cpu, TRACE_CORE_IDX)
|
212 |
|
|
#define TRACE_EVENTS_P(cpu) TRACE_P (cpu, TRACE_EVENTS_IDX)
|
213 |
|
|
#define TRACE_FPU_P(cpu) TRACE_P (cpu, TRACE_FPU_IDX)
|
214 |
|
|
#define TRACE_BRANCH_P(cpu) TRACE_P (cpu, TRACE_BRANCH_IDX)
|
215 |
|
|
#define TRACE_DEBUG_P(cpu) TRACE_P (cpu, TRACE_DEBUG_IDX)
|
216 |
|
|
|
217 |
|
|
/* Traceing functions.
|
218 |
|
|
|
219 |
|
|
*/
|
220 |
|
|
|
221 |
|
|
/* Prime the trace buffers ready for any trace output.
|
222 |
|
|
Must be called prior to any other trace operation */
|
223 |
|
|
extern void trace_prefix PARAMS ((SIM_DESC sd,
|
224 |
|
|
sim_cpu *cpu,
|
225 |
|
|
sim_cia cia,
|
226 |
|
|
address_word pc,
|
227 |
|
|
int print_linenum_p,
|
228 |
|
|
const char *file_name,
|
229 |
|
|
int line_nr,
|
230 |
|
|
const char *fmt,
|
231 |
|
|
...))
|
232 |
|
|
__attribute__((format (printf, 8, 9)));
|
233 |
|
|
|
234 |
|
|
/* Generic trace print, assumes trace_prefix() has been called */
|
235 |
|
|
|
236 |
|
|
extern void trace_generic PARAMS ((SIM_DESC sd,
|
237 |
|
|
sim_cpu *cpu,
|
238 |
|
|
int trace_idx,
|
239 |
|
|
const char *fmt,
|
240 |
|
|
...))
|
241 |
|
|
__attribute__((format (printf, 4, 5)));
|
242 |
|
|
|
243 |
|
|
/* Trace a varying number of word sized inputs/outputs. trace_result*
|
244 |
|
|
must be called to close the trace operation. */
|
245 |
|
|
|
246 |
|
|
extern void trace_input0 PARAMS ((SIM_DESC sd,
|
247 |
|
|
sim_cpu *cpu,
|
248 |
|
|
int trace_idx));
|
249 |
|
|
|
250 |
|
|
extern void trace_input_word1 PARAMS ((SIM_DESC sd,
|
251 |
|
|
sim_cpu *cpu,
|
252 |
|
|
int trace_idx,
|
253 |
|
|
unsigned_word d0));
|
254 |
|
|
|
255 |
|
|
extern void trace_input_word2 PARAMS ((SIM_DESC sd,
|
256 |
|
|
sim_cpu *cpu,
|
257 |
|
|
int trace_idx,
|
258 |
|
|
unsigned_word d0,
|
259 |
|
|
unsigned_word d1));
|
260 |
|
|
|
261 |
|
|
extern void trace_input_word3 PARAMS ((SIM_DESC sd,
|
262 |
|
|
sim_cpu *cpu,
|
263 |
|
|
int trace_idx,
|
264 |
|
|
unsigned_word d0,
|
265 |
|
|
unsigned_word d1,
|
266 |
|
|
unsigned_word d2));
|
267 |
|
|
|
268 |
|
|
extern void trace_input_word4 PARAMS ((SIM_DESC sd,
|
269 |
|
|
sim_cpu *cpu,
|
270 |
|
|
int trace_idx,
|
271 |
|
|
unsigned_word d0,
|
272 |
|
|
unsigned_word d1,
|
273 |
|
|
unsigned_word d2,
|
274 |
|
|
unsigned_word d3));
|
275 |
|
|
|
276 |
|
|
extern void trace_input_addr1 PARAMS ((SIM_DESC sd,
|
277 |
|
|
sim_cpu *cpu,
|
278 |
|
|
int trace_idx,
|
279 |
|
|
address_word d0));
|
280 |
|
|
|
281 |
|
|
extern void trace_input_bool1 PARAMS ((SIM_DESC sd,
|
282 |
|
|
sim_cpu *cpu,
|
283 |
|
|
int trace_idx,
|
284 |
|
|
int d0));
|
285 |
|
|
|
286 |
|
|
extern void trace_input_fp1 PARAMS ((SIM_DESC sd,
|
287 |
|
|
sim_cpu *cpu,
|
288 |
|
|
int trace_idx,
|
289 |
|
|
fp_word f0));
|
290 |
|
|
|
291 |
|
|
extern void trace_input_fp2 PARAMS ((SIM_DESC sd,
|
292 |
|
|
sim_cpu *cpu,
|
293 |
|
|
int trace_idx,
|
294 |
|
|
fp_word f0,
|
295 |
|
|
fp_word f1));
|
296 |
|
|
|
297 |
|
|
extern void trace_input_fp3 PARAMS ((SIM_DESC sd,
|
298 |
|
|
sim_cpu *cpu,
|
299 |
|
|
int trace_idx,
|
300 |
|
|
fp_word f0,
|
301 |
|
|
fp_word f1,
|
302 |
|
|
fp_word f2));
|
303 |
|
|
|
304 |
|
|
extern void trace_input_fpu1 PARAMS ((SIM_DESC sd,
|
305 |
|
|
sim_cpu *cpu,
|
306 |
|
|
int trace_idx,
|
307 |
|
|
struct _sim_fpu *f0));
|
308 |
|
|
|
309 |
|
|
extern void trace_input_fpu2 PARAMS ((SIM_DESC sd,
|
310 |
|
|
sim_cpu *cpu,
|
311 |
|
|
int trace_idx,
|
312 |
|
|
struct _sim_fpu *f0,
|
313 |
|
|
struct _sim_fpu *f1));
|
314 |
|
|
|
315 |
|
|
extern void trace_input_fpu3 PARAMS ((SIM_DESC sd,
|
316 |
|
|
sim_cpu *cpu,
|
317 |
|
|
int trace_idx,
|
318 |
|
|
struct _sim_fpu *f0,
|
319 |
|
|
struct _sim_fpu *f1,
|
320 |
|
|
struct _sim_fpu *f2));
|
321 |
|
|
|
322 |
|
|
/* Other trace_input{_<fmt><nr-inputs>} functions can go here */
|
323 |
|
|
|
324 |
|
|
extern void trace_result0 PARAMS ((SIM_DESC sd,
|
325 |
|
|
sim_cpu *cpu,
|
326 |
|
|
int trace_idx));
|
327 |
|
|
|
328 |
|
|
extern void trace_result_word1 PARAMS ((SIM_DESC sd,
|
329 |
|
|
sim_cpu *cpu,
|
330 |
|
|
int trace_idx,
|
331 |
|
|
unsigned_word r0));
|
332 |
|
|
|
333 |
|
|
extern void trace_result_word2 PARAMS ((SIM_DESC sd,
|
334 |
|
|
sim_cpu *cpu,
|
335 |
|
|
int trace_idx,
|
336 |
|
|
unsigned_word r0,
|
337 |
|
|
unsigned_word r1));
|
338 |
|
|
|
339 |
|
|
extern void trace_result_word4 PARAMS ((SIM_DESC sd,
|
340 |
|
|
sim_cpu *cpu,
|
341 |
|
|
int trace_idx,
|
342 |
|
|
unsigned_word r0,
|
343 |
|
|
unsigned_word r1,
|
344 |
|
|
unsigned_word r2,
|
345 |
|
|
unsigned_word r3));
|
346 |
|
|
|
347 |
|
|
extern void trace_result_bool1 PARAMS ((SIM_DESC sd,
|
348 |
|
|
sim_cpu *cpu,
|
349 |
|
|
int trace_idx,
|
350 |
|
|
int r0));
|
351 |
|
|
|
352 |
|
|
extern void trace_result_addr1 PARAMS ((SIM_DESC sd,
|
353 |
|
|
sim_cpu *cpu,
|
354 |
|
|
int trace_idx,
|
355 |
|
|
address_word r0));
|
356 |
|
|
|
357 |
|
|
extern void trace_result_fp1 PARAMS ((SIM_DESC sd,
|
358 |
|
|
sim_cpu *cpu,
|
359 |
|
|
int trace_idx,
|
360 |
|
|
fp_word f0));
|
361 |
|
|
|
362 |
|
|
extern void trace_result_fp2 PARAMS ((SIM_DESC sd,
|
363 |
|
|
sim_cpu *cpu,
|
364 |
|
|
int trace_idx,
|
365 |
|
|
fp_word f0,
|
366 |
|
|
fp_word f1));
|
367 |
|
|
|
368 |
|
|
extern void trace_result_fpu1 PARAMS ((SIM_DESC sd,
|
369 |
|
|
sim_cpu *cpu,
|
370 |
|
|
int trace_idx,
|
371 |
|
|
struct _sim_fpu *f0));
|
372 |
|
|
|
373 |
|
|
extern void trace_result_string1 PARAMS ((SIM_DESC sd,
|
374 |
|
|
sim_cpu *cpu,
|
375 |
|
|
int trace_idx,
|
376 |
|
|
char *str0));
|
377 |
|
|
|
378 |
|
|
extern void trace_result_word1_string1 PARAMS ((SIM_DESC sd,
|
379 |
|
|
sim_cpu *cpu,
|
380 |
|
|
int trace_idx,
|
381 |
|
|
unsigned_word r0,
|
382 |
|
|
char *s0));
|
383 |
|
|
|
384 |
|
|
/* Other trace_result{_<type><nr-results>} */
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
/* Macro's for tracing ALU instructions */
|
388 |
|
|
|
389 |
|
|
#define TRACE_ALU_INPUT0() \
|
390 |
|
|
do { \
|
391 |
|
|
if (TRACE_ALU_P (CPU)) \
|
392 |
|
|
trace_input0 (SD, CPU, TRACE_ALU_IDX); \
|
393 |
|
|
} while (0)
|
394 |
|
|
|
395 |
|
|
#define TRACE_ALU_INPUT1(V0) \
|
396 |
|
|
do { \
|
397 |
|
|
if (TRACE_ALU_P (CPU)) \
|
398 |
|
|
trace_input_word1 (SD, CPU, TRACE_ALU_IDX, (V0)); \
|
399 |
|
|
} while (0)
|
400 |
|
|
|
401 |
|
|
#define TRACE_ALU_INPUT2(V0,V1) \
|
402 |
|
|
do { \
|
403 |
|
|
if (TRACE_ALU_P (CPU)) \
|
404 |
|
|
trace_input_word2 (SD, CPU, TRACE_ALU_IDX, (V0), (V1)); \
|
405 |
|
|
} while (0)
|
406 |
|
|
|
407 |
|
|
#define TRACE_ALU_INPUT3(V0,V1,V2) \
|
408 |
|
|
do { \
|
409 |
|
|
if (TRACE_ALU_P (CPU)) \
|
410 |
|
|
trace_input_word3 (SD, CPU, TRACE_ALU_IDX, (V0), (V1), (V2)); \
|
411 |
|
|
} while (0)
|
412 |
|
|
|
413 |
|
|
#define TRACE_ALU_INPUT4(V0,V1,V2,V3) \
|
414 |
|
|
do { \
|
415 |
|
|
if (TRACE_ALU_P (CPU)) \
|
416 |
|
|
trace_input_word4 (SD, CPU, TRACE_ALU_IDX, (V0), (V1), (V2), (V3)); \
|
417 |
|
|
} while (0)
|
418 |
|
|
|
419 |
|
|
#define TRACE_ALU_RESULT(R0) TRACE_ALU_RESULT1(R0)
|
420 |
|
|
|
421 |
|
|
#define TRACE_ALU_RESULT0() \
|
422 |
|
|
do { \
|
423 |
|
|
if (TRACE_ALU_P (CPU)) \
|
424 |
|
|
trace_result0 (SD, CPU, TRACE_ALU_IDX); \
|
425 |
|
|
} while (0)
|
426 |
|
|
|
427 |
|
|
#define TRACE_ALU_RESULT1(R0) \
|
428 |
|
|
do { \
|
429 |
|
|
if (TRACE_ALU_P (CPU)) \
|
430 |
|
|
trace_result_word1 (SD, CPU, TRACE_ALU_IDX, (R0)); \
|
431 |
|
|
} while (0)
|
432 |
|
|
|
433 |
|
|
#define TRACE_ALU_RESULT2(R0,R1) \
|
434 |
|
|
do { \
|
435 |
|
|
if (TRACE_ALU_P (CPU)) \
|
436 |
|
|
trace_result_word2 (SD, CPU, TRACE_ALU_IDX, (R0), (R1)); \
|
437 |
|
|
} while (0)
|
438 |
|
|
|
439 |
|
|
#define TRACE_ALU_RESULT4(R0,R1,R2,R3) \
|
440 |
|
|
do { \
|
441 |
|
|
if (TRACE_ALU_P (CPU)) \
|
442 |
|
|
trace_result_word4 (SD, CPU, TRACE_ALU_IDX, (R0), (R1), (R2), (R3)); \
|
443 |
|
|
} while (0)
|
444 |
|
|
|
445 |
|
|
|
446 |
|
|
/* Macro's for tracing FPU instructions */
|
447 |
|
|
|
448 |
|
|
#define TRACE_FP_INPUT0() \
|
449 |
|
|
do { \
|
450 |
|
|
if (TRACE_FPU_P (CPU)) \
|
451 |
|
|
trace_input0 (SD, CPU, TRACE_FPU_IDX); \
|
452 |
|
|
} while (0)
|
453 |
|
|
|
454 |
|
|
#define TRACE_FP_INPUT1(V0) \
|
455 |
|
|
do { \
|
456 |
|
|
if (TRACE_FPU_P (CPU)) \
|
457 |
|
|
trace_input_fp1 (SD, CPU, TRACE_FPU_IDX, (V0)); \
|
458 |
|
|
} while (0)
|
459 |
|
|
|
460 |
|
|
#define TRACE_FP_INPUT2(V0,V1) \
|
461 |
|
|
do { \
|
462 |
|
|
if (TRACE_FPU_P (CPU)) \
|
463 |
|
|
trace_input_fp2 (SD, CPU, TRACE_FPU_IDX, (V0), (V1)); \
|
464 |
|
|
} while (0)
|
465 |
|
|
|
466 |
|
|
#define TRACE_FP_INPUT3(V0,V1,V2) \
|
467 |
|
|
do { \
|
468 |
|
|
if (TRACE_FPU_P (CPU)) \
|
469 |
|
|
trace_input_fp3 (SD, CPU, TRACE_FPU_IDX, (V0), (V1), (V2)); \
|
470 |
|
|
} while (0)
|
471 |
|
|
|
472 |
|
|
#define TRACE_FP_INPUT_WORD1(V0) \
|
473 |
|
|
do { \
|
474 |
|
|
if (TRACE_FPU_P (CPU)) \
|
475 |
|
|
trace_input_word1 (SD, CPU, TRACE_FPU_IDX, (V0)); \
|
476 |
|
|
} while (0)
|
477 |
|
|
|
478 |
|
|
#define TRACE_FP_RESULT(R0) \
|
479 |
|
|
do { \
|
480 |
|
|
if (TRACE_FPU_P (CPU)) \
|
481 |
|
|
trace_result_fp1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
|
482 |
|
|
} while (0)
|
483 |
|
|
|
484 |
|
|
#define TRACE_FP_RESULT2(R0,R1) \
|
485 |
|
|
do { \
|
486 |
|
|
if (TRACE_FPU_P (CPU)) \
|
487 |
|
|
trace_result_fp2 (SD, CPU, TRACE_FPU_IDX, (R0), (R1)); \
|
488 |
|
|
} while (0)
|
489 |
|
|
|
490 |
|
|
#define TRACE_FP_RESULT_BOOL(R0) \
|
491 |
|
|
do { \
|
492 |
|
|
if (TRACE_FPU_P (CPU)) \
|
493 |
|
|
trace_result_bool1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
|
494 |
|
|
} while (0)
|
495 |
|
|
|
496 |
|
|
#define TRACE_FP_RESULT_WORD(R0) \
|
497 |
|
|
do { \
|
498 |
|
|
if (TRACE_FPU_P (CPU)) \
|
499 |
|
|
trace_result_word1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
|
500 |
|
|
} while (0)
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
/* Macros for tracing branches */
|
504 |
|
|
|
505 |
|
|
#define TRACE_BRANCH_INPUT(COND) \
|
506 |
|
|
do { \
|
507 |
|
|
if (TRACE_BRANCH_P (CPU)) \
|
508 |
|
|
trace_input_bool1 (SD, CPU, TRACE_BRANCH_IDX, (COND)); \
|
509 |
|
|
} while (0)
|
510 |
|
|
|
511 |
|
|
#define TRACE_BRANCH_RESULT(DEST) \
|
512 |
|
|
do { \
|
513 |
|
|
if (TRACE_BRANCH_P (CPU)) \
|
514 |
|
|
trace_result_addr1 (SD, CPU, TRACE_BRANCH_IDX, (DEST)); \
|
515 |
|
|
} while (0)
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
/* The function trace_one_insn has been replaced by the function pair
|
519 |
|
|
trace_prefix() + trace_generic() */
|
520 |
|
|
extern void trace_one_insn PARAMS ((SIM_DESC sd,
|
521 |
|
|
sim_cpu * cpu,
|
522 |
|
|
address_word cia,
|
523 |
|
|
int print_linenum_p,
|
524 |
|
|
const char *file_name,
|
525 |
|
|
int line_nr,
|
526 |
|
|
const char *unit,
|
527 |
|
|
const char *fmt,
|
528 |
|
|
...))
|
529 |
|
|
__attribute__((format (printf, 8, 9)));
|
530 |
|
|
|
531 |
|
|
extern void trace_printf PARAMS ((SIM_DESC, sim_cpu *, const char *, ...))
|
532 |
|
|
__attribute__((format (printf, 3, 4)));
|
533 |
|
|
|
534 |
|
|
extern void trace_vprintf PARAMS ((SIM_DESC, sim_cpu *, const char *, va_list));
|
535 |
|
|
|
536 |
|
|
/* Debug support.
|
537 |
|
|
This is included here because there isn't enough of it to justify
|
538 |
|
|
a sim-debug.h. */
|
539 |
|
|
|
540 |
|
|
/* Return non-zero if debugging of IDX for CPU is enabled. */
|
541 |
|
|
#define DEBUG_P(cpu, idx) \
|
542 |
|
|
((WITH_DEBUG & (1 << (idx))) != 0 \
|
543 |
|
|
&& CPU_DEBUG_FLAGS (cpu)[idx] != 0)
|
544 |
|
|
|
545 |
|
|
/* Non-zero if "--debug-insn" specified. */
|
546 |
|
|
#define DEBUG_INSN_P(cpu) DEBUG_P (cpu, DEBUG_INSN_IDX)
|
547 |
|
|
|
548 |
|
|
extern void debug_printf PARAMS ((sim_cpu *, const char *, ...))
|
549 |
|
|
__attribute__((format (printf, 2, 3)));
|
550 |
|
|
|
551 |
|
|
#endif /* SIM_TRACE_H */
|