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