* As suggested by crash, made --with-sim-gpu2 option active only on -sky- target.
[deliverable/binutils-gdb.git] / gdb / annotate.c
CommitLineData
1c95d7ab 1/* Annotation routines for GDB.
2e11fdd8 2 Copyright 1986, 1989, 1990, 1991, 1992, 1995 Free Software Foundation, Inc.
1c95d7ab
JK
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
6c9638b4 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1c95d7ab
JK
19
20#include "defs.h"
21#include "annotate.h"
22#include "value.h"
23#include "target.h"
9c036bd8 24#include "gdbtypes.h"
d2a85f11 25#include "breakpoint.h"
9c036bd8
JK
26\f
27static void print_value_flags PARAMS ((struct type *));
b607efe7 28static void breakpoint_changed PARAMS ((struct breakpoint *));
1c95d7ab 29
929db6e5
EZ
30void (*annotate_starting_hook) PARAMS ((void));
31void (*annotate_stopped_hook) PARAMS ((void));
32void (*annotate_signalled_hook) PARAMS ((void));
33void (*annotate_exited_hook) PARAMS ((void));
34
9c036bd8
JK
35static void
36print_value_flags (t)
37 struct type *t;
38{
39 if (can_dereference (t))
40 printf_filtered ("*");
41 else
42 printf_filtered ("-");
43}
44\f
1c95d7ab
JK
45void
46breakpoints_changed ()
47{
48 if (annotation_level > 1)
49 {
50 target_terminal_ours ();
51 printf_unfiltered ("\n\032\032breakpoints-invalid\n");
52 }
53}
54
55void
56annotate_breakpoint (num)
57 int num;
58{
59 if (annotation_level > 1)
60 printf_filtered ("\n\032\032breakpoint %d\n", num);
61}
62
63void
64annotate_watchpoint (num)
65 int num;
66{
67 if (annotation_level > 1)
68 printf_filtered ("\n\032\032watchpoint %d\n", num);
69}
70
71void
72annotate_starting ()
73{
929db6e5
EZ
74
75 if (annotate_starting_hook)
76 annotate_starting_hook ();
77 else
0c070b57 78 {
929db6e5
EZ
79 if (annotation_level > 1)
80 {
81 printf_filtered ("\n\032\032starting\n");
82 }
0c070b57 83 }
1c95d7ab
JK
84}
85
86void
87annotate_stopped ()
88{
929db6e5
EZ
89 if (annotate_stopped_hook)
90 annotate_stopped_hook ();
91 else
92 {
93 if (annotation_level > 1)
94 printf_filtered ("\n\032\032stopped\n");
95 }
1c95d7ab
JK
96}
97
98void
99annotate_exited (exitstatus)
100 int exitstatus;
101{
929db6e5
EZ
102 if (annotate_exited_hook)
103 annotate_exited_hook ();
104 else
105 {
106 if (annotation_level > 1)
107 printf_filtered ("\n\032\032exited %d\n", exitstatus);
108 }
1c95d7ab
JK
109}
110
111void
112annotate_signalled ()
113{
929db6e5
EZ
114 if (annotate_signalled_hook)
115 annotate_signalled_hook ();
116
1c95d7ab
JK
117 if (annotation_level > 1)
118 printf_filtered ("\n\032\032signalled\n");
119}
120
121void
122annotate_signal_name ()
123{
124 if (annotation_level > 1)
125 printf_filtered ("\n\032\032signal-name\n");
126}
127
128void
129annotate_signal_name_end ()
130{
131 if (annotation_level > 1)
132 printf_filtered ("\n\032\032signal-name-end\n");
133}
134
135void
136annotate_signal_string ()
137{
138 if (annotation_level > 1)
139 printf_filtered ("\n\032\032signal-string\n");
140}
141
142void
143annotate_signal_string_end ()
144{
145 if (annotation_level > 1)
146 printf_filtered ("\n\032\032signal-string-end\n");
147}
148
149void
150annotate_signal ()
151{
152 if (annotation_level > 1)
153 printf_filtered ("\n\032\032signal\n");
154}
155\f
156void
157annotate_breakpoints_headers ()
158{
159 if (annotation_level > 1)
160 printf_filtered ("\n\032\032breakpoints-headers\n");
161}
162
163void
164annotate_field (num)
165 int num;
166{
167 if (annotation_level > 1)
168 printf_filtered ("\n\032\032field %d\n", num);
169}
170
171void
172annotate_breakpoints_table ()
173{
174 if (annotation_level > 1)
175 printf_filtered ("\n\032\032breakpoints-table\n");
176}
177
178void
179annotate_record ()
180{
181 if (annotation_level > 1)
182 printf_filtered ("\n\032\032record\n");
183}
184
185void
186annotate_breakpoints_table_end ()
187{
188 if (annotation_level > 1)
189 printf_filtered ("\n\032\032breakpoints-table-end\n");
190}
191
192void
193annotate_frames_invalid ()
194{
195 if (annotation_level > 1)
196 {
197 target_terminal_ours ();
198 printf_unfiltered ("\n\032\032frames-invalid\n");
199 }
200}
201
202void
203annotate_field_begin (type)
204 struct type *type;
205{
206 if (annotation_level > 1)
207 {
208 printf_filtered ("\n\032\032field-begin ");
209 print_value_flags (type);
210 printf_filtered ("\n");
211 }
212}
213
214void
215annotate_field_name_end ()
216{
217 if (annotation_level > 1)
218 printf_filtered ("\n\032\032field-name-end\n");
219}
220
221void
222annotate_field_value ()
223{
224 if (annotation_level > 1)
225 printf_filtered ("\n\032\032field-value\n");
226}
227
228void
229annotate_field_end ()
230{
231 if (annotation_level > 1)
20b3c1aa 232 printf_filtered ("\n\032\032field-end\n");
1c95d7ab
JK
233}
234\f
235void
236annotate_quit ()
237{
238 if (annotation_level > 1)
239 printf_filtered ("\n\032\032quit\n");
240}
241
242void
243annotate_error ()
244{
245 if (annotation_level > 1)
246 printf_filtered ("\n\032\032error\n");
247}
248
249void
250annotate_error_begin ()
251{
252 if (annotation_level > 1)
253 fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
254}
255
256void
257annotate_value_history_begin (histindex, type)
258 int histindex;
259 struct type *type;
260{
261 if (annotation_level > 1)
262 {
263 printf_filtered ("\n\032\032value-history-begin %d ", histindex);
264 print_value_flags (type);
265 printf_filtered ("\n");
266 }
267}
268
269void
270annotate_value_begin (type)
271 struct type *type;
272{
273 if (annotation_level > 1)
274 {
275 printf_filtered ("\n\032\032value-begin ");
276 print_value_flags (type);
277 printf_filtered ("\n");
278 }
279}
280
281void
282annotate_value_history_value ()
283{
284 if (annotation_level > 1)
285 printf_filtered ("\n\032\032value-history-value\n");
286}
287
288void
289annotate_value_history_end ()
290{
291 if (annotation_level > 1)
292 printf_filtered ("\n\032\032value-history-end\n");
293}
294
295void
296annotate_value_end ()
297{
298 if (annotation_level > 1)
299 printf_filtered ("\n\032\032value-end\n");
300}
301
302void
303annotate_display_begin ()
304{
305 if (annotation_level > 1)
306 printf_filtered ("\n\032\032display-begin\n");
307}
308
309void
310annotate_display_number_end ()
311{
312 if (annotation_level > 1)
313 printf_filtered ("\n\032\032display-number-end\n");
314}
315
316void
317annotate_display_format ()
318{
319 if (annotation_level > 1)
320 printf_filtered ("\n\032\032display-format\n");
321}
322
323void
324annotate_display_expression ()
325{
326 if (annotation_level > 1)
327 printf_filtered ("\n\032\032display-expression\n");
328}
329
330void
331annotate_display_expression_end ()
332{
333 if (annotation_level > 1)
334 printf_filtered ("\n\032\032display-expression-end\n");
335}
336
337void
338annotate_display_value ()
339{
340 if (annotation_level > 1)
341 printf_filtered ("\n\032\032display-value\n");
342}
343
344void
345annotate_display_end ()
346{
347 if (annotation_level > 1)
348 printf_filtered ("\n\032\032display-end\n");
349}
350
351void
352annotate_arg_begin ()
353{
354 if (annotation_level > 1)
355 printf_filtered ("\n\032\032arg-begin\n");
356}
357
358void
359annotate_arg_name_end ()
360{
361 if (annotation_level > 1)
362 printf_filtered ("\n\032\032arg-name-end\n");
363}
364
365void
366annotate_arg_value (type)
367 struct type *type;
368{
369 if (annotation_level > 1)
370 {
371 printf_filtered ("\n\032\032arg-value ");
372 print_value_flags (type);
373 printf_filtered ("\n");
374 }
375}
376
377void
378annotate_arg_end ()
379{
380 if (annotation_level > 1)
381 printf_filtered ("\n\032\032arg-end\n");
382}
383
384void
385annotate_source (filename, line, character, mid, pc)
386 char *filename;
387 int line;
388 int character;
389 int mid;
390 CORE_ADDR pc;
391{
392 if (annotation_level > 1)
393 printf_filtered ("\n\032\032source ");
394 else
395 printf_filtered ("\032\032");
396
2e11fdd8 397 printf_filtered ("%s:%d:%d:%s:0x", filename,
1c95d7ab
JK
398 line, character,
399 mid ? "middle" : "beg");
400 print_address_numeric (pc, 0, gdb_stdout);
401 printf_filtered ("\n");
402}
403
404void
405annotate_frame_begin (level, pc)
406 int level;
407 CORE_ADDR pc;
408{
409 if (annotation_level > 1)
410 {
2e11fdd8 411 printf_filtered ("\n\032\032frame-begin %d 0x", level);
1c95d7ab
JK
412 print_address_numeric (pc, 0, gdb_stdout);
413 printf_filtered ("\n");
414 }
415}
416
417void
418annotate_function_call ()
419{
420 if (annotation_level > 1)
421 printf_filtered ("\n\032\032function-call\n");
422}
423
424void
425annotate_signal_handler_caller ()
426{
427 if (annotation_level > 1)
428 printf_filtered ("\n\032\032signal-handler-caller\n");
429}
430
431void
432annotate_frame_address ()
433{
434 if (annotation_level > 1)
435 printf_filtered ("\n\032\032frame-address\n");
436}
437
438void
439annotate_frame_address_end ()
440{
441 if (annotation_level > 1)
442 printf_filtered ("\n\032\032frame-address-end\n");
443}
444
445void
446annotate_frame_function_name ()
447{
448 if (annotation_level > 1)
449 printf_filtered ("\n\032\032frame-function-name\n");
450}
451
452void
453annotate_frame_args ()
454{
455 if (annotation_level > 1)
456 printf_filtered ("\n\032\032frame-args\n");
457}
458
459void
460annotate_frame_source_begin ()
461{
462 if (annotation_level > 1)
463 printf_filtered ("\n\032\032frame-source-begin\n");
464}
465
466void
467annotate_frame_source_file ()
468{
469 if (annotation_level > 1)
470 printf_filtered ("\n\032\032frame-source-file\n");
471}
472
473void
474annotate_frame_source_file_end ()
475{
476 if (annotation_level > 1)
477 printf_filtered ("\n\032\032frame-source-file-end\n");
478}
479
480void
481annotate_frame_source_line ()
482{
483 if (annotation_level > 1)
484 printf_filtered ("\n\032\032frame-source-line\n");
485}
486
487void
488annotate_frame_source_end ()
489{
490 if (annotation_level > 1)
491 printf_filtered ("\n\032\032frame-source-end\n");
492}
493
494void
495annotate_frame_where ()
496{
497 if (annotation_level > 1)
498 printf_filtered ("\n\032\032frame-where\n");
499}
500
501void
502annotate_frame_end ()
503{
504 if (annotation_level > 1)
505 printf_filtered ("\n\032\032frame-end\n");
506}
507\f
508void
509annotate_array_section_begin (index, elttype)
510 int index;
511 struct type *elttype;
512{
513 if (annotation_level > 1)
514 {
515 printf_filtered ("\n\032\032array-section-begin %d ", index);
516 print_value_flags (elttype);
517 printf_filtered ("\n");
518 }
519}
520
521void
522annotate_elt_rep (repcount)
523 unsigned int repcount;
524{
525 if (annotation_level > 1)
526 printf_filtered ("\n\032\032elt-rep %u\n", repcount);
527}
528
529void
530annotate_elt_rep_end ()
531{
532 if (annotation_level > 1)
533 printf_filtered ("\n\032\032elt-rep-end\n");
534}
535
536void
537annotate_elt ()
538{
539 if (annotation_level > 1)
540 printf_filtered ("\n\032\032elt\n");
541}
542
543void
544annotate_array_section_end ()
545{
546 if (annotation_level > 1)
547 printf_filtered ("\n\032\032array-section-end\n");
548}
549
d2a85f11
JMD
550static void
551breakpoint_changed (b)
552 struct breakpoint *b;
553{
554 breakpoints_changed ();
555}
556
557void
558_initialize_annotate ()
559{
560 if (annotation_level > 1)
561 {
562 delete_breakpoint_hook = breakpoint_changed;
6131622e 563 modify_breakpoint_hook = breakpoint_changed;
d2a85f11
JMD
564 }
565}
This page took 0.171959 seconds and 4 git commands to generate.