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