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