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