]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/annotate.c
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / gdb / annotate.c
1 /* Annotation routines for GDB.
2 Copyright 1986, 89, 90, 91, 92, 95, 1998 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_exited_hook) PARAMS ((void));
38
39 static void
40 print_value_flags (t)
41 struct type *t;
42 {
43 if (can_dereference (t))
44 printf_filtered ("*");
45 else
46 printf_filtered ("-");
47 }
48 \f
49 void
50 breakpoints_changed ()
51 {
52 if (annotation_level > 1)
53 {
54 target_terminal_ours ();
55 printf_unfiltered ("\n\032\032breakpoints-invalid\n");
56 }
57 }
58
59 void
60 annotate_breakpoint (num)
61 int num;
62 {
63 if (annotation_level > 1)
64 printf_filtered ("\n\032\032breakpoint %d\n", num);
65 }
66
67 void
68 annotate_catchpoint (num)
69 int num;
70 {
71 if (annotation_level > 1)
72 printf_filtered ("\n\032\032catchpoint %d\n", num);
73 }
74
75 void
76 annotate_watchpoint (num)
77 int num;
78 {
79 if (annotation_level > 1)
80 printf_filtered ("\n\032\032watchpoint %d\n", num);
81 }
82
83 void
84 annotate_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
98 void
99 annotate_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
110 void
111 annotate_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
123 void
124 annotate_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
133 void
134 annotate_signal_name ()
135 {
136 if (annotation_level > 1)
137 printf_filtered ("\n\032\032signal-name\n");
138 }
139
140 void
141 annotate_signal_name_end ()
142 {
143 if (annotation_level > 1)
144 printf_filtered ("\n\032\032signal-name-end\n");
145 }
146
147 void
148 annotate_signal_string ()
149 {
150 if (annotation_level > 1)
151 printf_filtered ("\n\032\032signal-string\n");
152 }
153
154 void
155 annotate_signal_string_end ()
156 {
157 if (annotation_level > 1)
158 printf_filtered ("\n\032\032signal-string-end\n");
159 }
160
161 void
162 annotate_signal ()
163 {
164 if (annotation_level > 1)
165 printf_filtered ("\n\032\032signal\n");
166 }
167 \f
168 void
169 annotate_breakpoints_headers ()
170 {
171 if (annotation_level > 1)
172 printf_filtered ("\n\032\032breakpoints-headers\n");
173 }
174
175 void
176 annotate_field (num)
177 int num;
178 {
179 if (annotation_level > 1)
180 printf_filtered ("\n\032\032field %d\n", num);
181 }
182
183 void
184 annotate_breakpoints_table ()
185 {
186 if (annotation_level > 1)
187 printf_filtered ("\n\032\032breakpoints-table\n");
188 }
189
190 void
191 annotate_record ()
192 {
193 if (annotation_level > 1)
194 printf_filtered ("\n\032\032record\n");
195 }
196
197 void
198 annotate_breakpoints_table_end ()
199 {
200 if (annotation_level > 1)
201 printf_filtered ("\n\032\032breakpoints-table-end\n");
202 }
203
204 void
205 annotate_frames_invalid ()
206 {
207 if (annotation_level > 1)
208 {
209 target_terminal_ours ();
210 printf_unfiltered ("\n\032\032frames-invalid\n");
211 }
212 }
213
214 void
215 annotate_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
226 void
227 annotate_field_name_end ()
228 {
229 if (annotation_level > 1)
230 printf_filtered ("\n\032\032field-name-end\n");
231 }
232
233 void
234 annotate_field_value ()
235 {
236 if (annotation_level > 1)
237 printf_filtered ("\n\032\032field-value\n");
238 }
239
240 void
241 annotate_field_end ()
242 {
243 if (annotation_level > 1)
244 printf_filtered ("\n\032\032field-end\n");
245 }
246 \f
247 void
248 annotate_quit ()
249 {
250 if (annotation_level > 1)
251 printf_filtered ("\n\032\032quit\n");
252 }
253
254 void
255 annotate_error ()
256 {
257 if (annotation_level > 1)
258 printf_filtered ("\n\032\032error\n");
259 }
260
261 void
262 annotate_error_begin ()
263 {
264 if (annotation_level > 1)
265 fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
266 }
267
268 void
269 annotate_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
281 void
282 annotate_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
293 void
294 annotate_value_history_value ()
295 {
296 if (annotation_level > 1)
297 printf_filtered ("\n\032\032value-history-value\n");
298 }
299
300 void
301 annotate_value_history_end ()
302 {
303 if (annotation_level > 1)
304 printf_filtered ("\n\032\032value-history-end\n");
305 }
306
307 void
308 annotate_value_end ()
309 {
310 if (annotation_level > 1)
311 printf_filtered ("\n\032\032value-end\n");
312 }
313
314 void
315 annotate_display_begin ()
316 {
317 if (annotation_level > 1)
318 printf_filtered ("\n\032\032display-begin\n");
319 }
320
321 void
322 annotate_display_number_end ()
323 {
324 if (annotation_level > 1)
325 printf_filtered ("\n\032\032display-number-end\n");
326 }
327
328 void
329 annotate_display_format ()
330 {
331 if (annotation_level > 1)
332 printf_filtered ("\n\032\032display-format\n");
333 }
334
335 void
336 annotate_display_expression ()
337 {
338 if (annotation_level > 1)
339 printf_filtered ("\n\032\032display-expression\n");
340 }
341
342 void
343 annotate_display_expression_end ()
344 {
345 if (annotation_level > 1)
346 printf_filtered ("\n\032\032display-expression-end\n");
347 }
348
349 void
350 annotate_display_value ()
351 {
352 if (annotation_level > 1)
353 printf_filtered ("\n\032\032display-value\n");
354 }
355
356 void
357 annotate_display_end ()
358 {
359 if (annotation_level > 1)
360 printf_filtered ("\n\032\032display-end\n");
361 }
362
363 void
364 annotate_arg_begin ()
365 {
366 if (annotation_level > 1)
367 printf_filtered ("\n\032\032arg-begin\n");
368 }
369
370 void
371 annotate_arg_name_end ()
372 {
373 if (annotation_level > 1)
374 printf_filtered ("\n\032\032arg-name-end\n");
375 }
376
377 void
378 annotate_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
389 void
390 annotate_arg_end ()
391 {
392 if (annotation_level > 1)
393 printf_filtered ("\n\032\032arg-end\n");
394 }
395
396 void
397 annotate_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
416 void
417 annotate_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
429 void
430 annotate_function_call ()
431 {
432 if (annotation_level > 1)
433 printf_filtered ("\n\032\032function-call\n");
434 }
435
436 void
437 annotate_signal_handler_caller ()
438 {
439 if (annotation_level > 1)
440 printf_filtered ("\n\032\032signal-handler-caller\n");
441 }
442
443 void
444 annotate_frame_address ()
445 {
446 if (annotation_level > 1)
447 printf_filtered ("\n\032\032frame-address\n");
448 }
449
450 void
451 annotate_frame_address_end ()
452 {
453 if (annotation_level > 1)
454 printf_filtered ("\n\032\032frame-address-end\n");
455 }
456
457 void
458 annotate_frame_function_name ()
459 {
460 if (annotation_level > 1)
461 printf_filtered ("\n\032\032frame-function-name\n");
462 }
463
464 void
465 annotate_frame_args ()
466 {
467 if (annotation_level > 1)
468 printf_filtered ("\n\032\032frame-args\n");
469 }
470
471 void
472 annotate_frame_source_begin ()
473 {
474 if (annotation_level > 1)
475 printf_filtered ("\n\032\032frame-source-begin\n");
476 }
477
478 void
479 annotate_frame_source_file ()
480 {
481 if (annotation_level > 1)
482 printf_filtered ("\n\032\032frame-source-file\n");
483 }
484
485 void
486 annotate_frame_source_file_end ()
487 {
488 if (annotation_level > 1)
489 printf_filtered ("\n\032\032frame-source-file-end\n");
490 }
491
492 void
493 annotate_frame_source_line ()
494 {
495 if (annotation_level > 1)
496 printf_filtered ("\n\032\032frame-source-line\n");
497 }
498
499 void
500 annotate_frame_source_end ()
501 {
502 if (annotation_level > 1)
503 printf_filtered ("\n\032\032frame-source-end\n");
504 }
505
506 void
507 annotate_frame_where ()
508 {
509 if (annotation_level > 1)
510 printf_filtered ("\n\032\032frame-where\n");
511 }
512
513 void
514 annotate_frame_end ()
515 {
516 if (annotation_level > 1)
517 printf_filtered ("\n\032\032frame-end\n");
518 }
519 \f
520 void
521 annotate_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
533 void
534 annotate_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
541 void
542 annotate_elt_rep_end ()
543 {
544 if (annotation_level > 1)
545 printf_filtered ("\n\032\032elt-rep-end\n");
546 }
547
548 void
549 annotate_elt ()
550 {
551 if (annotation_level > 1)
552 printf_filtered ("\n\032\032elt\n");
553 }
554
555 void
556 annotate_array_section_end ()
557 {
558 if (annotation_level > 1)
559 printf_filtered ("\n\032\032array-section-end\n");
560 }
561
562 static void
563 breakpoint_changed (b)
564 struct breakpoint *b;
565 {
566 breakpoints_changed ();
567 }
568
569 void
570 _initialize_annotate ()
571 {
572 if (annotation_level > 1)
573 {
574 delete_breakpoint_hook = breakpoint_changed;
575 modify_breakpoint_hook = breakpoint_changed;
576 }
577 }