]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/annotate.c
import gdb-1999-07-07 post reformat
[thirdparty/binutils-gdb.git] / gdb / annotate.c
1 /* Annotation routines for GDB.
2 Copyright 1986, 89, 90, 91, 92, 95, 98, 1999 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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. */
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
31 extern void _initialize_annotate PARAMS ((void));
32
33 static void print_value_flags PARAMS ((struct type *));
34
35 static void breakpoint_changed PARAMS ((struct breakpoint *));
36
37 void (*annotate_starting_hook) PARAMS ((void));
38 void (*annotate_stopped_hook) PARAMS ((void));
39 void (*annotate_signalled_hook) PARAMS ((void));
40 void (*annotate_signal_hook) PARAMS ((void));
41 void (*annotate_exited_hook) PARAMS ((void));
42
43 static void
44 print_value_flags (t)
45 struct type *t;
46 {
47 if (can_dereference (t))
48 printf_filtered ("*");
49 else
50 printf_filtered ("-");
51 }
52 \f
53 void
54 breakpoints_changed ()
55 {
56 if (annotation_level > 1)
57 {
58 target_terminal_ours ();
59 printf_unfiltered ("\n\032\032breakpoints-invalid\n");
60 }
61 }
62
63 void
64 annotate_breakpoint (num)
65 int num;
66 {
67 if (annotation_level > 1)
68 printf_filtered ("\n\032\032breakpoint %d\n", num);
69 }
70
71 void
72 annotate_catchpoint (num)
73 int num;
74 {
75 if (annotation_level > 1)
76 printf_filtered ("\n\032\032catchpoint %d\n", num);
77 }
78
79 void
80 annotate_watchpoint (num)
81 int num;
82 {
83 if (annotation_level > 1)
84 printf_filtered ("\n\032\032watchpoint %d\n", num);
85 }
86
87 void
88 annotate_starting ()
89 {
90
91 if (annotate_starting_hook)
92 annotate_starting_hook ();
93 else
94 {
95 if (annotation_level > 1)
96 {
97 printf_filtered ("\n\032\032starting\n");
98 }
99 }
100 }
101
102 void
103 annotate_stopped ()
104 {
105 if (annotate_stopped_hook)
106 annotate_stopped_hook ();
107 else
108 {
109 if (annotation_level > 1)
110 printf_filtered ("\n\032\032stopped\n");
111 }
112 }
113
114 void
115 annotate_exited (exitstatus)
116 int exitstatus;
117 {
118 if (annotate_exited_hook)
119 annotate_exited_hook ();
120 else
121 {
122 if (annotation_level > 1)
123 printf_filtered ("\n\032\032exited %d\n", exitstatus);
124 }
125 }
126
127 void
128 annotate_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
137 void
138 annotate_signal_name ()
139 {
140 if (annotation_level > 1)
141 printf_filtered ("\n\032\032signal-name\n");
142 }
143
144 void
145 annotate_signal_name_end ()
146 {
147 if (annotation_level > 1)
148 printf_filtered ("\n\032\032signal-name-end\n");
149 }
150
151 void
152 annotate_signal_string ()
153 {
154 if (annotation_level > 1)
155 printf_filtered ("\n\032\032signal-string\n");
156 }
157
158 void
159 annotate_signal_string_end ()
160 {
161 if (annotation_level > 1)
162 printf_filtered ("\n\032\032signal-string-end\n");
163 }
164
165 void
166 annotate_signal ()
167 {
168 if (annotate_signal_hook)
169 annotate_signal_hook ();
170
171 if (annotation_level > 1)
172 printf_filtered ("\n\032\032signal\n");
173 }
174 \f
175 void
176 annotate_breakpoints_headers ()
177 {
178 if (annotation_level > 1)
179 printf_filtered ("\n\032\032breakpoints-headers\n");
180 }
181
182 void
183 annotate_field (num)
184 int num;
185 {
186 if (annotation_level > 1)
187 printf_filtered ("\n\032\032field %d\n", num);
188 }
189
190 void
191 annotate_breakpoints_table ()
192 {
193 if (annotation_level > 1)
194 printf_filtered ("\n\032\032breakpoints-table\n");
195 }
196
197 void
198 annotate_record ()
199 {
200 if (annotation_level > 1)
201 printf_filtered ("\n\032\032record\n");
202 }
203
204 void
205 annotate_breakpoints_table_end ()
206 {
207 if (annotation_level > 1)
208 printf_filtered ("\n\032\032breakpoints-table-end\n");
209 }
210
211 void
212 annotate_frames_invalid ()
213 {
214 if (annotation_level > 1)
215 {
216 target_terminal_ours ();
217 printf_unfiltered ("\n\032\032frames-invalid\n");
218 }
219 }
220
221 void
222 annotate_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
233 void
234 annotate_field_name_end ()
235 {
236 if (annotation_level > 1)
237 printf_filtered ("\n\032\032field-name-end\n");
238 }
239
240 void
241 annotate_field_value ()
242 {
243 if (annotation_level > 1)
244 printf_filtered ("\n\032\032field-value\n");
245 }
246
247 void
248 annotate_field_end ()
249 {
250 if (annotation_level > 1)
251 printf_filtered ("\n\032\032field-end\n");
252 }
253 \f
254 void
255 annotate_quit ()
256 {
257 if (annotation_level > 1)
258 printf_filtered ("\n\032\032quit\n");
259 }
260
261 void
262 annotate_error ()
263 {
264 if (annotation_level > 1)
265 printf_filtered ("\n\032\032error\n");
266 }
267
268 void
269 annotate_error_begin ()
270 {
271 if (annotation_level > 1)
272 fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
273 }
274
275 void
276 annotate_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
288 void
289 annotate_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
300 void
301 annotate_value_history_value ()
302 {
303 if (annotation_level > 1)
304 printf_filtered ("\n\032\032value-history-value\n");
305 }
306
307 void
308 annotate_value_history_end ()
309 {
310 if (annotation_level > 1)
311 printf_filtered ("\n\032\032value-history-end\n");
312 }
313
314 void
315 annotate_value_end ()
316 {
317 if (annotation_level > 1)
318 printf_filtered ("\n\032\032value-end\n");
319 }
320
321 void
322 annotate_display_begin ()
323 {
324 if (annotation_level > 1)
325 printf_filtered ("\n\032\032display-begin\n");
326 }
327
328 void
329 annotate_display_number_end ()
330 {
331 if (annotation_level > 1)
332 printf_filtered ("\n\032\032display-number-end\n");
333 }
334
335 void
336 annotate_display_format ()
337 {
338 if (annotation_level > 1)
339 printf_filtered ("\n\032\032display-format\n");
340 }
341
342 void
343 annotate_display_expression ()
344 {
345 if (annotation_level > 1)
346 printf_filtered ("\n\032\032display-expression\n");
347 }
348
349 void
350 annotate_display_expression_end ()
351 {
352 if (annotation_level > 1)
353 printf_filtered ("\n\032\032display-expression-end\n");
354 }
355
356 void
357 annotate_display_value ()
358 {
359 if (annotation_level > 1)
360 printf_filtered ("\n\032\032display-value\n");
361 }
362
363 void
364 annotate_display_end ()
365 {
366 if (annotation_level > 1)
367 printf_filtered ("\n\032\032display-end\n");
368 }
369
370 void
371 annotate_arg_begin ()
372 {
373 if (annotation_level > 1)
374 printf_filtered ("\n\032\032arg-begin\n");
375 }
376
377 void
378 annotate_arg_name_end ()
379 {
380 if (annotation_level > 1)
381 printf_filtered ("\n\032\032arg-name-end\n");
382 }
383
384 void
385 annotate_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
396 void
397 annotate_arg_end ()
398 {
399 if (annotation_level > 1)
400 printf_filtered ("\n\032\032arg-end\n");
401 }
402
403 void
404 annotate_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
423 void
424 annotate_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
436 void
437 annotate_function_call ()
438 {
439 if (annotation_level > 1)
440 printf_filtered ("\n\032\032function-call\n");
441 }
442
443 void
444 annotate_signal_handler_caller ()
445 {
446 if (annotation_level > 1)
447 printf_filtered ("\n\032\032signal-handler-caller\n");
448 }
449
450 void
451 annotate_frame_address ()
452 {
453 if (annotation_level > 1)
454 printf_filtered ("\n\032\032frame-address\n");
455 }
456
457 void
458 annotate_frame_address_end ()
459 {
460 if (annotation_level > 1)
461 printf_filtered ("\n\032\032frame-address-end\n");
462 }
463
464 void
465 annotate_frame_function_name ()
466 {
467 if (annotation_level > 1)
468 printf_filtered ("\n\032\032frame-function-name\n");
469 }
470
471 void
472 annotate_frame_args ()
473 {
474 if (annotation_level > 1)
475 printf_filtered ("\n\032\032frame-args\n");
476 }
477
478 void
479 annotate_frame_source_begin ()
480 {
481 if (annotation_level > 1)
482 printf_filtered ("\n\032\032frame-source-begin\n");
483 }
484
485 void
486 annotate_frame_source_file ()
487 {
488 if (annotation_level > 1)
489 printf_filtered ("\n\032\032frame-source-file\n");
490 }
491
492 void
493 annotate_frame_source_file_end ()
494 {
495 if (annotation_level > 1)
496 printf_filtered ("\n\032\032frame-source-file-end\n");
497 }
498
499 void
500 annotate_frame_source_line ()
501 {
502 if (annotation_level > 1)
503 printf_filtered ("\n\032\032frame-source-line\n");
504 }
505
506 void
507 annotate_frame_source_end ()
508 {
509 if (annotation_level > 1)
510 printf_filtered ("\n\032\032frame-source-end\n");
511 }
512
513 void
514 annotate_frame_where ()
515 {
516 if (annotation_level > 1)
517 printf_filtered ("\n\032\032frame-where\n");
518 }
519
520 void
521 annotate_frame_end ()
522 {
523 if (annotation_level > 1)
524 printf_filtered ("\n\032\032frame-end\n");
525 }
526 \f
527 void
528 annotate_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
540 void
541 annotate_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
548 void
549 annotate_elt_rep_end ()
550 {
551 if (annotation_level > 1)
552 printf_filtered ("\n\032\032elt-rep-end\n");
553 }
554
555 void
556 annotate_elt ()
557 {
558 if (annotation_level > 1)
559 printf_filtered ("\n\032\032elt\n");
560 }
561
562 void
563 annotate_array_section_end ()
564 {
565 if (annotation_level > 1)
566 printf_filtered ("\n\032\032array-section-end\n");
567 }
568
569 static void
570 breakpoint_changed (b)
571 struct breakpoint *b;
572 {
573 breakpoints_changed ();
574 }
575
576 void
577 _initialize_annotate ()
578 {
579 if (annotation_level > 1)
580 {
581 delete_breakpoint_hook = breakpoint_changed;
582 modify_breakpoint_hook = breakpoint_changed;
583 }
584 }