* config/m68k/delta68.mh (NAT_FILE): Undo 1998-08-18 change;
[deliverable/binutils-gdb.git] / gdb / annotate.c
CommitLineData
1c95d7ab 1/* Annotation routines for GDB.
879c0417 2 Copyright 1986, 89, 90, 91, 92, 95, 1998 Free Software Foundation, Inc.
1c95d7ab
JK
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
6c9638b4 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1c95d7ab
JK
19
20#include "defs.h"
21#include "annotate.h"
22#include "value.h"
23#include "target.h"
9c036bd8 24#include "gdbtypes.h"
d2a85f11 25#include "breakpoint.h"
9c036bd8 26\f
879c0417
JM
27
28/* Prototypes for local functions. */
29
9c036bd8 30static void print_value_flags PARAMS ((struct type *));
879c0417 31
b607efe7 32static void breakpoint_changed PARAMS ((struct breakpoint *));
1c95d7ab 33
929db6e5
EZ
34void (*annotate_starting_hook) PARAMS ((void));
35void (*annotate_stopped_hook) PARAMS ((void));
36void (*annotate_signalled_hook) PARAMS ((void));
37void (*annotate_exited_hook) PARAMS ((void));
38
9c036bd8
JK
39static void
40print_value_flags (t)
41 struct type *t;
42{
43 if (can_dereference (t))
44 printf_filtered ("*");
45 else
46 printf_filtered ("-");
47}
48\f
1c95d7ab
JK
49void
50breakpoints_changed ()
51{
52 if (annotation_level > 1)
53 {
54 target_terminal_ours ();
55 printf_unfiltered ("\n\032\032breakpoints-invalid\n");
56 }
57}
58
59void
60annotate_breakpoint (num)
61 int num;
62{
63 if (annotation_level > 1)
64 printf_filtered ("\n\032\032breakpoint %d\n", num);
65}
66
67void
68annotate_watchpoint (num)
69 int num;
70{
71 if (annotation_level > 1)
72 printf_filtered ("\n\032\032watchpoint %d\n", num);
73}
74
75void
76annotate_starting ()
77{
929db6e5
EZ
78
79 if (annotate_starting_hook)
80 annotate_starting_hook ();
81 else
0c070b57 82 {
929db6e5
EZ
83 if (annotation_level > 1)
84 {
85 printf_filtered ("\n\032\032starting\n");
86 }
0c070b57 87 }
1c95d7ab
JK
88}
89
90void
91annotate_stopped ()
92{
929db6e5
EZ
93 if (annotate_stopped_hook)
94 annotate_stopped_hook ();
95 else
96 {
97 if (annotation_level > 1)
98 printf_filtered ("\n\032\032stopped\n");
99 }
1c95d7ab
JK
100}
101
102void
103annotate_exited (exitstatus)
104 int exitstatus;
105{
929db6e5
EZ
106 if (annotate_exited_hook)
107 annotate_exited_hook ();
108 else
109 {
110 if (annotation_level > 1)
111 printf_filtered ("\n\032\032exited %d\n", exitstatus);
112 }
1c95d7ab
JK
113}
114
115void
116annotate_signalled ()
117{
929db6e5
EZ
118 if (annotate_signalled_hook)
119 annotate_signalled_hook ();
120
1c95d7ab
JK
121 if (annotation_level > 1)
122 printf_filtered ("\n\032\032signalled\n");
123}
124
125void
126annotate_signal_name ()
127{
128 if (annotation_level > 1)
129 printf_filtered ("\n\032\032signal-name\n");
130}
131
132void
133annotate_signal_name_end ()
134{
135 if (annotation_level > 1)
136 printf_filtered ("\n\032\032signal-name-end\n");
137}
138
139void
140annotate_signal_string ()
141{
142 if (annotation_level > 1)
143 printf_filtered ("\n\032\032signal-string\n");
144}
145
146void
147annotate_signal_string_end ()
148{
149 if (annotation_level > 1)
150 printf_filtered ("\n\032\032signal-string-end\n");
151}
152
153void
154annotate_signal ()
155{
156 if (annotation_level > 1)
157 printf_filtered ("\n\032\032signal\n");
158}
159\f
160void
161annotate_breakpoints_headers ()
162{
163 if (annotation_level > 1)
164 printf_filtered ("\n\032\032breakpoints-headers\n");
165}
166
167void
168annotate_field (num)
169 int num;
170{
171 if (annotation_level > 1)
172 printf_filtered ("\n\032\032field %d\n", num);
173}
174
175void
176annotate_breakpoints_table ()
177{
178 if (annotation_level > 1)
179 printf_filtered ("\n\032\032breakpoints-table\n");
180}
181
182void
183annotate_record ()
184{
185 if (annotation_level > 1)
186 printf_filtered ("\n\032\032record\n");
187}
188
189void
190annotate_breakpoints_table_end ()
191{
192 if (annotation_level > 1)
193 printf_filtered ("\n\032\032breakpoints-table-end\n");
194}
195
196void
197annotate_frames_invalid ()
198{
199 if (annotation_level > 1)
200 {
201 target_terminal_ours ();
202 printf_unfiltered ("\n\032\032frames-invalid\n");
203 }
204}
205
206void
207annotate_field_begin (type)
208 struct type *type;
209{
210 if (annotation_level > 1)
211 {
212 printf_filtered ("\n\032\032field-begin ");
213 print_value_flags (type);
214 printf_filtered ("\n");
215 }
216}
217
218void
219annotate_field_name_end ()
220{
221 if (annotation_level > 1)
222 printf_filtered ("\n\032\032field-name-end\n");
223}
224
225void
226annotate_field_value ()
227{
228 if (annotation_level > 1)
229 printf_filtered ("\n\032\032field-value\n");
230}
231
232void
233annotate_field_end ()
234{
235 if (annotation_level > 1)
20b3c1aa 236 printf_filtered ("\n\032\032field-end\n");
1c95d7ab
JK
237}
238\f
239void
240annotate_quit ()
241{
242 if (annotation_level > 1)
243 printf_filtered ("\n\032\032quit\n");
244}
245
246void
247annotate_error ()
248{
249 if (annotation_level > 1)
250 printf_filtered ("\n\032\032error\n");
251}
252
253void
254annotate_error_begin ()
255{
256 if (annotation_level > 1)
257 fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
258}
259
260void
261annotate_value_history_begin (histindex, type)
262 int histindex;
263 struct type *type;
264{
265 if (annotation_level > 1)
266 {
267 printf_filtered ("\n\032\032value-history-begin %d ", histindex);
268 print_value_flags (type);
269 printf_filtered ("\n");
270 }
271}
272
273void
274annotate_value_begin (type)
275 struct type *type;
276{
277 if (annotation_level > 1)
278 {
279 printf_filtered ("\n\032\032value-begin ");
280 print_value_flags (type);
281 printf_filtered ("\n");
282 }
283}
284
285void
286annotate_value_history_value ()
287{
288 if (annotation_level > 1)
289 printf_filtered ("\n\032\032value-history-value\n");
290}
291
292void
293annotate_value_history_end ()
294{
295 if (annotation_level > 1)
296 printf_filtered ("\n\032\032value-history-end\n");
297}
298
299void
300annotate_value_end ()
301{
302 if (annotation_level > 1)
303 printf_filtered ("\n\032\032value-end\n");
304}
305
306void
307annotate_display_begin ()
308{
309 if (annotation_level > 1)
310 printf_filtered ("\n\032\032display-begin\n");
311}
312
313void
314annotate_display_number_end ()
315{
316 if (annotation_level > 1)
317 printf_filtered ("\n\032\032display-number-end\n");
318}
319
320void
321annotate_display_format ()
322{
323 if (annotation_level > 1)
324 printf_filtered ("\n\032\032display-format\n");
325}
326
327void
328annotate_display_expression ()
329{
330 if (annotation_level > 1)
331 printf_filtered ("\n\032\032display-expression\n");
332}
333
334void
335annotate_display_expression_end ()
336{
337 if (annotation_level > 1)
338 printf_filtered ("\n\032\032display-expression-end\n");
339}
340
341void
342annotate_display_value ()
343{
344 if (annotation_level > 1)
345 printf_filtered ("\n\032\032display-value\n");
346}
347
348void
349annotate_display_end ()
350{
351 if (annotation_level > 1)
352 printf_filtered ("\n\032\032display-end\n");
353}
354
355void
356annotate_arg_begin ()
357{
358 if (annotation_level > 1)
359 printf_filtered ("\n\032\032arg-begin\n");
360}
361
362void
363annotate_arg_name_end ()
364{
365 if (annotation_level > 1)
366 printf_filtered ("\n\032\032arg-name-end\n");
367}
368
369void
370annotate_arg_value (type)
371 struct type *type;
372{
373 if (annotation_level > 1)
374 {
375 printf_filtered ("\n\032\032arg-value ");
376 print_value_flags (type);
377 printf_filtered ("\n");
378 }
379}
380
381void
382annotate_arg_end ()
383{
384 if (annotation_level > 1)
385 printf_filtered ("\n\032\032arg-end\n");
386}
387
388void
389annotate_source (filename, line, character, mid, pc)
390 char *filename;
391 int line;
392 int character;
393 int mid;
394 CORE_ADDR pc;
395{
396 if (annotation_level > 1)
397 printf_filtered ("\n\032\032source ");
398 else
399 printf_filtered ("\032\032");
400
2e11fdd8 401 printf_filtered ("%s:%d:%d:%s:0x", filename,
1c95d7ab
JK
402 line, character,
403 mid ? "middle" : "beg");
404 print_address_numeric (pc, 0, gdb_stdout);
405 printf_filtered ("\n");
406}
407
408void
409annotate_frame_begin (level, pc)
410 int level;
411 CORE_ADDR pc;
412{
413 if (annotation_level > 1)
414 {
2e11fdd8 415 printf_filtered ("\n\032\032frame-begin %d 0x", level);
1c95d7ab
JK
416 print_address_numeric (pc, 0, gdb_stdout);
417 printf_filtered ("\n");
418 }
419}
420
421void
422annotate_function_call ()
423{
424 if (annotation_level > 1)
425 printf_filtered ("\n\032\032function-call\n");
426}
427
428void
429annotate_signal_handler_caller ()
430{
431 if (annotation_level > 1)
432 printf_filtered ("\n\032\032signal-handler-caller\n");
433}
434
435void
436annotate_frame_address ()
437{
438 if (annotation_level > 1)
439 printf_filtered ("\n\032\032frame-address\n");
440}
441
442void
443annotate_frame_address_end ()
444{
445 if (annotation_level > 1)
446 printf_filtered ("\n\032\032frame-address-end\n");
447}
448
449void
450annotate_frame_function_name ()
451{
452 if (annotation_level > 1)
453 printf_filtered ("\n\032\032frame-function-name\n");
454}
455
456void
457annotate_frame_args ()
458{
459 if (annotation_level > 1)
460 printf_filtered ("\n\032\032frame-args\n");
461}
462
463void
464annotate_frame_source_begin ()
465{
466 if (annotation_level > 1)
467 printf_filtered ("\n\032\032frame-source-begin\n");
468}
469
470void
471annotate_frame_source_file ()
472{
473 if (annotation_level > 1)
474 printf_filtered ("\n\032\032frame-source-file\n");
475}
476
477void
478annotate_frame_source_file_end ()
479{
480 if (annotation_level > 1)
481 printf_filtered ("\n\032\032frame-source-file-end\n");
482}
483
484void
485annotate_frame_source_line ()
486{
487 if (annotation_level > 1)
488 printf_filtered ("\n\032\032frame-source-line\n");
489}
490
491void
492annotate_frame_source_end ()
493{
494 if (annotation_level > 1)
495 printf_filtered ("\n\032\032frame-source-end\n");
496}
497
498void
499annotate_frame_where ()
500{
501 if (annotation_level > 1)
502 printf_filtered ("\n\032\032frame-where\n");
503}
504
505void
506annotate_frame_end ()
507{
508 if (annotation_level > 1)
509 printf_filtered ("\n\032\032frame-end\n");
510}
511\f
512void
513annotate_array_section_begin (index, elttype)
514 int index;
515 struct type *elttype;
516{
517 if (annotation_level > 1)
518 {
519 printf_filtered ("\n\032\032array-section-begin %d ", index);
520 print_value_flags (elttype);
521 printf_filtered ("\n");
522 }
523}
524
525void
526annotate_elt_rep (repcount)
527 unsigned int repcount;
528{
529 if (annotation_level > 1)
530 printf_filtered ("\n\032\032elt-rep %u\n", repcount);
531}
532
533void
534annotate_elt_rep_end ()
535{
536 if (annotation_level > 1)
537 printf_filtered ("\n\032\032elt-rep-end\n");
538}
539
540void
541annotate_elt ()
542{
543 if (annotation_level > 1)
544 printf_filtered ("\n\032\032elt\n");
545}
546
547void
548annotate_array_section_end ()
549{
550 if (annotation_level > 1)
551 printf_filtered ("\n\032\032array-section-end\n");
552}
553
d2a85f11
JMD
554static void
555breakpoint_changed (b)
556 struct breakpoint *b;
557{
558 breakpoints_changed ();
559}
560
561void
562_initialize_annotate ()
563{
564 if (annotation_level > 1)
565 {
566 delete_breakpoint_hook = breakpoint_changed;
6131622e 567 modify_breakpoint_hook = breakpoint_changed;
d2a85f11
JMD
568 }
569}
This page took 0.191035 seconds and 4 git commands to generate.