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