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