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