sim: mips: switch to common WITH_TRACE_ANY_P
[deliverable/binutils-gdb.git] / sim / common / sim-trace.h
CommitLineData
c906108c 1/* Simulator tracing/debugging support.
32d0add0 2 Copyright (C) 1997-2015 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/* This file is meant to be included by sim-basics.h. */
21
22#ifndef SIM_TRACE_H
23#define SIM_TRACE_H
24
25/* Standard traceable entities. */
26
27enum {
28 /* Trace insn execution. */
29 TRACE_INSN_IDX = 1,
30
31 /* Trace insn decoding.
32 ??? This is more of a simulator debugging operation and might best be
33 moved to --debug-decode. */
34 TRACE_DECODE_IDX,
35
36 /* Trace insn extraction.
37 ??? This is more of a simulator debugging operation and might best be
38 moved to --debug-extract. */
39 TRACE_EXTRACT_IDX,
40
41 /* Trace insn execution but include line numbers. */
42 TRACE_LINENUM_IDX,
43
44 /* Trace memory operations.
45 The difference between this and TRACE_CORE_IDX is (I think) that this
46 is intended to apply to a higher level. TRACE_CORE_IDX applies to the
47 low level core operations. */
48 TRACE_MEMORY_IDX,
49
50 /* Include model performance data in tracing output. */
51 TRACE_MODEL_IDX,
52
53 /* Trace ALU operations. */
54 TRACE_ALU_IDX,
55
56 /* Trace memory core operations. */
57 TRACE_CORE_IDX,
58
59 /* Trace events. */
60 TRACE_EVENTS_IDX,
61
62 /* Trace fpu operations. */
63 TRACE_FPU_IDX,
64
01816cd8
BE
65 /* Trace vpu operations. */
66 TRACE_VPU_IDX,
67
c906108c
SS
68 /* Trace branching. */
69 TRACE_BRANCH_IDX,
70
3a49ea9f
MF
71 /* Trace syscalls. */
72 TRACE_SYSCALL_IDX,
73
c906108c
SS
74 /* Add information useful for debugging the simulator to trace output. */
75 TRACE_DEBUG_IDX,
76
77 /* Simulator specific trace bits begin here. */
78 TRACE_NEXT_IDX,
79
80};
81/* Maximum number of traceable entities. */
82#ifndef MAX_TRACE_VALUES
83#define MAX_TRACE_VALUES 32
84#endif
85
86/* The -t option only prints useful values. It's easy to type and shouldn't
87 splat on the screen everything under the sun making nothing easy to
88 find. */
89#define TRACE_USEFUL_MASK \
a6c2a374 90 (TRACE_insn | TRACE_linenum | TRACE_memory | TRACE_model)
c906108c
SS
91\f
92/* Masks so WITH_TRACE can have symbolic values.
93 The case choice here is on purpose. The lowercase parts are args to
94 --with-trace. */
95#define TRACE_insn (1 << TRACE_INSN_IDX)
96#define TRACE_decode (1 << TRACE_DECODE_IDX)
97#define TRACE_extract (1 << TRACE_EXTRACT_IDX)
98#define TRACE_linenum (1 << TRACE_LINENUM_IDX)
99#define TRACE_memory (1 << TRACE_MEMORY_IDX)
100#define TRACE_model (1 << TRACE_MODEL_IDX)
101#define TRACE_alu (1 << TRACE_ALU_IDX)
102#define TRACE_core (1 << TRACE_CORE_IDX)
103#define TRACE_events (1 << TRACE_EVENTS_IDX)
104#define TRACE_fpu (1 << TRACE_FPU_IDX)
01816cd8 105#define TRACE_vpu (1 << TRACE_VPU_IDX)
c906108c 106#define TRACE_branch (1 << TRACE_BRANCH_IDX)
3a49ea9f 107#define TRACE_syscall (1 << TRACE_SYSCALL_IDX)
c906108c
SS
108#define TRACE_debug (1 << TRACE_DEBUG_IDX)
109
bffcfec8 110/* Return non-zero if tracing of idx is enabled (compiled in). */
9b9c712c 111#define WITH_TRACE_P(idx) (WITH_TRACE & (1 << idx))
bffcfec8
MF
112
113/* Preprocessor macros to simplify tests of WITH_TRACE. */
114#define WITH_TRACE_ANY_P (WITH_TRACE)
9b9c712c
MF
115#define WITH_TRACE_INSN_P WITH_TRACE_P (TRACE_INSN_IDX)
116#define WITH_TRACE_DECODE_P WITH_TRACE_P (TRACE_DECODE_IDX)
117#define WITH_TRACE_EXTRACT_P WITH_TRACE_P (TRACE_EXTRACT_IDX)
118#define WITH_TRACE_LINENUM_P WITH_TRACE_P (TRACE_LINENUM_IDX)
119#define WITH_TRACE_MEMORY_P WITH_TRACE_P (TRACE_MEMORY_IDX)
120#define WITH_TRACE_MODEL_P WITH_TRACE_P (TRACE_MODEL_IDX)
121#define WITH_TRACE_ALU_P WITH_TRACE_P (TRACE_ALU_IDX)
122#define WITH_TRACE_CORE_P WITH_TRACE_P (TRACE_CORE_IDX)
123#define WITH_TRACE_EVENTS_P WITH_TRACE_P (TRACE_EVENTS_IDX)
124#define WITH_TRACE_FPU_P WITH_TRACE_P (TRACE_FPU_IDX)
125#define WITH_TRACE_VPU_P WITH_TRACE_P (TRACE_VPU_IDX)
126#define WITH_TRACE_BRANCH_P WITH_TRACE_P (TRACE_BRANCH_IDX)
127#define WITH_TRACE_SYSCALL_P WITH_TRACE_P (TRACE_SYSCALL_IDX)
128#define WITH_TRACE_DEBUG_P WITH_TRACE_P (TRACE_DEBUG_IDX)
c906108c
SS
129
130/* Tracing install handler. */
131MODULE_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
142typedef 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) \
9b9c712c 196 (WITH_TRACE_P (idx) && STATE_TRACE_FLAGS (sd)[idx] != 0)
c906108c
SS
197
198/* Non-zero if --trace-<xxxx> was specified for SD. */
bffcfec8 199#define STRACE_ANY_P(sd) (WITH_TRACE_ANY_P && (STATE_TRACE_DATA (sd)->trace_any_p))
ce4eda4a
MF
200#define STRACE_INSN_P(sd) STRACE_P (sd, TRACE_INSN_IDX)
201#define STRACE_DECODE_P(sd) STRACE_P (sd, TRACE_DECODE_IDX)
202#define STRACE_EXTRACT_P(sd) STRACE_P (sd, TRACE_EXTRACT_IDX)
203#define STRACE_LINENUM_P(sd) STRACE_P (sd, TRACE_LINENUM_IDX)
204#define STRACE_MEMORY_P(sd) STRACE_P (sd, TRACE_MEMORY_IDX)
205#define STRACE_MODEL_P(sd) STRACE_P (sd, TRACE_MODEL_IDX)
206#define STRACE_ALU_P(sd) STRACE_P (sd, TRACE_ALU_IDX)
207#define STRACE_CORE_P(sd) STRACE_P (sd, TRACE_CORE_IDX)
208#define STRACE_EVENTS_P(sd) STRACE_P (sd, TRACE_EVENTS_IDX)
209#define STRACE_FPU_P(sd) STRACE_P (sd, TRACE_FPU_IDX)
210#define STRACE_VPU_P(sd) STRACE_P (sd, TRACE_VPU_IDX)
211#define STRACE_BRANCH_P(sd) STRACE_P (sd, TRACE_BRANCH_IDX)
212#define STRACE_SYSCALL_P(sd) STRACE_P (sd, TRACE_SYSCALL_IDX)
c906108c
SS
213#define STRACE_DEBUG_P(sd) STRACE_P (sd, TRACE_DEBUG_IDX)
214\f
215/* CPU tracing support. */
216
217#define CPU_TRACE_FLAGS(cpu) TRACE_FLAGS (CPU_TRACE_DATA (cpu))
218
219/* Return non-zero if tracing of IDX is enabled for CPU. */
220#define TRACE_P(cpu,idx) \
9b9c712c 221 (WITH_TRACE_P (idx) && CPU_TRACE_FLAGS (cpu)[idx] != 0)
c906108c
SS
222
223/* Non-zero if --trace-<xxxx> was specified for CPU. */
bffcfec8 224#define TRACE_ANY_P(cpu) (WITH_TRACE_ANY_P && (CPU_TRACE_DATA (cpu)->trace_any_p))
c906108c
SS
225#define TRACE_INSN_P(cpu) TRACE_P (cpu, TRACE_INSN_IDX)
226#define TRACE_DECODE_P(cpu) TRACE_P (cpu, TRACE_DECODE_IDX)
227#define TRACE_EXTRACT_P(cpu) TRACE_P (cpu, TRACE_EXTRACT_IDX)
228#define TRACE_LINENUM_P(cpu) TRACE_P (cpu, TRACE_LINENUM_IDX)
229#define TRACE_MEMORY_P(cpu) TRACE_P (cpu, TRACE_MEMORY_IDX)
230#define TRACE_MODEL_P(cpu) TRACE_P (cpu, TRACE_MODEL_IDX)
231#define TRACE_ALU_P(cpu) TRACE_P (cpu, TRACE_ALU_IDX)
232#define TRACE_CORE_P(cpu) TRACE_P (cpu, TRACE_CORE_IDX)
233#define TRACE_EVENTS_P(cpu) TRACE_P (cpu, TRACE_EVENTS_IDX)
234#define TRACE_FPU_P(cpu) TRACE_P (cpu, TRACE_FPU_IDX)
01816cd8 235#define TRACE_VPU_P(cpu) TRACE_P (cpu, TRACE_VPU_IDX)
c906108c 236#define TRACE_BRANCH_P(cpu) TRACE_P (cpu, TRACE_BRANCH_IDX)
3a49ea9f 237#define TRACE_SYSCALL_P(cpu) TRACE_P (cpu, TRACE_SYSCALL_IDX)
c906108c
SS
238#define TRACE_DEBUG_P(cpu) TRACE_P (cpu, TRACE_DEBUG_IDX)
239\f
01816cd8 240/* Tracing functions. */
c906108c
SS
241
242/* Prime the trace buffers ready for any trace output.
243 Must be called prior to any other trace operation */
bdca5ee4
TT
244extern void trace_prefix (SIM_DESC sd,
245 sim_cpu *cpu,
246 sim_cia cia,
247 address_word pc,
248 int print_linenum_p,
249 const char *file_name,
250 int line_nr,
251 const char *fmt,
252 ...)
c906108c
SS
253 __attribute__((format (printf, 8, 9)));
254
255/* Generic trace print, assumes trace_prefix() has been called */
256
bdca5ee4
TT
257extern void trace_generic (SIM_DESC sd,
258 sim_cpu *cpu,
259 int trace_idx,
260 const char *fmt,
261 ...)
c906108c
SS
262 __attribute__((format (printf, 4, 5)));
263
2aaed979
KB
264typedef enum {
265 trace_fmt_invalid,
266 trace_fmt_word,
267 trace_fmt_fp,
268 trace_fmt_fpu,
269 trace_fmt_string,
270 trace_fmt_bool,
271 trace_fmt_addr,
272 trace_fmt_instruction_incomplete,
273} data_fmt;
274
c906108c
SS
275/* Trace a varying number of word sized inputs/outputs. trace_result*
276 must be called to close the trace operation. */
277
bdca5ee4
TT
278extern void save_data (SIM_DESC sd,
279 TRACE_DATA *data,
280 data_fmt fmt,
281 long size,
282 const void *buf);
c906108c 283
bdca5ee4
TT
284extern void trace_input0 (SIM_DESC sd,
285 sim_cpu *cpu,
286 int trace_idx);
c906108c 287
bdca5ee4
TT
288extern void trace_input_word1 (SIM_DESC sd,
289 sim_cpu *cpu,
290 int trace_idx,
291 unsigned_word d0);
c906108c 292
bdca5ee4
TT
293extern void trace_input_word2 (SIM_DESC sd,
294 sim_cpu *cpu,
295 int trace_idx,
296 unsigned_word d0,
297 unsigned_word d1);
c906108c 298
bdca5ee4 299extern void trace_input_word3 (SIM_DESC sd,
c906108c
SS
300 sim_cpu *cpu,
301 int trace_idx,
302 unsigned_word d0,
303 unsigned_word d1,
bdca5ee4
TT
304 unsigned_word d2);
305
306extern void trace_input_word4 (SIM_DESC sd,
307 sim_cpu *cpu,
308 int trace_idx,
309 unsigned_word d0,
310 unsigned_word d1,
311 unsigned_word d2,
312 unsigned_word d3);
313
314extern void trace_input_addr1 (SIM_DESC sd,
315 sim_cpu *cpu,
316 int trace_idx,
317 address_word d0);
318
319extern void trace_input_bool1 (SIM_DESC sd,
320 sim_cpu *cpu,
321 int trace_idx,
322 int d0);
323
324extern void trace_input_fp1 (SIM_DESC sd,
325 sim_cpu *cpu,
326 int trace_idx,
327 fp_word f0);
328
329extern void trace_input_fp2 (SIM_DESC sd,
330 sim_cpu *cpu,
331 int trace_idx,
332 fp_word f0,
333 fp_word f1);
334
335extern void trace_input_fp3 (SIM_DESC sd,
336 sim_cpu *cpu,
337 int trace_idx,
338 fp_word f0,
339 fp_word f1,
340 fp_word f2);
341
342extern void trace_input_fpu1 (SIM_DESC sd,
343 sim_cpu *cpu,
344 int trace_idx,
345 struct _sim_fpu *f0);
346
347extern void trace_input_fpu2 (SIM_DESC sd,
348 sim_cpu *cpu,
349 int trace_idx,
350 struct _sim_fpu *f0,
351 struct _sim_fpu *f1);
352
353extern void trace_input_fpu3 (SIM_DESC sd,
354 sim_cpu *cpu,
355 int trace_idx,
356 struct _sim_fpu *f0,
357 struct _sim_fpu *f1,
358 struct _sim_fpu *f2);
c906108c
SS
359
360/* Other trace_input{_<fmt><nr-inputs>} functions can go here */
361
bdca5ee4
TT
362extern void trace_result0 (SIM_DESC sd,
363 sim_cpu *cpu,
364 int trace_idx);
365
366extern void trace_result_word1 (SIM_DESC sd,
367 sim_cpu *cpu,
368 int trace_idx,
369 unsigned_word r0);
370
371extern void trace_result_word2 (SIM_DESC sd,
372 sim_cpu *cpu,
373 int trace_idx,
374 unsigned_word r0,
375 unsigned_word r1);
376
377extern void trace_result_word4 (SIM_DESC sd,
378 sim_cpu *cpu,
379 int trace_idx,
380 unsigned_word r0,
381 unsigned_word r1,
382 unsigned_word r2,
383 unsigned_word r3);
384
385extern void trace_result_bool1 (SIM_DESC sd,
386 sim_cpu *cpu,
387 int trace_idx,
388 int r0);
389
390extern void trace_result_addr1 (SIM_DESC sd,
391 sim_cpu *cpu,
392 int trace_idx,
393 address_word r0);
394
395extern void trace_result_fp1 (SIM_DESC sd,
396 sim_cpu *cpu,
397 int trace_idx,
398 fp_word f0);
399
400extern void trace_result_fp2 (SIM_DESC sd,
401 sim_cpu *cpu,
402 int trace_idx,
403 fp_word f0,
404 fp_word f1);
405
406extern void trace_result_fpu1 (SIM_DESC sd,
407 sim_cpu *cpu,
408 int trace_idx,
409 struct _sim_fpu *f0);
410
411extern void trace_result_string1 (SIM_DESC sd,
412 sim_cpu *cpu,
413 int trace_idx,
414 char *str0);
c906108c 415
bdca5ee4 416extern void trace_result_word1_string1 (SIM_DESC sd,
c906108c
SS
417 sim_cpu *cpu,
418 int trace_idx,
419 unsigned_word r0,
bdca5ee4 420 char *s0);
c906108c
SS
421
422/* Other trace_result{_<type><nr-results>} */
423
424
44a9331c 425/* Macros for tracing ALU instructions */
c906108c
SS
426
427#define TRACE_ALU_INPUT0() \
428do { \
429 if (TRACE_ALU_P (CPU)) \
430 trace_input0 (SD, CPU, TRACE_ALU_IDX); \
431} while (0)
028f6515 432
c906108c
SS
433#define TRACE_ALU_INPUT1(V0) \
434do { \
435 if (TRACE_ALU_P (CPU)) \
436 trace_input_word1 (SD, CPU, TRACE_ALU_IDX, (V0)); \
437} while (0)
438
439#define TRACE_ALU_INPUT2(V0,V1) \
440do { \
441 if (TRACE_ALU_P (CPU)) \
442 trace_input_word2 (SD, CPU, TRACE_ALU_IDX, (V0), (V1)); \
443} while (0)
444
445#define TRACE_ALU_INPUT3(V0,V1,V2) \
446do { \
447 if (TRACE_ALU_P (CPU)) \
448 trace_input_word3 (SD, CPU, TRACE_ALU_IDX, (V0), (V1), (V2)); \
449} while (0)
450
451#define TRACE_ALU_INPUT4(V0,V1,V2,V3) \
452do { \
453 if (TRACE_ALU_P (CPU)) \
454 trace_input_word4 (SD, CPU, TRACE_ALU_IDX, (V0), (V1), (V2), (V3)); \
455} while (0)
456
457#define TRACE_ALU_RESULT(R0) TRACE_ALU_RESULT1(R0)
458
459#define TRACE_ALU_RESULT0() \
460do { \
461 if (TRACE_ALU_P (CPU)) \
462 trace_result0 (SD, CPU, TRACE_ALU_IDX); \
463} while (0)
464
465#define TRACE_ALU_RESULT1(R0) \
466do { \
467 if (TRACE_ALU_P (CPU)) \
468 trace_result_word1 (SD, CPU, TRACE_ALU_IDX, (R0)); \
469} while (0)
470
471#define TRACE_ALU_RESULT2(R0,R1) \
472do { \
473 if (TRACE_ALU_P (CPU)) \
474 trace_result_word2 (SD, CPU, TRACE_ALU_IDX, (R0), (R1)); \
475} while (0)
476
477#define TRACE_ALU_RESULT4(R0,R1,R2,R3) \
478do { \
479 if (TRACE_ALU_P (CPU)) \
480 trace_result_word4 (SD, CPU, TRACE_ALU_IDX, (R0), (R1), (R2), (R3)); \
481} while (0)
482
44a9331c 483/* Macros for tracing inputs to comparative branch instructions. */
c906108c 484
44a9331c
BE
485#define TRACE_BRANCH_INPUT1(V0) \
486do { \
487 if (TRACE_BRANCH_P (CPU)) \
488 trace_input_word1 (SD, CPU, TRACE_BRANCH_IDX, (V0)); \
489} while (0)
490
491#define TRACE_BRANCH_INPUT2(V0,V1) \
492do { \
493 if (TRACE_BRANCH_P (CPU)) \
494 trace_input_word2 (SD, CPU, TRACE_BRANCH_IDX, (V0), (V1)); \
495} while (0)
496
497/* Macros for tracing FPU instructions */
c906108c
SS
498
499#define TRACE_FP_INPUT0() \
500do { \
501 if (TRACE_FPU_P (CPU)) \
502 trace_input0 (SD, CPU, TRACE_FPU_IDX); \
503} while (0)
028f6515 504
c906108c
SS
505#define TRACE_FP_INPUT1(V0) \
506do { \
507 if (TRACE_FPU_P (CPU)) \
508 trace_input_fp1 (SD, CPU, TRACE_FPU_IDX, (V0)); \
509} while (0)
510
511#define TRACE_FP_INPUT2(V0,V1) \
512do { \
513 if (TRACE_FPU_P (CPU)) \
514 trace_input_fp2 (SD, CPU, TRACE_FPU_IDX, (V0), (V1)); \
515} while (0)
516
517#define TRACE_FP_INPUT3(V0,V1,V2) \
518do { \
519 if (TRACE_FPU_P (CPU)) \
520 trace_input_fp3 (SD, CPU, TRACE_FPU_IDX, (V0), (V1), (V2)); \
521} while (0)
522
523#define TRACE_FP_INPUT_WORD1(V0) \
524do { \
525 if (TRACE_FPU_P (CPU)) \
526 trace_input_word1 (SD, CPU, TRACE_FPU_IDX, (V0)); \
527} while (0)
028f6515 528
c906108c
SS
529#define TRACE_FP_RESULT(R0) \
530do { \
531 if (TRACE_FPU_P (CPU)) \
532 trace_result_fp1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
533} while (0)
534
535#define TRACE_FP_RESULT2(R0,R1) \
536do { \
537 if (TRACE_FPU_P (CPU)) \
538 trace_result_fp2 (SD, CPU, TRACE_FPU_IDX, (R0), (R1)); \
539} while (0)
540
541#define TRACE_FP_RESULT_BOOL(R0) \
542do { \
543 if (TRACE_FPU_P (CPU)) \
544 trace_result_bool1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
545} while (0)
546
547#define TRACE_FP_RESULT_WORD(R0) \
548do { \
549 if (TRACE_FPU_P (CPU)) \
550 trace_result_word1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
551} while (0)
552
553
554/* Macros for tracing branches */
555
556#define TRACE_BRANCH_INPUT(COND) \
557do { \
558 if (TRACE_BRANCH_P (CPU)) \
559 trace_input_bool1 (SD, CPU, TRACE_BRANCH_IDX, (COND)); \
560} while (0)
561
562#define TRACE_BRANCH_RESULT(DEST) \
563do { \
564 if (TRACE_BRANCH_P (CPU)) \
565 trace_result_addr1 (SD, CPU, TRACE_BRANCH_IDX, (DEST)); \
566} while (0)
567
568\f
569/* The function trace_one_insn has been replaced by the function pair
570 trace_prefix() + trace_generic() */
bdca5ee4
TT
571extern void trace_one_insn (SIM_DESC sd,
572 sim_cpu * cpu,
573 address_word cia,
574 int print_linenum_p,
575 const char *file_name,
576 int line_nr,
577 const char *unit,
578 const char *fmt,
579 ...)
c906108c
SS
580 __attribute__((format (printf, 8, 9)));
581
bdca5ee4 582extern void trace_printf (SIM_DESC, sim_cpu *, const char *, ...)
c906108c
SS
583 __attribute__((format (printf, 3, 4)));
584
bdca5ee4 585extern void trace_vprintf (SIM_DESC, sim_cpu *, const char *, va_list);
c906108c
SS
586
587/* Debug support.
588 This is included here because there isn't enough of it to justify
589 a sim-debug.h. */
590
591/* Return non-zero if debugging of IDX for CPU is enabled. */
592#define DEBUG_P(cpu, idx) \
593((WITH_DEBUG & (1 << (idx))) != 0 \
594 && CPU_DEBUG_FLAGS (cpu)[idx] != 0)
595
596/* Non-zero if "--debug-insn" specified. */
597#define DEBUG_INSN_P(cpu) DEBUG_P (cpu, DEBUG_INSN_IDX)
598
6aefca7e
GB
599/* GDB also has a debug_printf, so we shadow ours. */
600#define debug_printf sim_debug_printf
601
bdca5ee4 602extern void debug_printf (sim_cpu *, const char *, ...)
c906108c
SS
603 __attribute__((format (printf, 2, 3)));
604
605#endif /* SIM_TRACE_H */
This page took 0.704045 seconds and 4 git commands to generate.