Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Annotation routines for GDB. |
b811d2c2 | 2 | Copyright (C) 1986-2020 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" | |
4de283e4 TT |
21 | #include "value.h" |
22 | #include "target.h" | |
d55e5aa6 | 23 | #include "gdbtypes.h" |
4de283e4 TT |
24 | #include "breakpoint.h" |
25 | #include "observable.h" | |
bd00c694 | 26 | #include "inferior.h" |
45741a9c | 27 | #include "infrun.h" |
3b12939d | 28 | #include "top.h" |
0d3abd8c AB |
29 | #include "source.h" |
30 | #include "objfiles.h" | |
cb44333d | 31 | #include "source-cache.h" |
c906108c SS |
32 | \f |
33 | ||
0e2de366 | 34 | /* Prototypes for local functions. */ |
c906108c | 35 | |
a14ed312 | 36 | static void print_value_flags (struct type *); |
c906108c | 37 | |
8d3788bd | 38 | static void breakpoint_changed (struct breakpoint *b); |
7f4b89d1 | 39 | |
c906108c | 40 | |
9a4105ab AC |
41 | void (*deprecated_annotate_signalled_hook) (void); |
42 | void (*deprecated_annotate_signal_hook) (void); | |
c906108c | 43 | |
bd00c694 PA |
44 | /* Booleans indicating whether we've emitted certain notifications. |
45 | Used to suppress useless repeated notifications until the next time | |
46 | we're ready to accept more commands. Reset whenever a prompt is | |
47 | displayed. */ | |
48 | static int frames_invalid_emitted; | |
49 | static int breakpoints_invalid_emitted; | |
50 | ||
c906108c | 51 | static void |
fba45db2 | 52 | print_value_flags (struct type *t) |
c906108c SS |
53 | { |
54 | if (can_dereference (t)) | |
a3f17187 | 55 | printf_filtered (("*")); |
c906108c | 56 | else |
a3f17187 | 57 | printf_filtered (("-")); |
c906108c | 58 | } |
9c97429f PA |
59 | |
60 | static void | |
61 | annotate_breakpoints_invalid (void) | |
c906108c | 62 | { |
bd00c694 PA |
63 | if (annotation_level == 2 |
64 | && (!breakpoints_invalid_emitted | |
3b12939d | 65 | || current_ui->prompt_state != PROMPT_BLOCKED)) |
c906108c | 66 | { |
7c39e397 | 67 | target_terminal::scoped_restore_terminal_state term_state; |
223ffa71 | 68 | target_terminal::ours_for_output (); |
6fdebc3d | 69 | |
a3f17187 | 70 | printf_unfiltered (("\n\032\032breakpoints-invalid\n")); |
bd00c694 | 71 | breakpoints_invalid_emitted = 1; |
c906108c SS |
72 | } |
73 | } | |
74 | ||
75 | void | |
fba45db2 | 76 | annotate_breakpoint (int num) |
c906108c SS |
77 | { |
78 | if (annotation_level > 1) | |
a3f17187 | 79 | printf_filtered (("\n\032\032breakpoint %d\n"), num); |
c906108c SS |
80 | } |
81 | ||
82 | void | |
fba45db2 | 83 | annotate_catchpoint (int num) |
c906108c SS |
84 | { |
85 | if (annotation_level > 1) | |
a3f17187 | 86 | printf_filtered (("\n\032\032catchpoint %d\n"), num); |
c906108c SS |
87 | } |
88 | ||
89 | void | |
fba45db2 | 90 | annotate_watchpoint (int num) |
c906108c SS |
91 | { |
92 | if (annotation_level > 1) | |
a3f17187 | 93 | printf_filtered (("\n\032\032watchpoint %d\n"), num); |
c906108c SS |
94 | } |
95 | ||
96 | void | |
fba45db2 | 97 | annotate_starting (void) |
c906108c | 98 | { |
7f4b89d1 TT |
99 | if (annotation_level > 1) |
100 | printf_filtered (("\n\032\032starting\n")); | |
c906108c SS |
101 | } |
102 | ||
103 | void | |
fba45db2 | 104 | annotate_stopped (void) |
c906108c | 105 | { |
7f4b89d1 TT |
106 | if (annotation_level > 1) |
107 | printf_filtered (("\n\032\032stopped\n")); | |
c906108c SS |
108 | } |
109 | ||
110 | void | |
fba45db2 | 111 | annotate_exited (int exitstatus) |
c906108c | 112 | { |
7f4b89d1 TT |
113 | if (annotation_level > 1) |
114 | printf_filtered (("\n\032\032exited %d\n"), exitstatus); | |
c906108c SS |
115 | } |
116 | ||
117 | void | |
fba45db2 | 118 | annotate_signalled (void) |
c906108c | 119 | { |
9a4105ab AC |
120 | if (deprecated_annotate_signalled_hook) |
121 | deprecated_annotate_signalled_hook (); | |
c906108c SS |
122 | |
123 | if (annotation_level > 1) | |
a3f17187 | 124 | printf_filtered (("\n\032\032signalled\n")); |
c906108c SS |
125 | } |
126 | ||
127 | void | |
fba45db2 | 128 | annotate_signal_name (void) |
c906108c | 129 | { |
e5c113a1 | 130 | if (annotation_level == 2) |
a3f17187 | 131 | printf_filtered (("\n\032\032signal-name\n")); |
c906108c SS |
132 | } |
133 | ||
134 | void | |
fba45db2 | 135 | annotate_signal_name_end (void) |
c906108c | 136 | { |
e5c113a1 | 137 | if (annotation_level == 2) |
a3f17187 | 138 | printf_filtered (("\n\032\032signal-name-end\n")); |
c906108c SS |
139 | } |
140 | ||
141 | void | |
fba45db2 | 142 | annotate_signal_string (void) |
c906108c | 143 | { |
e5c113a1 | 144 | if (annotation_level == 2) |
a3f17187 | 145 | printf_filtered (("\n\032\032signal-string\n")); |
c906108c SS |
146 | } |
147 | ||
148 | void | |
fba45db2 | 149 | annotate_signal_string_end (void) |
c906108c | 150 | { |
e5c113a1 | 151 | if (annotation_level == 2) |
a3f17187 | 152 | printf_filtered (("\n\032\032signal-string-end\n")); |
c906108c SS |
153 | } |
154 | ||
155 | void | |
fba45db2 | 156 | annotate_signal (void) |
c906108c | 157 | { |
9a4105ab AC |
158 | if (deprecated_annotate_signal_hook) |
159 | deprecated_annotate_signal_hook (); | |
7a292a7a | 160 | |
c906108c | 161 | if (annotation_level > 1) |
a3f17187 | 162 | printf_filtered (("\n\032\032signal\n")); |
c906108c SS |
163 | } |
164 | \f | |
165 | void | |
fba45db2 | 166 | annotate_breakpoints_headers (void) |
c906108c | 167 | { |
e5c113a1 | 168 | if (annotation_level == 2) |
a3f17187 | 169 | printf_filtered (("\n\032\032breakpoints-headers\n")); |
c906108c SS |
170 | } |
171 | ||
172 | void | |
fba45db2 | 173 | annotate_field (int num) |
c906108c | 174 | { |
e5c113a1 | 175 | if (annotation_level == 2) |
a3f17187 | 176 | printf_filtered (("\n\032\032field %d\n"), num); |
c906108c SS |
177 | } |
178 | ||
179 | void | |
fba45db2 | 180 | annotate_breakpoints_table (void) |
c906108c | 181 | { |
e5c113a1 | 182 | if (annotation_level == 2) |
a3f17187 | 183 | printf_filtered (("\n\032\032breakpoints-table\n")); |
c906108c SS |
184 | } |
185 | ||
186 | void | |
fba45db2 | 187 | annotate_record (void) |
c906108c | 188 | { |
e5c113a1 | 189 | if (annotation_level == 2) |
a3f17187 | 190 | printf_filtered (("\n\032\032record\n")); |
c906108c SS |
191 | } |
192 | ||
193 | void | |
fba45db2 | 194 | annotate_breakpoints_table_end (void) |
c906108c | 195 | { |
e5c113a1 | 196 | if (annotation_level == 2) |
a3f17187 | 197 | printf_filtered (("\n\032\032breakpoints-table-end\n")); |
c906108c SS |
198 | } |
199 | ||
200 | void | |
fba45db2 | 201 | annotate_frames_invalid (void) |
c906108c | 202 | { |
bd00c694 PA |
203 | if (annotation_level == 2 |
204 | && (!frames_invalid_emitted | |
3b12939d | 205 | || current_ui->prompt_state != PROMPT_BLOCKED)) |
c906108c | 206 | { |
7c39e397 | 207 | target_terminal::scoped_restore_terminal_state term_state; |
223ffa71 | 208 | target_terminal::ours_for_output (); |
6fdebc3d | 209 | |
a3f17187 | 210 | printf_unfiltered (("\n\032\032frames-invalid\n")); |
bd00c694 | 211 | frames_invalid_emitted = 1; |
c906108c SS |
212 | } |
213 | } | |
214 | ||
d17d4947 NR |
215 | void |
216 | annotate_new_thread (void) | |
217 | { | |
218 | if (annotation_level > 1) | |
219 | { | |
220 | printf_unfiltered (("\n\032\032new-thread\n")); | |
221 | } | |
222 | } | |
223 | ||
b8fa951a NR |
224 | void |
225 | annotate_thread_changed (void) | |
226 | { | |
227 | if (annotation_level > 1) | |
228 | { | |
229 | printf_unfiltered (("\n\032\032thread-changed\n")); | |
230 | } | |
231 | } | |
232 | ||
1a3da2cd AB |
233 | /* Emit notification on thread exit. */ |
234 | ||
235 | static void | |
236 | annotate_thread_exited (struct thread_info *t, int silent) | |
237 | { | |
238 | if (annotation_level > 1) | |
239 | { | |
240 | printf_filtered(("\n\032\032thread-exited," | |
241 | "id=\"%d\",group-id=\"i%d\"\n"), | |
242 | t->global_num, t->inf->num); | |
243 | } | |
244 | } | |
245 | ||
c906108c | 246 | void |
fba45db2 | 247 | annotate_field_begin (struct type *type) |
c906108c | 248 | { |
e5c113a1 | 249 | if (annotation_level == 2) |
c906108c | 250 | { |
a3f17187 | 251 | printf_filtered (("\n\032\032field-begin ")); |
c906108c | 252 | print_value_flags (type); |
a3f17187 | 253 | printf_filtered (("\n")); |
c906108c SS |
254 | } |
255 | } | |
256 | ||
257 | void | |
fba45db2 | 258 | annotate_field_name_end (void) |
c906108c | 259 | { |
e5c113a1 | 260 | if (annotation_level == 2) |
a3f17187 | 261 | printf_filtered (("\n\032\032field-name-end\n")); |
c906108c SS |
262 | } |
263 | ||
264 | void | |
fba45db2 | 265 | annotate_field_value (void) |
c906108c | 266 | { |
e5c113a1 | 267 | if (annotation_level == 2) |
a3f17187 | 268 | printf_filtered (("\n\032\032field-value\n")); |
c906108c SS |
269 | } |
270 | ||
271 | void | |
fba45db2 | 272 | annotate_field_end (void) |
c906108c | 273 | { |
e5c113a1 | 274 | if (annotation_level == 2) |
a3f17187 | 275 | printf_filtered (("\n\032\032field-end\n")); |
c906108c SS |
276 | } |
277 | \f | |
278 | void | |
fba45db2 | 279 | annotate_quit (void) |
c906108c SS |
280 | { |
281 | if (annotation_level > 1) | |
a3f17187 | 282 | printf_filtered (("\n\032\032quit\n")); |
c906108c SS |
283 | } |
284 | ||
285 | void | |
fba45db2 | 286 | annotate_error (void) |
c906108c SS |
287 | { |
288 | if (annotation_level > 1) | |
a3f17187 | 289 | printf_filtered (("\n\032\032error\n")); |
c906108c SS |
290 | } |
291 | ||
292 | void | |
fba45db2 | 293 | annotate_error_begin (void) |
c906108c SS |
294 | { |
295 | if (annotation_level > 1) | |
296 | fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n"); | |
297 | } | |
298 | ||
299 | void | |
fba45db2 | 300 | annotate_value_history_begin (int histindex, struct type *type) |
c906108c | 301 | { |
e5c113a1 | 302 | if (annotation_level == 2) |
c906108c | 303 | { |
a3f17187 | 304 | printf_filtered (("\n\032\032value-history-begin %d "), histindex); |
c906108c | 305 | print_value_flags (type); |
a3f17187 | 306 | printf_filtered (("\n")); |
c906108c SS |
307 | } |
308 | } | |
309 | ||
310 | void | |
fba45db2 | 311 | annotate_value_begin (struct type *type) |
c906108c | 312 | { |
e5c113a1 | 313 | if (annotation_level == 2) |
c906108c | 314 | { |
a3f17187 | 315 | printf_filtered (("\n\032\032value-begin ")); |
c906108c | 316 | print_value_flags (type); |
a3f17187 | 317 | printf_filtered (("\n")); |
c906108c SS |
318 | } |
319 | } | |
320 | ||
321 | void | |
fba45db2 | 322 | annotate_value_history_value (void) |
c906108c | 323 | { |
e5c113a1 | 324 | if (annotation_level == 2) |
a3f17187 | 325 | printf_filtered (("\n\032\032value-history-value\n")); |
c906108c SS |
326 | } |
327 | ||
328 | void | |
fba45db2 | 329 | annotate_value_history_end (void) |
c906108c | 330 | { |
e5c113a1 | 331 | if (annotation_level == 2) |
a3f17187 | 332 | printf_filtered (("\n\032\032value-history-end\n")); |
c906108c SS |
333 | } |
334 | ||
335 | void | |
fba45db2 | 336 | annotate_value_end (void) |
c906108c | 337 | { |
e5c113a1 | 338 | if (annotation_level == 2) |
a3f17187 | 339 | printf_filtered (("\n\032\032value-end\n")); |
c906108c SS |
340 | } |
341 | ||
342 | void | |
fba45db2 | 343 | annotate_display_begin (void) |
c906108c | 344 | { |
e5c113a1 | 345 | if (annotation_level == 2) |
a3f17187 | 346 | printf_filtered (("\n\032\032display-begin\n")); |
c906108c SS |
347 | } |
348 | ||
349 | void | |
fba45db2 | 350 | annotate_display_number_end (void) |
c906108c | 351 | { |
e5c113a1 | 352 | if (annotation_level == 2) |
a3f17187 | 353 | printf_filtered (("\n\032\032display-number-end\n")); |
c906108c SS |
354 | } |
355 | ||
356 | void | |
fba45db2 | 357 | annotate_display_format (void) |
c906108c | 358 | { |
e5c113a1 | 359 | if (annotation_level == 2) |
a3f17187 | 360 | printf_filtered (("\n\032\032display-format\n")); |
c906108c SS |
361 | } |
362 | ||
363 | void | |
fba45db2 | 364 | annotate_display_expression (void) |
c906108c | 365 | { |
e5c113a1 | 366 | if (annotation_level == 2) |
a3f17187 | 367 | printf_filtered (("\n\032\032display-expression\n")); |
c906108c SS |
368 | } |
369 | ||
370 | void | |
fba45db2 | 371 | annotate_display_expression_end (void) |
c906108c | 372 | { |
e5c113a1 | 373 | if (annotation_level == 2) |
a3f17187 | 374 | printf_filtered (("\n\032\032display-expression-end\n")); |
c906108c SS |
375 | } |
376 | ||
377 | void | |
fba45db2 | 378 | annotate_display_value (void) |
c906108c | 379 | { |
e5c113a1 | 380 | if (annotation_level == 2) |
a3f17187 | 381 | printf_filtered (("\n\032\032display-value\n")); |
c906108c SS |
382 | } |
383 | ||
384 | void | |
fba45db2 | 385 | annotate_display_end (void) |
c906108c | 386 | { |
e5c113a1 | 387 | if (annotation_level == 2) |
a3f17187 | 388 | printf_filtered (("\n\032\032display-end\n")); |
c906108c SS |
389 | } |
390 | ||
391 | void | |
fba45db2 | 392 | annotate_arg_begin (void) |
c906108c | 393 | { |
e5c113a1 | 394 | if (annotation_level == 2) |
a3f17187 | 395 | printf_filtered (("\n\032\032arg-begin\n")); |
c906108c SS |
396 | } |
397 | ||
398 | void | |
fba45db2 | 399 | annotate_arg_name_end (void) |
c906108c | 400 | { |
e5c113a1 | 401 | if (annotation_level == 2) |
a3f17187 | 402 | printf_filtered (("\n\032\032arg-name-end\n")); |
c906108c SS |
403 | } |
404 | ||
405 | void | |
fba45db2 | 406 | annotate_arg_value (struct type *type) |
c906108c | 407 | { |
e5c113a1 | 408 | if (annotation_level == 2) |
c906108c | 409 | { |
a3f17187 | 410 | printf_filtered (("\n\032\032arg-value ")); |
c906108c | 411 | print_value_flags (type); |
a3f17187 | 412 | printf_filtered (("\n")); |
c906108c SS |
413 | } |
414 | } | |
415 | ||
416 | void | |
fba45db2 | 417 | annotate_arg_end (void) |
c906108c | 418 | { |
e5c113a1 | 419 | if (annotation_level == 2) |
a3f17187 | 420 | printf_filtered (("\n\032\032arg-end\n")); |
c906108c SS |
421 | } |
422 | ||
0d3abd8c | 423 | static void |
a45575b0 | 424 | annotate_source (const char *filename, int line, int character, int mid, |
5af949e3 | 425 | struct gdbarch *gdbarch, CORE_ADDR pc) |
c906108c SS |
426 | { |
427 | if (annotation_level > 1) | |
a3f17187 | 428 | printf_filtered (("\n\032\032source ")); |
c906108c | 429 | else |
a3f17187 | 430 | printf_filtered (("\032\032")); |
c906108c | 431 | |
50ee7535 | 432 | printf_filtered (("%s:%d:%d:%s:%s\n"), filename, line, character, |
5af949e3 | 433 | mid ? "middle" : "beg", paddress (gdbarch, pc)); |
c906108c SS |
434 | } |
435 | ||
0d3abd8c AB |
436 | /* See annotate.h. */ |
437 | ||
ec8e2b6d | 438 | void |
0d3abd8c AB |
439 | annotate_source_line (struct symtab *s, int line, int mid_statement, |
440 | CORE_ADDR pc) | |
441 | { | |
442 | if (annotation_level > 0) | |
443 | { | |
cb44333d TT |
444 | const std::vector<off_t> *offsets; |
445 | if (!g_source_cache.get_line_charpos (s, &offsets)) | |
ec8e2b6d | 446 | return; |
cb44333d | 447 | |
0d3abd8c | 448 | /* Don't index off the end of the line_charpos array. */ |
cb44333d | 449 | if (line > offsets->size ()) |
ec8e2b6d | 450 | return; |
0d3abd8c | 451 | |
cb44333d | 452 | annotate_source (s->fullname, line, (int) (*offsets)[line - 1], |
0d3abd8c AB |
453 | mid_statement, get_objfile_arch (SYMTAB_OBJFILE (s)), |
454 | pc); | |
0d3abd8c | 455 | } |
0d3abd8c AB |
456 | } |
457 | ||
458 | ||
c906108c | 459 | void |
5af949e3 | 460 | annotate_frame_begin (int level, struct gdbarch *gdbarch, CORE_ADDR pc) |
c906108c | 461 | { |
24ca4723 | 462 | if (annotation_level > 1) |
5af949e3 UW |
463 | printf_filtered (("\n\032\032frame-begin %d %s\n"), |
464 | level, paddress (gdbarch, pc)); | |
c906108c SS |
465 | } |
466 | ||
467 | void | |
fba45db2 | 468 | annotate_function_call (void) |
c906108c | 469 | { |
e5c113a1 | 470 | if (annotation_level == 2) |
a3f17187 | 471 | printf_filtered (("\n\032\032function-call\n")); |
c906108c SS |
472 | } |
473 | ||
474 | void | |
fba45db2 | 475 | annotate_signal_handler_caller (void) |
c906108c | 476 | { |
e5c113a1 | 477 | if (annotation_level == 2) |
a3f17187 | 478 | printf_filtered (("\n\032\032signal-handler-caller\n")); |
c906108c SS |
479 | } |
480 | ||
481 | void | |
fba45db2 | 482 | annotate_frame_address (void) |
c906108c | 483 | { |
e5c113a1 | 484 | if (annotation_level == 2) |
a3f17187 | 485 | printf_filtered (("\n\032\032frame-address\n")); |
c906108c SS |
486 | } |
487 | ||
488 | void | |
fba45db2 | 489 | annotate_frame_address_end (void) |
c906108c | 490 | { |
e5c113a1 | 491 | if (annotation_level == 2) |
a3f17187 | 492 | printf_filtered (("\n\032\032frame-address-end\n")); |
c906108c SS |
493 | } |
494 | ||
495 | void | |
fba45db2 | 496 | annotate_frame_function_name (void) |
c906108c | 497 | { |
e5c113a1 | 498 | if (annotation_level == 2) |
a3f17187 | 499 | printf_filtered (("\n\032\032frame-function-name\n")); |
c906108c SS |
500 | } |
501 | ||
502 | void | |
fba45db2 | 503 | annotate_frame_args (void) |
c906108c | 504 | { |
e5c113a1 | 505 | if (annotation_level == 2) |
a3f17187 | 506 | printf_filtered (("\n\032\032frame-args\n")); |
c906108c SS |
507 | } |
508 | ||
509 | void | |
fba45db2 | 510 | annotate_frame_source_begin (void) |
c906108c | 511 | { |
e5c113a1 | 512 | if (annotation_level == 2) |
a3f17187 | 513 | printf_filtered (("\n\032\032frame-source-begin\n")); |
c906108c SS |
514 | } |
515 | ||
516 | void | |
fba45db2 | 517 | annotate_frame_source_file (void) |
c906108c | 518 | { |
e5c113a1 | 519 | if (annotation_level == 2) |
a3f17187 | 520 | printf_filtered (("\n\032\032frame-source-file\n")); |
c906108c SS |
521 | } |
522 | ||
523 | void | |
fba45db2 | 524 | annotate_frame_source_file_end (void) |
c906108c | 525 | { |
e5c113a1 | 526 | if (annotation_level == 2) |
a3f17187 | 527 | printf_filtered (("\n\032\032frame-source-file-end\n")); |
c906108c SS |
528 | } |
529 | ||
530 | void | |
fba45db2 | 531 | annotate_frame_source_line (void) |
c906108c | 532 | { |
e5c113a1 | 533 | if (annotation_level == 2) |
a3f17187 | 534 | printf_filtered (("\n\032\032frame-source-line\n")); |
c906108c SS |
535 | } |
536 | ||
537 | void | |
fba45db2 | 538 | annotate_frame_source_end (void) |
c906108c | 539 | { |
e5c113a1 | 540 | if (annotation_level == 2) |
a3f17187 | 541 | printf_filtered (("\n\032\032frame-source-end\n")); |
c906108c SS |
542 | } |
543 | ||
544 | void | |
fba45db2 | 545 | annotate_frame_where (void) |
c906108c | 546 | { |
e5c113a1 | 547 | if (annotation_level == 2) |
a3f17187 | 548 | printf_filtered (("\n\032\032frame-where\n")); |
c906108c SS |
549 | } |
550 | ||
551 | void | |
fba45db2 | 552 | annotate_frame_end (void) |
c906108c | 553 | { |
e5c113a1 | 554 | if (annotation_level == 2) |
a3f17187 | 555 | printf_filtered (("\n\032\032frame-end\n")); |
c906108c SS |
556 | } |
557 | \f | |
558 | void | |
917793af | 559 | annotate_array_section_begin (int idx, struct type *elttype) |
c906108c | 560 | { |
e5c113a1 | 561 | if (annotation_level == 2) |
c906108c | 562 | { |
917793af | 563 | printf_filtered (("\n\032\032array-section-begin %d "), idx); |
c906108c | 564 | print_value_flags (elttype); |
a3f17187 | 565 | printf_filtered (("\n")); |
c906108c SS |
566 | } |
567 | } | |
568 | ||
569 | void | |
fba45db2 | 570 | annotate_elt_rep (unsigned int repcount) |
c906108c | 571 | { |
e5c113a1 | 572 | if (annotation_level == 2) |
a3f17187 | 573 | printf_filtered (("\n\032\032elt-rep %u\n"), repcount); |
c906108c SS |
574 | } |
575 | ||
576 | void | |
fba45db2 | 577 | annotate_elt_rep_end (void) |
c906108c | 578 | { |
e5c113a1 | 579 | if (annotation_level == 2) |
a3f17187 | 580 | printf_filtered (("\n\032\032elt-rep-end\n")); |
c906108c SS |
581 | } |
582 | ||
583 | void | |
fba45db2 | 584 | annotate_elt (void) |
c906108c | 585 | { |
e5c113a1 | 586 | if (annotation_level == 2) |
a3f17187 | 587 | printf_filtered (("\n\032\032elt\n")); |
c906108c SS |
588 | } |
589 | ||
590 | void | |
fba45db2 | 591 | annotate_array_section_end (void) |
c906108c | 592 | { |
e5c113a1 | 593 | if (annotation_level == 2) |
a3f17187 | 594 | printf_filtered (("\n\032\032array-section-end\n")); |
c906108c SS |
595 | } |
596 | ||
bd00c694 PA |
597 | /* Called when GDB is about to display the prompt. Used to reset |
598 | annotation suppression whenever we're ready to accept new | |
599 | frontend/user commands. */ | |
600 | ||
601 | void | |
602 | annotate_display_prompt (void) | |
603 | { | |
604 | frames_invalid_emitted = 0; | |
605 | breakpoints_invalid_emitted = 0; | |
606 | } | |
607 | ||
c906108c | 608 | static void |
8d3788bd | 609 | breakpoint_changed (struct breakpoint *b) |
c906108c | 610 | { |
0928e93d PA |
611 | if (b->number <= 0) |
612 | return; | |
613 | ||
9c97429f | 614 | annotate_breakpoints_invalid (); |
c906108c SS |
615 | } |
616 | ||
6c265988 | 617 | void _initialize_annotate (); |
c906108c | 618 | void |
6c265988 | 619 | _initialize_annotate () |
c906108c | 620 | { |
76727919 TT |
621 | gdb::observers::breakpoint_created.attach (breakpoint_changed); |
622 | gdb::observers::breakpoint_deleted.attach (breakpoint_changed); | |
623 | gdb::observers::breakpoint_modified.attach (breakpoint_changed); | |
1a3da2cd | 624 | gdb::observers::thread_exit.attach (annotate_thread_exited); |
c906108c | 625 | } |