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