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