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