1 /* This file is automatically generated. DO NOT EDIT! */ 2 /* Generated from: NetBSD: mknative-gdb,v 1.7 2016/10/16 04:37:42 mrg Exp */ 3 /* Generated from: NetBSD: mknative.common,v 1.15 2017/11/29 03:32:28 christos Exp */ 4 5 /* GDB Notifications to Observers. 6 7 Copyright (C) 2004-2017 Free Software Foundation, Inc. 8 9 This file is part of GDB. 10 11 This program is free software; you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation; either version 3 of the License, or 14 (at your option) any later version. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program. If not, see <http://www.gnu.org/licenses/>. 23 24 -- 25 26 This file was generated using observer.sh and observer.texi. */ 27 28 29 /* normal_stop notifications. */ 30 31 static struct observer_list *normal_stop_subject = NULL; 32 33 struct normal_stop_args { struct bpstats *bs; int print_frame; }; 34 35 static void 36 observer_normal_stop_notification_stub (const void *data, const void *args_data) 37 { 38 observer_normal_stop_ftype *notify = (observer_normal_stop_ftype *) data; 39 const struct normal_stop_args *args = (const struct normal_stop_args *) args_data; 40 notify (args->bs, args->print_frame); 41 } 42 43 struct observer * 44 observer_attach_normal_stop (observer_normal_stop_ftype *f) 45 { 46 return generic_observer_attach (&normal_stop_subject, 47 &observer_normal_stop_notification_stub, 48 (void *) f); 49 } 50 51 void 52 observer_detach_normal_stop (struct observer *observer) 53 { 54 generic_observer_detach (&normal_stop_subject, observer); 55 } 56 57 void 58 observer_notify_normal_stop (struct bpstats *bs, int print_frame) 59 { 60 struct normal_stop_args args; 61 args.bs = bs, args.print_frame = print_frame; 62 63 if (observer_debug) 64 fprintf_unfiltered (gdb_stdlog, "observer_notify_normal_stop() called\n"); 65 generic_observer_notify (normal_stop_subject, &args); 66 } 67 68 /* signal_received notifications. */ 69 70 static struct observer_list *signal_received_subject = NULL; 71 72 struct signal_received_args { enum gdb_signal siggnal; }; 73 74 static void 75 observer_signal_received_notification_stub (const void *data, const void *args_data) 76 { 77 observer_signal_received_ftype *notify = (observer_signal_received_ftype *) data; 78 const struct signal_received_args *args = (const struct signal_received_args *) args_data; 79 notify (args->siggnal); 80 } 81 82 struct observer * 83 observer_attach_signal_received (observer_signal_received_ftype *f) 84 { 85 return generic_observer_attach (&signal_received_subject, 86 &observer_signal_received_notification_stub, 87 (void *) f); 88 } 89 90 void 91 observer_detach_signal_received (struct observer *observer) 92 { 93 generic_observer_detach (&signal_received_subject, observer); 94 } 95 96 void 97 observer_notify_signal_received (enum gdb_signal siggnal) 98 { 99 struct signal_received_args args; 100 args.siggnal = siggnal; 101 102 if (observer_debug) 103 fprintf_unfiltered (gdb_stdlog, "observer_notify_signal_received() called\n"); 104 generic_observer_notify (signal_received_subject, &args); 105 } 106 107 /* end_stepping_range notifications. */ 108 109 static struct observer_list *end_stepping_range_subject = NULL; 110 111 static void 112 observer_end_stepping_range_notification_stub (const void *data, const void *args_data) 113 { 114 observer_end_stepping_range_ftype *notify = (observer_end_stepping_range_ftype *) data; 115 notify (); 116 } 117 118 struct observer * 119 observer_attach_end_stepping_range (observer_end_stepping_range_ftype *f) 120 { 121 return generic_observer_attach (&end_stepping_range_subject, 122 &observer_end_stepping_range_notification_stub, 123 (void *) f); 124 } 125 126 void 127 observer_detach_end_stepping_range (struct observer *observer) 128 { 129 generic_observer_detach (&end_stepping_range_subject, observer); 130 } 131 132 void 133 observer_notify_end_stepping_range (void) 134 { 135 char *args = NULL; 136 if (observer_debug) 137 fprintf_unfiltered (gdb_stdlog, "observer_notify_end_stepping_range() called\n"); 138 generic_observer_notify (end_stepping_range_subject, &args); 139 } 140 141 /* signal_exited notifications. */ 142 143 static struct observer_list *signal_exited_subject = NULL; 144 145 struct signal_exited_args { enum gdb_signal siggnal; }; 146 147 static void 148 observer_signal_exited_notification_stub (const void *data, const void *args_data) 149 { 150 observer_signal_exited_ftype *notify = (observer_signal_exited_ftype *) data; 151 const struct signal_exited_args *args = (const struct signal_exited_args *) args_data; 152 notify (args->siggnal); 153 } 154 155 struct observer * 156 observer_attach_signal_exited (observer_signal_exited_ftype *f) 157 { 158 return generic_observer_attach (&signal_exited_subject, 159 &observer_signal_exited_notification_stub, 160 (void *) f); 161 } 162 163 void 164 observer_detach_signal_exited (struct observer *observer) 165 { 166 generic_observer_detach (&signal_exited_subject, observer); 167 } 168 169 void 170 observer_notify_signal_exited (enum gdb_signal siggnal) 171 { 172 struct signal_exited_args args; 173 args.siggnal = siggnal; 174 175 if (observer_debug) 176 fprintf_unfiltered (gdb_stdlog, "observer_notify_signal_exited() called\n"); 177 generic_observer_notify (signal_exited_subject, &args); 178 } 179 180 /* exited notifications. */ 181 182 static struct observer_list *exited_subject = NULL; 183 184 struct exited_args { int exitstatus; }; 185 186 static void 187 observer_exited_notification_stub (const void *data, const void *args_data) 188 { 189 observer_exited_ftype *notify = (observer_exited_ftype *) data; 190 const struct exited_args *args = (const struct exited_args *) args_data; 191 notify (args->exitstatus); 192 } 193 194 struct observer * 195 observer_attach_exited (observer_exited_ftype *f) 196 { 197 return generic_observer_attach (&exited_subject, 198 &observer_exited_notification_stub, 199 (void *) f); 200 } 201 202 void 203 observer_detach_exited (struct observer *observer) 204 { 205 generic_observer_detach (&exited_subject, observer); 206 } 207 208 void 209 observer_notify_exited (int exitstatus) 210 { 211 struct exited_args args; 212 args.exitstatus = exitstatus; 213 214 if (observer_debug) 215 fprintf_unfiltered (gdb_stdlog, "observer_notify_exited() called\n"); 216 generic_observer_notify (exited_subject, &args); 217 } 218 219 /* no_history notifications. */ 220 221 static struct observer_list *no_history_subject = NULL; 222 223 static void 224 observer_no_history_notification_stub (const void *data, const void *args_data) 225 { 226 observer_no_history_ftype *notify = (observer_no_history_ftype *) data; 227 notify (); 228 } 229 230 struct observer * 231 observer_attach_no_history (observer_no_history_ftype *f) 232 { 233 return generic_observer_attach (&no_history_subject, 234 &observer_no_history_notification_stub, 235 (void *) f); 236 } 237 238 void 239 observer_detach_no_history (struct observer *observer) 240 { 241 generic_observer_detach (&no_history_subject, observer); 242 } 243 244 void 245 observer_notify_no_history (void) 246 { 247 char *args = NULL; 248 if (observer_debug) 249 fprintf_unfiltered (gdb_stdlog, "observer_notify_no_history() called\n"); 250 generic_observer_notify (no_history_subject, &args); 251 } 252 253 /* sync_execution_done notifications. */ 254 255 static struct observer_list *sync_execution_done_subject = NULL; 256 257 static void 258 observer_sync_execution_done_notification_stub (const void *data, const void *args_data) 259 { 260 observer_sync_execution_done_ftype *notify = (observer_sync_execution_done_ftype *) data; 261 notify (); 262 } 263 264 struct observer * 265 observer_attach_sync_execution_done (observer_sync_execution_done_ftype *f) 266 { 267 return generic_observer_attach (&sync_execution_done_subject, 268 &observer_sync_execution_done_notification_stub, 269 (void *) f); 270 } 271 272 void 273 observer_detach_sync_execution_done (struct observer *observer) 274 { 275 generic_observer_detach (&sync_execution_done_subject, observer); 276 } 277 278 void 279 observer_notify_sync_execution_done (void) 280 { 281 char *args = NULL; 282 if (observer_debug) 283 fprintf_unfiltered (gdb_stdlog, "observer_notify_sync_execution_done() called\n"); 284 generic_observer_notify (sync_execution_done_subject, &args); 285 } 286 287 /* command_error notifications. */ 288 289 static struct observer_list *command_error_subject = NULL; 290 291 static void 292 observer_command_error_notification_stub (const void *data, const void *args_data) 293 { 294 observer_command_error_ftype *notify = (observer_command_error_ftype *) data; 295 notify (); 296 } 297 298 struct observer * 299 observer_attach_command_error (observer_command_error_ftype *f) 300 { 301 return generic_observer_attach (&command_error_subject, 302 &observer_command_error_notification_stub, 303 (void *) f); 304 } 305 306 void 307 observer_detach_command_error (struct observer *observer) 308 { 309 generic_observer_detach (&command_error_subject, observer); 310 } 311 312 void 313 observer_notify_command_error (void) 314 { 315 char *args = NULL; 316 if (observer_debug) 317 fprintf_unfiltered (gdb_stdlog, "observer_notify_command_error() called\n"); 318 generic_observer_notify (command_error_subject, &args); 319 } 320 321 /* target_changed notifications. */ 322 323 static struct observer_list *target_changed_subject = NULL; 324 325 struct target_changed_args { struct target_ops *target; }; 326 327 static void 328 observer_target_changed_notification_stub (const void *data, const void *args_data) 329 { 330 observer_target_changed_ftype *notify = (observer_target_changed_ftype *) data; 331 const struct target_changed_args *args = (const struct target_changed_args *) args_data; 332 notify (args->target); 333 } 334 335 struct observer * 336 observer_attach_target_changed (observer_target_changed_ftype *f) 337 { 338 return generic_observer_attach (&target_changed_subject, 339 &observer_target_changed_notification_stub, 340 (void *) f); 341 } 342 343 void 344 observer_detach_target_changed (struct observer *observer) 345 { 346 generic_observer_detach (&target_changed_subject, observer); 347 } 348 349 void 350 observer_notify_target_changed (struct target_ops *target) 351 { 352 struct target_changed_args args; 353 args.target = target; 354 355 if (observer_debug) 356 fprintf_unfiltered (gdb_stdlog, "observer_notify_target_changed() called\n"); 357 generic_observer_notify (target_changed_subject, &args); 358 } 359 360 /* executable_changed notifications. */ 361 362 static struct observer_list *executable_changed_subject = NULL; 363 364 static void 365 observer_executable_changed_notification_stub (const void *data, const void *args_data) 366 { 367 observer_executable_changed_ftype *notify = (observer_executable_changed_ftype *) data; 368 notify (); 369 } 370 371 struct observer * 372 observer_attach_executable_changed (observer_executable_changed_ftype *f) 373 { 374 return generic_observer_attach (&executable_changed_subject, 375 &observer_executable_changed_notification_stub, 376 (void *) f); 377 } 378 379 void 380 observer_detach_executable_changed (struct observer *observer) 381 { 382 generic_observer_detach (&executable_changed_subject, observer); 383 } 384 385 void 386 observer_notify_executable_changed (void) 387 { 388 char *args = NULL; 389 if (observer_debug) 390 fprintf_unfiltered (gdb_stdlog, "observer_notify_executable_changed() called\n"); 391 generic_observer_notify (executable_changed_subject, &args); 392 } 393 394 /* inferior_created notifications. */ 395 396 static struct observer_list *inferior_created_subject = NULL; 397 398 struct inferior_created_args { struct target_ops *objfile; int from_tty; }; 399 400 static void 401 observer_inferior_created_notification_stub (const void *data, const void *args_data) 402 { 403 observer_inferior_created_ftype *notify = (observer_inferior_created_ftype *) data; 404 const struct inferior_created_args *args = (const struct inferior_created_args *) args_data; 405 notify (args->objfile, args->from_tty); 406 } 407 408 struct observer * 409 observer_attach_inferior_created (observer_inferior_created_ftype *f) 410 { 411 return generic_observer_attach (&inferior_created_subject, 412 &observer_inferior_created_notification_stub, 413 (void *) f); 414 } 415 416 void 417 observer_detach_inferior_created (struct observer *observer) 418 { 419 generic_observer_detach (&inferior_created_subject, observer); 420 } 421 422 void 423 observer_notify_inferior_created (struct target_ops *objfile, int from_tty) 424 { 425 struct inferior_created_args args; 426 args.objfile = objfile, args.from_tty = from_tty; 427 428 if (observer_debug) 429 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_created() called\n"); 430 generic_observer_notify (inferior_created_subject, &args); 431 } 432 433 /* record_changed notifications. */ 434 435 static struct observer_list *record_changed_subject = NULL; 436 437 struct record_changed_args { struct inferior *inferior; int started; const char *method; const char *format; }; 438 439 static void 440 observer_record_changed_notification_stub (const void *data, const void *args_data) 441 { 442 observer_record_changed_ftype *notify = (observer_record_changed_ftype *) data; 443 const struct record_changed_args *args = (const struct record_changed_args *) args_data; 444 notify (args->inferior, args->started, args->method, args->format); 445 } 446 447 struct observer * 448 observer_attach_record_changed (observer_record_changed_ftype *f) 449 { 450 return generic_observer_attach (&record_changed_subject, 451 &observer_record_changed_notification_stub, 452 (void *) f); 453 } 454 455 void 456 observer_detach_record_changed (struct observer *observer) 457 { 458 generic_observer_detach (&record_changed_subject, observer); 459 } 460 461 void 462 observer_notify_record_changed (struct inferior *inferior, int started, const char *method, const char *format) 463 { 464 struct record_changed_args args; 465 args.inferior = inferior, args.started = started, args.method = method, args.format = format; 466 467 if (observer_debug) 468 fprintf_unfiltered (gdb_stdlog, "observer_notify_record_changed() called\n"); 469 generic_observer_notify (record_changed_subject, &args); 470 } 471 472 /* solib_loaded notifications. */ 473 474 static struct observer_list *solib_loaded_subject = NULL; 475 476 struct solib_loaded_args { struct so_list *solib; }; 477 478 static void 479 observer_solib_loaded_notification_stub (const void *data, const void *args_data) 480 { 481 observer_solib_loaded_ftype *notify = (observer_solib_loaded_ftype *) data; 482 const struct solib_loaded_args *args = (const struct solib_loaded_args *) args_data; 483 notify (args->solib); 484 } 485 486 struct observer * 487 observer_attach_solib_loaded (observer_solib_loaded_ftype *f) 488 { 489 return generic_observer_attach (&solib_loaded_subject, 490 &observer_solib_loaded_notification_stub, 491 (void *) f); 492 } 493 494 void 495 observer_detach_solib_loaded (struct observer *observer) 496 { 497 generic_observer_detach (&solib_loaded_subject, observer); 498 } 499 500 void 501 observer_notify_solib_loaded (struct so_list *solib) 502 { 503 struct solib_loaded_args args; 504 args.solib = solib; 505 506 if (observer_debug) 507 fprintf_unfiltered (gdb_stdlog, "observer_notify_solib_loaded() called\n"); 508 generic_observer_notify (solib_loaded_subject, &args); 509 } 510 511 /* solib_unloaded notifications. */ 512 513 static struct observer_list *solib_unloaded_subject = NULL; 514 515 struct solib_unloaded_args { struct so_list *solib; }; 516 517 static void 518 observer_solib_unloaded_notification_stub (const void *data, const void *args_data) 519 { 520 observer_solib_unloaded_ftype *notify = (observer_solib_unloaded_ftype *) data; 521 const struct solib_unloaded_args *args = (const struct solib_unloaded_args *) args_data; 522 notify (args->solib); 523 } 524 525 struct observer * 526 observer_attach_solib_unloaded (observer_solib_unloaded_ftype *f) 527 { 528 return generic_observer_attach (&solib_unloaded_subject, 529 &observer_solib_unloaded_notification_stub, 530 (void *) f); 531 } 532 533 void 534 observer_detach_solib_unloaded (struct observer *observer) 535 { 536 generic_observer_detach (&solib_unloaded_subject, observer); 537 } 538 539 void 540 observer_notify_solib_unloaded (struct so_list *solib) 541 { 542 struct solib_unloaded_args args; 543 args.solib = solib; 544 545 if (observer_debug) 546 fprintf_unfiltered (gdb_stdlog, "observer_notify_solib_unloaded() called\n"); 547 generic_observer_notify (solib_unloaded_subject, &args); 548 } 549 550 /* new_objfile notifications. */ 551 552 static struct observer_list *new_objfile_subject = NULL; 553 554 struct new_objfile_args { struct objfile *objfile; }; 555 556 static void 557 observer_new_objfile_notification_stub (const void *data, const void *args_data) 558 { 559 observer_new_objfile_ftype *notify = (observer_new_objfile_ftype *) data; 560 const struct new_objfile_args *args = (const struct new_objfile_args *) args_data; 561 notify (args->objfile); 562 } 563 564 struct observer * 565 observer_attach_new_objfile (observer_new_objfile_ftype *f) 566 { 567 return generic_observer_attach (&new_objfile_subject, 568 &observer_new_objfile_notification_stub, 569 (void *) f); 570 } 571 572 void 573 observer_detach_new_objfile (struct observer *observer) 574 { 575 generic_observer_detach (&new_objfile_subject, observer); 576 } 577 578 void 579 observer_notify_new_objfile (struct objfile *objfile) 580 { 581 struct new_objfile_args args; 582 args.objfile = objfile; 583 584 if (observer_debug) 585 fprintf_unfiltered (gdb_stdlog, "observer_notify_new_objfile() called\n"); 586 generic_observer_notify (new_objfile_subject, &args); 587 } 588 589 /* free_objfile notifications. */ 590 591 static struct observer_list *free_objfile_subject = NULL; 592 593 struct free_objfile_args { struct objfile *objfile; }; 594 595 static void 596 observer_free_objfile_notification_stub (const void *data, const void *args_data) 597 { 598 observer_free_objfile_ftype *notify = (observer_free_objfile_ftype *) data; 599 const struct free_objfile_args *args = (const struct free_objfile_args *) args_data; 600 notify (args->objfile); 601 } 602 603 struct observer * 604 observer_attach_free_objfile (observer_free_objfile_ftype *f) 605 { 606 return generic_observer_attach (&free_objfile_subject, 607 &observer_free_objfile_notification_stub, 608 (void *) f); 609 } 610 611 void 612 observer_detach_free_objfile (struct observer *observer) 613 { 614 generic_observer_detach (&free_objfile_subject, observer); 615 } 616 617 void 618 observer_notify_free_objfile (struct objfile *objfile) 619 { 620 struct free_objfile_args args; 621 args.objfile = objfile; 622 623 if (observer_debug) 624 fprintf_unfiltered (gdb_stdlog, "observer_notify_free_objfile() called\n"); 625 generic_observer_notify (free_objfile_subject, &args); 626 } 627 628 /* new_thread notifications. */ 629 630 static struct observer_list *new_thread_subject = NULL; 631 632 struct new_thread_args { struct thread_info *t; }; 633 634 static void 635 observer_new_thread_notification_stub (const void *data, const void *args_data) 636 { 637 observer_new_thread_ftype *notify = (observer_new_thread_ftype *) data; 638 const struct new_thread_args *args = (const struct new_thread_args *) args_data; 639 notify (args->t); 640 } 641 642 struct observer * 643 observer_attach_new_thread (observer_new_thread_ftype *f) 644 { 645 return generic_observer_attach (&new_thread_subject, 646 &observer_new_thread_notification_stub, 647 (void *) f); 648 } 649 650 void 651 observer_detach_new_thread (struct observer *observer) 652 { 653 generic_observer_detach (&new_thread_subject, observer); 654 } 655 656 void 657 observer_notify_new_thread (struct thread_info *t) 658 { 659 struct new_thread_args args; 660 args.t = t; 661 662 if (observer_debug) 663 fprintf_unfiltered (gdb_stdlog, "observer_notify_new_thread() called\n"); 664 generic_observer_notify (new_thread_subject, &args); 665 } 666 667 /* thread_exit notifications. */ 668 669 static struct observer_list *thread_exit_subject = NULL; 670 671 struct thread_exit_args { struct thread_info *t; int silent; }; 672 673 static void 674 observer_thread_exit_notification_stub (const void *data, const void *args_data) 675 { 676 observer_thread_exit_ftype *notify = (observer_thread_exit_ftype *) data; 677 const struct thread_exit_args *args = (const struct thread_exit_args *) args_data; 678 notify (args->t, args->silent); 679 } 680 681 struct observer * 682 observer_attach_thread_exit (observer_thread_exit_ftype *f) 683 { 684 return generic_observer_attach (&thread_exit_subject, 685 &observer_thread_exit_notification_stub, 686 (void *) f); 687 } 688 689 void 690 observer_detach_thread_exit (struct observer *observer) 691 { 692 generic_observer_detach (&thread_exit_subject, observer); 693 } 694 695 void 696 observer_notify_thread_exit (struct thread_info *t, int silent) 697 { 698 struct thread_exit_args args; 699 args.t = t, args.silent = silent; 700 701 if (observer_debug) 702 fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_exit() called\n"); 703 generic_observer_notify (thread_exit_subject, &args); 704 } 705 706 /* thread_stop_requested notifications. */ 707 708 static struct observer_list *thread_stop_requested_subject = NULL; 709 710 struct thread_stop_requested_args { ptid_t ptid; }; 711 712 static void 713 observer_thread_stop_requested_notification_stub (const void *data, const void *args_data) 714 { 715 observer_thread_stop_requested_ftype *notify = (observer_thread_stop_requested_ftype *) data; 716 const struct thread_stop_requested_args *args = (const struct thread_stop_requested_args *) args_data; 717 notify (args->ptid); 718 } 719 720 struct observer * 721 observer_attach_thread_stop_requested (observer_thread_stop_requested_ftype *f) 722 { 723 return generic_observer_attach (&thread_stop_requested_subject, 724 &observer_thread_stop_requested_notification_stub, 725 (void *) f); 726 } 727 728 void 729 observer_detach_thread_stop_requested (struct observer *observer) 730 { 731 generic_observer_detach (&thread_stop_requested_subject, observer); 732 } 733 734 void 735 observer_notify_thread_stop_requested (ptid_t ptid) 736 { 737 struct thread_stop_requested_args args; 738 args.ptid = ptid; 739 740 if (observer_debug) 741 fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_stop_requested() called\n"); 742 generic_observer_notify (thread_stop_requested_subject, &args); 743 } 744 745 /* target_resumed notifications. */ 746 747 static struct observer_list *target_resumed_subject = NULL; 748 749 struct target_resumed_args { ptid_t ptid; }; 750 751 static void 752 observer_target_resumed_notification_stub (const void *data, const void *args_data) 753 { 754 observer_target_resumed_ftype *notify = (observer_target_resumed_ftype *) data; 755 const struct target_resumed_args *args = (const struct target_resumed_args *) args_data; 756 notify (args->ptid); 757 } 758 759 struct observer * 760 observer_attach_target_resumed (observer_target_resumed_ftype *f) 761 { 762 return generic_observer_attach (&target_resumed_subject, 763 &observer_target_resumed_notification_stub, 764 (void *) f); 765 } 766 767 void 768 observer_detach_target_resumed (struct observer *observer) 769 { 770 generic_observer_detach (&target_resumed_subject, observer); 771 } 772 773 void 774 observer_notify_target_resumed (ptid_t ptid) 775 { 776 struct target_resumed_args args; 777 args.ptid = ptid; 778 779 if (observer_debug) 780 fprintf_unfiltered (gdb_stdlog, "observer_notify_target_resumed() called\n"); 781 generic_observer_notify (target_resumed_subject, &args); 782 } 783 784 /* about_to_proceed notifications. */ 785 786 static struct observer_list *about_to_proceed_subject = NULL; 787 788 static void 789 observer_about_to_proceed_notification_stub (const void *data, const void *args_data) 790 { 791 observer_about_to_proceed_ftype *notify = (observer_about_to_proceed_ftype *) data; 792 notify (); 793 } 794 795 struct observer * 796 observer_attach_about_to_proceed (observer_about_to_proceed_ftype *f) 797 { 798 return generic_observer_attach (&about_to_proceed_subject, 799 &observer_about_to_proceed_notification_stub, 800 (void *) f); 801 } 802 803 void 804 observer_detach_about_to_proceed (struct observer *observer) 805 { 806 generic_observer_detach (&about_to_proceed_subject, observer); 807 } 808 809 void 810 observer_notify_about_to_proceed (void) 811 { 812 char *args = NULL; 813 if (observer_debug) 814 fprintf_unfiltered (gdb_stdlog, "observer_notify_about_to_proceed() called\n"); 815 generic_observer_notify (about_to_proceed_subject, &args); 816 } 817 818 /* breakpoint_created notifications. */ 819 820 static struct observer_list *breakpoint_created_subject = NULL; 821 822 struct breakpoint_created_args { struct breakpoint *b; }; 823 824 static void 825 observer_breakpoint_created_notification_stub (const void *data, const void *args_data) 826 { 827 observer_breakpoint_created_ftype *notify = (observer_breakpoint_created_ftype *) data; 828 const struct breakpoint_created_args *args = (const struct breakpoint_created_args *) args_data; 829 notify (args->b); 830 } 831 832 struct observer * 833 observer_attach_breakpoint_created (observer_breakpoint_created_ftype *f) 834 { 835 return generic_observer_attach (&breakpoint_created_subject, 836 &observer_breakpoint_created_notification_stub, 837 (void *) f); 838 } 839 840 void 841 observer_detach_breakpoint_created (struct observer *observer) 842 { 843 generic_observer_detach (&breakpoint_created_subject, observer); 844 } 845 846 void 847 observer_notify_breakpoint_created (struct breakpoint *b) 848 { 849 struct breakpoint_created_args args; 850 args.b = b; 851 852 if (observer_debug) 853 fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_created() called\n"); 854 generic_observer_notify (breakpoint_created_subject, &args); 855 } 856 857 /* breakpoint_deleted notifications. */ 858 859 static struct observer_list *breakpoint_deleted_subject = NULL; 860 861 struct breakpoint_deleted_args { struct breakpoint *b; }; 862 863 static void 864 observer_breakpoint_deleted_notification_stub (const void *data, const void *args_data) 865 { 866 observer_breakpoint_deleted_ftype *notify = (observer_breakpoint_deleted_ftype *) data; 867 const struct breakpoint_deleted_args *args = (const struct breakpoint_deleted_args *) args_data; 868 notify (args->b); 869 } 870 871 struct observer * 872 observer_attach_breakpoint_deleted (observer_breakpoint_deleted_ftype *f) 873 { 874 return generic_observer_attach (&breakpoint_deleted_subject, 875 &observer_breakpoint_deleted_notification_stub, 876 (void *) f); 877 } 878 879 void 880 observer_detach_breakpoint_deleted (struct observer *observer) 881 { 882 generic_observer_detach (&breakpoint_deleted_subject, observer); 883 } 884 885 void 886 observer_notify_breakpoint_deleted (struct breakpoint *b) 887 { 888 struct breakpoint_deleted_args args; 889 args.b = b; 890 891 if (observer_debug) 892 fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_deleted() called\n"); 893 generic_observer_notify (breakpoint_deleted_subject, &args); 894 } 895 896 /* breakpoint_modified notifications. */ 897 898 static struct observer_list *breakpoint_modified_subject = NULL; 899 900 struct breakpoint_modified_args { struct breakpoint *b; }; 901 902 static void 903 observer_breakpoint_modified_notification_stub (const void *data, const void *args_data) 904 { 905 observer_breakpoint_modified_ftype *notify = (observer_breakpoint_modified_ftype *) data; 906 const struct breakpoint_modified_args *args = (const struct breakpoint_modified_args *) args_data; 907 notify (args->b); 908 } 909 910 struct observer * 911 observer_attach_breakpoint_modified (observer_breakpoint_modified_ftype *f) 912 { 913 return generic_observer_attach (&breakpoint_modified_subject, 914 &observer_breakpoint_modified_notification_stub, 915 (void *) f); 916 } 917 918 void 919 observer_detach_breakpoint_modified (struct observer *observer) 920 { 921 generic_observer_detach (&breakpoint_modified_subject, observer); 922 } 923 924 void 925 observer_notify_breakpoint_modified (struct breakpoint *b) 926 { 927 struct breakpoint_modified_args args; 928 args.b = b; 929 930 if (observer_debug) 931 fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_modified() called\n"); 932 generic_observer_notify (breakpoint_modified_subject, &args); 933 } 934 935 /* traceframe_changed notifications. */ 936 937 static struct observer_list *traceframe_changed_subject = NULL; 938 939 struct traceframe_changed_args { int tfnum; int tpnum; }; 940 941 static void 942 observer_traceframe_changed_notification_stub (const void *data, const void *args_data) 943 { 944 observer_traceframe_changed_ftype *notify = (observer_traceframe_changed_ftype *) data; 945 const struct traceframe_changed_args *args = (const struct traceframe_changed_args *) args_data; 946 notify (args->tfnum, args->tpnum); 947 } 948 949 struct observer * 950 observer_attach_traceframe_changed (observer_traceframe_changed_ftype *f) 951 { 952 return generic_observer_attach (&traceframe_changed_subject, 953 &observer_traceframe_changed_notification_stub, 954 (void *) f); 955 } 956 957 void 958 observer_detach_traceframe_changed (struct observer *observer) 959 { 960 generic_observer_detach (&traceframe_changed_subject, observer); 961 } 962 963 void 964 observer_notify_traceframe_changed (int tfnum, int tpnum) 965 { 966 struct traceframe_changed_args args; 967 args.tfnum = tfnum, args.tpnum = tpnum; 968 969 if (observer_debug) 970 fprintf_unfiltered (gdb_stdlog, "observer_notify_traceframe_changed() called\n"); 971 generic_observer_notify (traceframe_changed_subject, &args); 972 } 973 974 /* architecture_changed notifications. */ 975 976 static struct observer_list *architecture_changed_subject = NULL; 977 978 struct architecture_changed_args { struct gdbarch *newarch; }; 979 980 static void 981 observer_architecture_changed_notification_stub (const void *data, const void *args_data) 982 { 983 observer_architecture_changed_ftype *notify = (observer_architecture_changed_ftype *) data; 984 const struct architecture_changed_args *args = (const struct architecture_changed_args *) args_data; 985 notify (args->newarch); 986 } 987 988 struct observer * 989 observer_attach_architecture_changed (observer_architecture_changed_ftype *f) 990 { 991 return generic_observer_attach (&architecture_changed_subject, 992 &observer_architecture_changed_notification_stub, 993 (void *) f); 994 } 995 996 void 997 observer_detach_architecture_changed (struct observer *observer) 998 { 999 generic_observer_detach (&architecture_changed_subject, observer); 1000 } 1001 1002 void 1003 observer_notify_architecture_changed (struct gdbarch *newarch) 1004 { 1005 struct architecture_changed_args args; 1006 args.newarch = newarch; 1007 1008 if (observer_debug) 1009 fprintf_unfiltered (gdb_stdlog, "observer_notify_architecture_changed() called\n"); 1010 generic_observer_notify (architecture_changed_subject, &args); 1011 } 1012 1013 /* thread_ptid_changed notifications. */ 1014 1015 static struct observer_list *thread_ptid_changed_subject = NULL; 1016 1017 struct thread_ptid_changed_args { ptid_t old_ptid; ptid_t new_ptid; }; 1018 1019 static void 1020 observer_thread_ptid_changed_notification_stub (const void *data, const void *args_data) 1021 { 1022 observer_thread_ptid_changed_ftype *notify = (observer_thread_ptid_changed_ftype *) data; 1023 const struct thread_ptid_changed_args *args = (const struct thread_ptid_changed_args *) args_data; 1024 notify (args->old_ptid, args->new_ptid); 1025 } 1026 1027 struct observer * 1028 observer_attach_thread_ptid_changed (observer_thread_ptid_changed_ftype *f) 1029 { 1030 return generic_observer_attach (&thread_ptid_changed_subject, 1031 &observer_thread_ptid_changed_notification_stub, 1032 (void *) f); 1033 } 1034 1035 void 1036 observer_detach_thread_ptid_changed (struct observer *observer) 1037 { 1038 generic_observer_detach (&thread_ptid_changed_subject, observer); 1039 } 1040 1041 void 1042 observer_notify_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid) 1043 { 1044 struct thread_ptid_changed_args args; 1045 args.old_ptid = old_ptid, args.new_ptid = new_ptid; 1046 1047 if (observer_debug) 1048 fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_ptid_changed() called\n"); 1049 generic_observer_notify (thread_ptid_changed_subject, &args); 1050 } 1051 1052 /* inferior_added notifications. */ 1053 1054 static struct observer_list *inferior_added_subject = NULL; 1055 1056 struct inferior_added_args { struct inferior *inf; }; 1057 1058 static void 1059 observer_inferior_added_notification_stub (const void *data, const void *args_data) 1060 { 1061 observer_inferior_added_ftype *notify = (observer_inferior_added_ftype *) data; 1062 const struct inferior_added_args *args = (const struct inferior_added_args *) args_data; 1063 notify (args->inf); 1064 } 1065 1066 struct observer * 1067 observer_attach_inferior_added (observer_inferior_added_ftype *f) 1068 { 1069 return generic_observer_attach (&inferior_added_subject, 1070 &observer_inferior_added_notification_stub, 1071 (void *) f); 1072 } 1073 1074 void 1075 observer_detach_inferior_added (struct observer *observer) 1076 { 1077 generic_observer_detach (&inferior_added_subject, observer); 1078 } 1079 1080 void 1081 observer_notify_inferior_added (struct inferior *inf) 1082 { 1083 struct inferior_added_args args; 1084 args.inf = inf; 1085 1086 if (observer_debug) 1087 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_added() called\n"); 1088 generic_observer_notify (inferior_added_subject, &args); 1089 } 1090 1091 /* inferior_appeared notifications. */ 1092 1093 static struct observer_list *inferior_appeared_subject = NULL; 1094 1095 struct inferior_appeared_args { struct inferior *inf; }; 1096 1097 static void 1098 observer_inferior_appeared_notification_stub (const void *data, const void *args_data) 1099 { 1100 observer_inferior_appeared_ftype *notify = (observer_inferior_appeared_ftype *) data; 1101 const struct inferior_appeared_args *args = (const struct inferior_appeared_args *) args_data; 1102 notify (args->inf); 1103 } 1104 1105 struct observer * 1106 observer_attach_inferior_appeared (observer_inferior_appeared_ftype *f) 1107 { 1108 return generic_observer_attach (&inferior_appeared_subject, 1109 &observer_inferior_appeared_notification_stub, 1110 (void *) f); 1111 } 1112 1113 void 1114 observer_detach_inferior_appeared (struct observer *observer) 1115 { 1116 generic_observer_detach (&inferior_appeared_subject, observer); 1117 } 1118 1119 void 1120 observer_notify_inferior_appeared (struct inferior *inf) 1121 { 1122 struct inferior_appeared_args args; 1123 args.inf = inf; 1124 1125 if (observer_debug) 1126 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_appeared() called\n"); 1127 generic_observer_notify (inferior_appeared_subject, &args); 1128 } 1129 1130 /* inferior_exit notifications. */ 1131 1132 static struct observer_list *inferior_exit_subject = NULL; 1133 1134 struct inferior_exit_args { struct inferior *inf; }; 1135 1136 static void 1137 observer_inferior_exit_notification_stub (const void *data, const void *args_data) 1138 { 1139 observer_inferior_exit_ftype *notify = (observer_inferior_exit_ftype *) data; 1140 const struct inferior_exit_args *args = (const struct inferior_exit_args *) args_data; 1141 notify (args->inf); 1142 } 1143 1144 struct observer * 1145 observer_attach_inferior_exit (observer_inferior_exit_ftype *f) 1146 { 1147 return generic_observer_attach (&inferior_exit_subject, 1148 &observer_inferior_exit_notification_stub, 1149 (void *) f); 1150 } 1151 1152 void 1153 observer_detach_inferior_exit (struct observer *observer) 1154 { 1155 generic_observer_detach (&inferior_exit_subject, observer); 1156 } 1157 1158 void 1159 observer_notify_inferior_exit (struct inferior *inf) 1160 { 1161 struct inferior_exit_args args; 1162 args.inf = inf; 1163 1164 if (observer_debug) 1165 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_exit() called\n"); 1166 generic_observer_notify (inferior_exit_subject, &args); 1167 } 1168 1169 /* inferior_removed notifications. */ 1170 1171 static struct observer_list *inferior_removed_subject = NULL; 1172 1173 struct inferior_removed_args { struct inferior *inf; }; 1174 1175 static void 1176 observer_inferior_removed_notification_stub (const void *data, const void *args_data) 1177 { 1178 observer_inferior_removed_ftype *notify = (observer_inferior_removed_ftype *) data; 1179 const struct inferior_removed_args *args = (const struct inferior_removed_args *) args_data; 1180 notify (args->inf); 1181 } 1182 1183 struct observer * 1184 observer_attach_inferior_removed (observer_inferior_removed_ftype *f) 1185 { 1186 return generic_observer_attach (&inferior_removed_subject, 1187 &observer_inferior_removed_notification_stub, 1188 (void *) f); 1189 } 1190 1191 void 1192 observer_detach_inferior_removed (struct observer *observer) 1193 { 1194 generic_observer_detach (&inferior_removed_subject, observer); 1195 } 1196 1197 void 1198 observer_notify_inferior_removed (struct inferior *inf) 1199 { 1200 struct inferior_removed_args args; 1201 args.inf = inf; 1202 1203 if (observer_debug) 1204 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_removed() called\n"); 1205 generic_observer_notify (inferior_removed_subject, &args); 1206 } 1207 1208 /* memory_changed notifications. */ 1209 1210 static struct observer_list *memory_changed_subject = NULL; 1211 1212 struct memory_changed_args { struct inferior *inferior; CORE_ADDR addr; ssize_t len; const bfd_byte *data; }; 1213 1214 static void 1215 observer_memory_changed_notification_stub (const void *data, const void *args_data) 1216 { 1217 observer_memory_changed_ftype *notify = (observer_memory_changed_ftype *) data; 1218 const struct memory_changed_args *args = (const struct memory_changed_args *) args_data; 1219 notify (args->inferior, args->addr, args->len, args->data); 1220 } 1221 1222 struct observer * 1223 observer_attach_memory_changed (observer_memory_changed_ftype *f) 1224 { 1225 return generic_observer_attach (&memory_changed_subject, 1226 &observer_memory_changed_notification_stub, 1227 (void *) f); 1228 } 1229 1230 void 1231 observer_detach_memory_changed (struct observer *observer) 1232 { 1233 generic_observer_detach (&memory_changed_subject, observer); 1234 } 1235 1236 void 1237 observer_notify_memory_changed (struct inferior *inferior, CORE_ADDR addr, ssize_t len, const bfd_byte *data) 1238 { 1239 struct memory_changed_args args; 1240 args.inferior = inferior, args.addr = addr, args.len = len, args.data = data; 1241 1242 if (observer_debug) 1243 fprintf_unfiltered (gdb_stdlog, "observer_notify_memory_changed() called\n"); 1244 generic_observer_notify (memory_changed_subject, &args); 1245 } 1246 1247 /* before_prompt notifications. */ 1248 1249 static struct observer_list *before_prompt_subject = NULL; 1250 1251 struct before_prompt_args { const char *current_prompt; }; 1252 1253 static void 1254 observer_before_prompt_notification_stub (const void *data, const void *args_data) 1255 { 1256 observer_before_prompt_ftype *notify = (observer_before_prompt_ftype *) data; 1257 const struct before_prompt_args *args = (const struct before_prompt_args *) args_data; 1258 notify (args->current_prompt); 1259 } 1260 1261 struct observer * 1262 observer_attach_before_prompt (observer_before_prompt_ftype *f) 1263 { 1264 return generic_observer_attach (&before_prompt_subject, 1265 &observer_before_prompt_notification_stub, 1266 (void *) f); 1267 } 1268 1269 void 1270 observer_detach_before_prompt (struct observer *observer) 1271 { 1272 generic_observer_detach (&before_prompt_subject, observer); 1273 } 1274 1275 void 1276 observer_notify_before_prompt (const char *current_prompt) 1277 { 1278 struct before_prompt_args args; 1279 args.current_prompt = current_prompt; 1280 1281 if (observer_debug) 1282 fprintf_unfiltered (gdb_stdlog, "observer_notify_before_prompt() called\n"); 1283 generic_observer_notify (before_prompt_subject, &args); 1284 } 1285 1286 /* gdb_datadir_changed notifications. */ 1287 1288 static struct observer_list *gdb_datadir_changed_subject = NULL; 1289 1290 static void 1291 observer_gdb_datadir_changed_notification_stub (const void *data, const void *args_data) 1292 { 1293 observer_gdb_datadir_changed_ftype *notify = (observer_gdb_datadir_changed_ftype *) data; 1294 notify (); 1295 } 1296 1297 struct observer * 1298 observer_attach_gdb_datadir_changed (observer_gdb_datadir_changed_ftype *f) 1299 { 1300 return generic_observer_attach (&gdb_datadir_changed_subject, 1301 &observer_gdb_datadir_changed_notification_stub, 1302 (void *) f); 1303 } 1304 1305 void 1306 observer_detach_gdb_datadir_changed (struct observer *observer) 1307 { 1308 generic_observer_detach (&gdb_datadir_changed_subject, observer); 1309 } 1310 1311 void 1312 observer_notify_gdb_datadir_changed (void) 1313 { 1314 char *args = NULL; 1315 if (observer_debug) 1316 fprintf_unfiltered (gdb_stdlog, "observer_notify_gdb_datadir_changed() called\n"); 1317 generic_observer_notify (gdb_datadir_changed_subject, &args); 1318 } 1319 1320 /* command_param_changed notifications. */ 1321 1322 static struct observer_list *command_param_changed_subject = NULL; 1323 1324 struct command_param_changed_args { const char *param; const char *value; }; 1325 1326 static void 1327 observer_command_param_changed_notification_stub (const void *data, const void *args_data) 1328 { 1329 observer_command_param_changed_ftype *notify = (observer_command_param_changed_ftype *) data; 1330 const struct command_param_changed_args *args = (const struct command_param_changed_args *) args_data; 1331 notify (args->param, args->value); 1332 } 1333 1334 struct observer * 1335 observer_attach_command_param_changed (observer_command_param_changed_ftype *f) 1336 { 1337 return generic_observer_attach (&command_param_changed_subject, 1338 &observer_command_param_changed_notification_stub, 1339 (void *) f); 1340 } 1341 1342 void 1343 observer_detach_command_param_changed (struct observer *observer) 1344 { 1345 generic_observer_detach (&command_param_changed_subject, observer); 1346 } 1347 1348 void 1349 observer_notify_command_param_changed (const char *param, const char *value) 1350 { 1351 struct command_param_changed_args args; 1352 args.param = param, args.value = value; 1353 1354 if (observer_debug) 1355 fprintf_unfiltered (gdb_stdlog, "observer_notify_command_param_changed() called\n"); 1356 generic_observer_notify (command_param_changed_subject, &args); 1357 } 1358 1359 /* tsv_created notifications. */ 1360 1361 static struct observer_list *tsv_created_subject = NULL; 1362 1363 struct tsv_created_args { const struct trace_state_variable *tsv; }; 1364 1365 static void 1366 observer_tsv_created_notification_stub (const void *data, const void *args_data) 1367 { 1368 observer_tsv_created_ftype *notify = (observer_tsv_created_ftype *) data; 1369 const struct tsv_created_args *args = (const struct tsv_created_args *) args_data; 1370 notify (args->tsv); 1371 } 1372 1373 struct observer * 1374 observer_attach_tsv_created (observer_tsv_created_ftype *f) 1375 { 1376 return generic_observer_attach (&tsv_created_subject, 1377 &observer_tsv_created_notification_stub, 1378 (void *) f); 1379 } 1380 1381 void 1382 observer_detach_tsv_created (struct observer *observer) 1383 { 1384 generic_observer_detach (&tsv_created_subject, observer); 1385 } 1386 1387 void 1388 observer_notify_tsv_created (const struct trace_state_variable *tsv) 1389 { 1390 struct tsv_created_args args; 1391 args.tsv = tsv; 1392 1393 if (observer_debug) 1394 fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_created() called\n"); 1395 generic_observer_notify (tsv_created_subject, &args); 1396 } 1397 1398 /* tsv_deleted notifications. */ 1399 1400 static struct observer_list *tsv_deleted_subject = NULL; 1401 1402 struct tsv_deleted_args { const struct trace_state_variable *tsv; }; 1403 1404 static void 1405 observer_tsv_deleted_notification_stub (const void *data, const void *args_data) 1406 { 1407 observer_tsv_deleted_ftype *notify = (observer_tsv_deleted_ftype *) data; 1408 const struct tsv_deleted_args *args = (const struct tsv_deleted_args *) args_data; 1409 notify (args->tsv); 1410 } 1411 1412 struct observer * 1413 observer_attach_tsv_deleted (observer_tsv_deleted_ftype *f) 1414 { 1415 return generic_observer_attach (&tsv_deleted_subject, 1416 &observer_tsv_deleted_notification_stub, 1417 (void *) f); 1418 } 1419 1420 void 1421 observer_detach_tsv_deleted (struct observer *observer) 1422 { 1423 generic_observer_detach (&tsv_deleted_subject, observer); 1424 } 1425 1426 void 1427 observer_notify_tsv_deleted (const struct trace_state_variable *tsv) 1428 { 1429 struct tsv_deleted_args args; 1430 args.tsv = tsv; 1431 1432 if (observer_debug) 1433 fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_deleted() called\n"); 1434 generic_observer_notify (tsv_deleted_subject, &args); 1435 } 1436 1437 /* tsv_modified notifications. */ 1438 1439 static struct observer_list *tsv_modified_subject = NULL; 1440 1441 struct tsv_modified_args { const struct trace_state_variable *tsv; }; 1442 1443 static void 1444 observer_tsv_modified_notification_stub (const void *data, const void *args_data) 1445 { 1446 observer_tsv_modified_ftype *notify = (observer_tsv_modified_ftype *) data; 1447 const struct tsv_modified_args *args = (const struct tsv_modified_args *) args_data; 1448 notify (args->tsv); 1449 } 1450 1451 struct observer * 1452 observer_attach_tsv_modified (observer_tsv_modified_ftype *f) 1453 { 1454 return generic_observer_attach (&tsv_modified_subject, 1455 &observer_tsv_modified_notification_stub, 1456 (void *) f); 1457 } 1458 1459 void 1460 observer_detach_tsv_modified (struct observer *observer) 1461 { 1462 generic_observer_detach (&tsv_modified_subject, observer); 1463 } 1464 1465 void 1466 observer_notify_tsv_modified (const struct trace_state_variable *tsv) 1467 { 1468 struct tsv_modified_args args; 1469 args.tsv = tsv; 1470 1471 if (observer_debug) 1472 fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_modified() called\n"); 1473 generic_observer_notify (tsv_modified_subject, &args); 1474 } 1475 1476 /* inferior_call_pre notifications. */ 1477 1478 static struct observer_list *inferior_call_pre_subject = NULL; 1479 1480 struct inferior_call_pre_args { ptid_t thread; CORE_ADDR address; }; 1481 1482 static void 1483 observer_inferior_call_pre_notification_stub (const void *data, const void *args_data) 1484 { 1485 observer_inferior_call_pre_ftype *notify = (observer_inferior_call_pre_ftype *) data; 1486 const struct inferior_call_pre_args *args = (const struct inferior_call_pre_args *) args_data; 1487 notify (args->thread, args->address); 1488 } 1489 1490 struct observer * 1491 observer_attach_inferior_call_pre (observer_inferior_call_pre_ftype *f) 1492 { 1493 return generic_observer_attach (&inferior_call_pre_subject, 1494 &observer_inferior_call_pre_notification_stub, 1495 (void *) f); 1496 } 1497 1498 void 1499 observer_detach_inferior_call_pre (struct observer *observer) 1500 { 1501 generic_observer_detach (&inferior_call_pre_subject, observer); 1502 } 1503 1504 void 1505 observer_notify_inferior_call_pre (ptid_t thread, CORE_ADDR address) 1506 { 1507 struct inferior_call_pre_args args; 1508 args.thread = thread, args.address = address; 1509 1510 if (observer_debug) 1511 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_call_pre() called\n"); 1512 generic_observer_notify (inferior_call_pre_subject, &args); 1513 } 1514 1515 /* inferior_call_post notifications. */ 1516 1517 static struct observer_list *inferior_call_post_subject = NULL; 1518 1519 struct inferior_call_post_args { ptid_t thread; CORE_ADDR address; }; 1520 1521 static void 1522 observer_inferior_call_post_notification_stub (const void *data, const void *args_data) 1523 { 1524 observer_inferior_call_post_ftype *notify = (observer_inferior_call_post_ftype *) data; 1525 const struct inferior_call_post_args *args = (const struct inferior_call_post_args *) args_data; 1526 notify (args->thread, args->address); 1527 } 1528 1529 struct observer * 1530 observer_attach_inferior_call_post (observer_inferior_call_post_ftype *f) 1531 { 1532 return generic_observer_attach (&inferior_call_post_subject, 1533 &observer_inferior_call_post_notification_stub, 1534 (void *) f); 1535 } 1536 1537 void 1538 observer_detach_inferior_call_post (struct observer *observer) 1539 { 1540 generic_observer_detach (&inferior_call_post_subject, observer); 1541 } 1542 1543 void 1544 observer_notify_inferior_call_post (ptid_t thread, CORE_ADDR address) 1545 { 1546 struct inferior_call_post_args args; 1547 args.thread = thread, args.address = address; 1548 1549 if (observer_debug) 1550 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_call_post() called\n"); 1551 generic_observer_notify (inferior_call_post_subject, &args); 1552 } 1553 1554 /* register_changed notifications. */ 1555 1556 static struct observer_list *register_changed_subject = NULL; 1557 1558 struct register_changed_args { struct frame_info *frame; int regnum; }; 1559 1560 static void 1561 observer_register_changed_notification_stub (const void *data, const void *args_data) 1562 { 1563 observer_register_changed_ftype *notify = (observer_register_changed_ftype *) data; 1564 const struct register_changed_args *args = (const struct register_changed_args *) args_data; 1565 notify (args->frame, args->regnum); 1566 } 1567 1568 struct observer * 1569 observer_attach_register_changed (observer_register_changed_ftype *f) 1570 { 1571 return generic_observer_attach (®ister_changed_subject, 1572 &observer_register_changed_notification_stub, 1573 (void *) f); 1574 } 1575 1576 void 1577 observer_detach_register_changed (struct observer *observer) 1578 { 1579 generic_observer_detach (®ister_changed_subject, observer); 1580 } 1581 1582 void 1583 observer_notify_register_changed (struct frame_info *frame, int regnum) 1584 { 1585 struct register_changed_args args; 1586 args.frame = frame, args.regnum = regnum; 1587 1588 if (observer_debug) 1589 fprintf_unfiltered (gdb_stdlog, "observer_notify_register_changed() called\n"); 1590 generic_observer_notify (register_changed_subject, &args); 1591 } 1592 1593 /* test_notification notifications. */ 1594 1595 static struct observer_list *test_notification_subject = NULL; 1596 1597 struct test_notification_args { int somearg; }; 1598 1599 static void 1600 observer_test_notification_notification_stub (const void *data, const void *args_data) 1601 { 1602 observer_test_notification_ftype *notify = (observer_test_notification_ftype *) data; 1603 const struct test_notification_args *args = (const struct test_notification_args *) args_data; 1604 notify (args->somearg); 1605 } 1606 1607 struct observer * 1608 observer_attach_test_notification (observer_test_notification_ftype *f) 1609 { 1610 return generic_observer_attach (&test_notification_subject, 1611 &observer_test_notification_notification_stub, 1612 (void *) f); 1613 } 1614 1615 void 1616 observer_detach_test_notification (struct observer *observer) 1617 { 1618 generic_observer_detach (&test_notification_subject, observer); 1619 } 1620 1621 void 1622 observer_notify_test_notification (int somearg) 1623 { 1624 struct test_notification_args args; 1625 args.somearg = somearg; 1626 1627 if (observer_debug) 1628 fprintf_unfiltered (gdb_stdlog, "observer_notify_test_notification() called\n"); 1629 generic_observer_notify (test_notification_subject, &args); 1630 } 1631 1632 /* user_selected_context_changed notifications. */ 1633 1634 static struct observer_list *user_selected_context_changed_subject = NULL; 1635 1636 struct user_selected_context_changed_args { user_selected_what selection; }; 1637 1638 static void 1639 observer_user_selected_context_changed_notification_stub (const void *data, const void *args_data) 1640 { 1641 observer_user_selected_context_changed_ftype *notify = (observer_user_selected_context_changed_ftype *) data; 1642 const struct user_selected_context_changed_args *args = (const struct user_selected_context_changed_args *) args_data; 1643 notify (args->selection); 1644 } 1645 1646 struct observer * 1647 observer_attach_user_selected_context_changed (observer_user_selected_context_changed_ftype *f) 1648 { 1649 return generic_observer_attach (&user_selected_context_changed_subject, 1650 &observer_user_selected_context_changed_notification_stub, 1651 (void *) f); 1652 } 1653 1654 void 1655 observer_detach_user_selected_context_changed (struct observer *observer) 1656 { 1657 generic_observer_detach (&user_selected_context_changed_subject, observer); 1658 } 1659 1660 void 1661 observer_notify_user_selected_context_changed (user_selected_what selection) 1662 { 1663 struct user_selected_context_changed_args args; 1664 args.selection = selection; 1665 1666 if (observer_debug) 1667 fprintf_unfiltered (gdb_stdlog, "observer_notify_user_selected_context_changed() called\n"); 1668 generic_observer_notify (user_selected_context_changed_subject, &args); 1669 } 1670