GDB (API)
|
00001 /* GDB Notifications to Observers. 00002 00003 Copyright (C) 2004-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 00020 -- 00021 00022 This file was generated using observer.sh and observer.texi. */ 00023 00024 00025 /* normal_stop notifications. */ 00026 00027 static struct observer_list *normal_stop_subject = NULL; 00028 00029 struct normal_stop_args { struct bpstats *bs; int print_frame; }; 00030 00031 static void 00032 observer_normal_stop_notification_stub (const void *data, const void *args_data) 00033 { 00034 observer_normal_stop_ftype *notify = (observer_normal_stop_ftype *) data; 00035 const struct normal_stop_args *args = args_data; 00036 notify (args->bs, args->print_frame); 00037 } 00038 00039 struct observer * 00040 observer_attach_normal_stop (observer_normal_stop_ftype *f) 00041 { 00042 return generic_observer_attach (&normal_stop_subject, 00043 &observer_normal_stop_notification_stub, 00044 (void *) f); 00045 } 00046 00047 void 00048 observer_detach_normal_stop (struct observer *observer) 00049 { 00050 generic_observer_detach (&normal_stop_subject, observer); 00051 } 00052 00053 void 00054 observer_notify_normal_stop (struct bpstats *bs, int print_frame) 00055 { 00056 struct normal_stop_args args; 00057 args.bs = bs, args.print_frame = print_frame; 00058 00059 if (observer_debug) 00060 fprintf_unfiltered (gdb_stdlog, "observer_notify_normal_stop() called\n"); 00061 generic_observer_notify (normal_stop_subject, &args); 00062 } 00063 00064 /* target_changed notifications. */ 00065 00066 static struct observer_list *target_changed_subject = NULL; 00067 00068 struct target_changed_args { struct target_ops *target; }; 00069 00070 static void 00071 observer_target_changed_notification_stub (const void *data, const void *args_data) 00072 { 00073 observer_target_changed_ftype *notify = (observer_target_changed_ftype *) data; 00074 const struct target_changed_args *args = args_data; 00075 notify (args->target); 00076 } 00077 00078 struct observer * 00079 observer_attach_target_changed (observer_target_changed_ftype *f) 00080 { 00081 return generic_observer_attach (&target_changed_subject, 00082 &observer_target_changed_notification_stub, 00083 (void *) f); 00084 } 00085 00086 void 00087 observer_detach_target_changed (struct observer *observer) 00088 { 00089 generic_observer_detach (&target_changed_subject, observer); 00090 } 00091 00092 void 00093 observer_notify_target_changed (struct target_ops *target) 00094 { 00095 struct target_changed_args args; 00096 args.target = target; 00097 00098 if (observer_debug) 00099 fprintf_unfiltered (gdb_stdlog, "observer_notify_target_changed() called\n"); 00100 generic_observer_notify (target_changed_subject, &args); 00101 } 00102 00103 /* executable_changed notifications. */ 00104 00105 static struct observer_list *executable_changed_subject = NULL; 00106 00107 static void 00108 observer_executable_changed_notification_stub (const void *data, const void *args_data) 00109 { 00110 observer_executable_changed_ftype *notify = (observer_executable_changed_ftype *) data; 00111 notify (); 00112 } 00113 00114 struct observer * 00115 observer_attach_executable_changed (observer_executable_changed_ftype *f) 00116 { 00117 return generic_observer_attach (&executable_changed_subject, 00118 &observer_executable_changed_notification_stub, 00119 (void *) f); 00120 } 00121 00122 void 00123 observer_detach_executable_changed (struct observer *observer) 00124 { 00125 generic_observer_detach (&executable_changed_subject, observer); 00126 } 00127 00128 void 00129 observer_notify_executable_changed (void) 00130 { 00131 char *args = NULL; 00132 if (observer_debug) 00133 fprintf_unfiltered (gdb_stdlog, "observer_notify_executable_changed() called\n"); 00134 generic_observer_notify (executable_changed_subject, &args); 00135 } 00136 00137 /* inferior_created notifications. */ 00138 00139 static struct observer_list *inferior_created_subject = NULL; 00140 00141 struct inferior_created_args { struct target_ops *objfile; int from_tty; }; 00142 00143 static void 00144 observer_inferior_created_notification_stub (const void *data, const void *args_data) 00145 { 00146 observer_inferior_created_ftype *notify = (observer_inferior_created_ftype *) data; 00147 const struct inferior_created_args *args = args_data; 00148 notify (args->objfile, args->from_tty); 00149 } 00150 00151 struct observer * 00152 observer_attach_inferior_created (observer_inferior_created_ftype *f) 00153 { 00154 return generic_observer_attach (&inferior_created_subject, 00155 &observer_inferior_created_notification_stub, 00156 (void *) f); 00157 } 00158 00159 void 00160 observer_detach_inferior_created (struct observer *observer) 00161 { 00162 generic_observer_detach (&inferior_created_subject, observer); 00163 } 00164 00165 void 00166 observer_notify_inferior_created (struct target_ops *objfile, int from_tty) 00167 { 00168 struct inferior_created_args args; 00169 args.objfile = objfile, args.from_tty = from_tty; 00170 00171 if (observer_debug) 00172 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_created() called\n"); 00173 generic_observer_notify (inferior_created_subject, &args); 00174 } 00175 00176 /* record_changed notifications. */ 00177 00178 static struct observer_list *record_changed_subject = NULL; 00179 00180 struct record_changed_args { struct inferior *inferior; int started; }; 00181 00182 static void 00183 observer_record_changed_notification_stub (const void *data, const void *args_data) 00184 { 00185 observer_record_changed_ftype *notify = (observer_record_changed_ftype *) data; 00186 const struct record_changed_args *args = args_data; 00187 notify (args->inferior, args->started); 00188 } 00189 00190 struct observer * 00191 observer_attach_record_changed (observer_record_changed_ftype *f) 00192 { 00193 return generic_observer_attach (&record_changed_subject, 00194 &observer_record_changed_notification_stub, 00195 (void *) f); 00196 } 00197 00198 void 00199 observer_detach_record_changed (struct observer *observer) 00200 { 00201 generic_observer_detach (&record_changed_subject, observer); 00202 } 00203 00204 void 00205 observer_notify_record_changed (struct inferior *inferior, int started) 00206 { 00207 struct record_changed_args args; 00208 args.inferior = inferior, args.started = started; 00209 00210 if (observer_debug) 00211 fprintf_unfiltered (gdb_stdlog, "observer_notify_record_changed() called\n"); 00212 generic_observer_notify (record_changed_subject, &args); 00213 } 00214 00215 /* solib_loaded notifications. */ 00216 00217 static struct observer_list *solib_loaded_subject = NULL; 00218 00219 struct solib_loaded_args { struct so_list *solib; }; 00220 00221 static void 00222 observer_solib_loaded_notification_stub (const void *data, const void *args_data) 00223 { 00224 observer_solib_loaded_ftype *notify = (observer_solib_loaded_ftype *) data; 00225 const struct solib_loaded_args *args = args_data; 00226 notify (args->solib); 00227 } 00228 00229 struct observer * 00230 observer_attach_solib_loaded (observer_solib_loaded_ftype *f) 00231 { 00232 return generic_observer_attach (&solib_loaded_subject, 00233 &observer_solib_loaded_notification_stub, 00234 (void *) f); 00235 } 00236 00237 void 00238 observer_detach_solib_loaded (struct observer *observer) 00239 { 00240 generic_observer_detach (&solib_loaded_subject, observer); 00241 } 00242 00243 void 00244 observer_notify_solib_loaded (struct so_list *solib) 00245 { 00246 struct solib_loaded_args args; 00247 args.solib = solib; 00248 00249 if (observer_debug) 00250 fprintf_unfiltered (gdb_stdlog, "observer_notify_solib_loaded() called\n"); 00251 generic_observer_notify (solib_loaded_subject, &args); 00252 } 00253 00254 /* solib_unloaded notifications. */ 00255 00256 static struct observer_list *solib_unloaded_subject = NULL; 00257 00258 struct solib_unloaded_args { struct so_list *solib; }; 00259 00260 static void 00261 observer_solib_unloaded_notification_stub (const void *data, const void *args_data) 00262 { 00263 observer_solib_unloaded_ftype *notify = (observer_solib_unloaded_ftype *) data; 00264 const struct solib_unloaded_args *args = args_data; 00265 notify (args->solib); 00266 } 00267 00268 struct observer * 00269 observer_attach_solib_unloaded (observer_solib_unloaded_ftype *f) 00270 { 00271 return generic_observer_attach (&solib_unloaded_subject, 00272 &observer_solib_unloaded_notification_stub, 00273 (void *) f); 00274 } 00275 00276 void 00277 observer_detach_solib_unloaded (struct observer *observer) 00278 { 00279 generic_observer_detach (&solib_unloaded_subject, observer); 00280 } 00281 00282 void 00283 observer_notify_solib_unloaded (struct so_list *solib) 00284 { 00285 struct solib_unloaded_args args; 00286 args.solib = solib; 00287 00288 if (observer_debug) 00289 fprintf_unfiltered (gdb_stdlog, "observer_notify_solib_unloaded() called\n"); 00290 generic_observer_notify (solib_unloaded_subject, &args); 00291 } 00292 00293 /* new_objfile notifications. */ 00294 00295 static struct observer_list *new_objfile_subject = NULL; 00296 00297 struct new_objfile_args { struct objfile *objfile; }; 00298 00299 static void 00300 observer_new_objfile_notification_stub (const void *data, const void *args_data) 00301 { 00302 observer_new_objfile_ftype *notify = (observer_new_objfile_ftype *) data; 00303 const struct new_objfile_args *args = args_data; 00304 notify (args->objfile); 00305 } 00306 00307 struct observer * 00308 observer_attach_new_objfile (observer_new_objfile_ftype *f) 00309 { 00310 return generic_observer_attach (&new_objfile_subject, 00311 &observer_new_objfile_notification_stub, 00312 (void *) f); 00313 } 00314 00315 void 00316 observer_detach_new_objfile (struct observer *observer) 00317 { 00318 generic_observer_detach (&new_objfile_subject, observer); 00319 } 00320 00321 void 00322 observer_notify_new_objfile (struct objfile *objfile) 00323 { 00324 struct new_objfile_args args; 00325 args.objfile = objfile; 00326 00327 if (observer_debug) 00328 fprintf_unfiltered (gdb_stdlog, "observer_notify_new_objfile() called\n"); 00329 generic_observer_notify (new_objfile_subject, &args); 00330 } 00331 00332 /* new_thread notifications. */ 00333 00334 static struct observer_list *new_thread_subject = NULL; 00335 00336 struct new_thread_args { struct thread_info *t; }; 00337 00338 static void 00339 observer_new_thread_notification_stub (const void *data, const void *args_data) 00340 { 00341 observer_new_thread_ftype *notify = (observer_new_thread_ftype *) data; 00342 const struct new_thread_args *args = args_data; 00343 notify (args->t); 00344 } 00345 00346 struct observer * 00347 observer_attach_new_thread (observer_new_thread_ftype *f) 00348 { 00349 return generic_observer_attach (&new_thread_subject, 00350 &observer_new_thread_notification_stub, 00351 (void *) f); 00352 } 00353 00354 void 00355 observer_detach_new_thread (struct observer *observer) 00356 { 00357 generic_observer_detach (&new_thread_subject, observer); 00358 } 00359 00360 void 00361 observer_notify_new_thread (struct thread_info *t) 00362 { 00363 struct new_thread_args args; 00364 args.t = t; 00365 00366 if (observer_debug) 00367 fprintf_unfiltered (gdb_stdlog, "observer_notify_new_thread() called\n"); 00368 generic_observer_notify (new_thread_subject, &args); 00369 } 00370 00371 /* thread_exit notifications. */ 00372 00373 static struct observer_list *thread_exit_subject = NULL; 00374 00375 struct thread_exit_args { struct thread_info *t; int silent; }; 00376 00377 static void 00378 observer_thread_exit_notification_stub (const void *data, const void *args_data) 00379 { 00380 observer_thread_exit_ftype *notify = (observer_thread_exit_ftype *) data; 00381 const struct thread_exit_args *args = args_data; 00382 notify (args->t, args->silent); 00383 } 00384 00385 struct observer * 00386 observer_attach_thread_exit (observer_thread_exit_ftype *f) 00387 { 00388 return generic_observer_attach (&thread_exit_subject, 00389 &observer_thread_exit_notification_stub, 00390 (void *) f); 00391 } 00392 00393 void 00394 observer_detach_thread_exit (struct observer *observer) 00395 { 00396 generic_observer_detach (&thread_exit_subject, observer); 00397 } 00398 00399 void 00400 observer_notify_thread_exit (struct thread_info *t, int silent) 00401 { 00402 struct thread_exit_args args; 00403 args.t = t, args.silent = silent; 00404 00405 if (observer_debug) 00406 fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_exit() called\n"); 00407 generic_observer_notify (thread_exit_subject, &args); 00408 } 00409 00410 /* thread_stop_requested notifications. */ 00411 00412 static struct observer_list *thread_stop_requested_subject = NULL; 00413 00414 struct thread_stop_requested_args { ptid_t ptid; }; 00415 00416 static void 00417 observer_thread_stop_requested_notification_stub (const void *data, const void *args_data) 00418 { 00419 observer_thread_stop_requested_ftype *notify = (observer_thread_stop_requested_ftype *) data; 00420 const struct thread_stop_requested_args *args = args_data; 00421 notify (args->ptid); 00422 } 00423 00424 struct observer * 00425 observer_attach_thread_stop_requested (observer_thread_stop_requested_ftype *f) 00426 { 00427 return generic_observer_attach (&thread_stop_requested_subject, 00428 &observer_thread_stop_requested_notification_stub, 00429 (void *) f); 00430 } 00431 00432 void 00433 observer_detach_thread_stop_requested (struct observer *observer) 00434 { 00435 generic_observer_detach (&thread_stop_requested_subject, observer); 00436 } 00437 00438 void 00439 observer_notify_thread_stop_requested (ptid_t ptid) 00440 { 00441 struct thread_stop_requested_args args; 00442 args.ptid = ptid; 00443 00444 if (observer_debug) 00445 fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_stop_requested() called\n"); 00446 generic_observer_notify (thread_stop_requested_subject, &args); 00447 } 00448 00449 /* target_resumed notifications. */ 00450 00451 static struct observer_list *target_resumed_subject = NULL; 00452 00453 struct target_resumed_args { ptid_t ptid; }; 00454 00455 static void 00456 observer_target_resumed_notification_stub (const void *data, const void *args_data) 00457 { 00458 observer_target_resumed_ftype *notify = (observer_target_resumed_ftype *) data; 00459 const struct target_resumed_args *args = args_data; 00460 notify (args->ptid); 00461 } 00462 00463 struct observer * 00464 observer_attach_target_resumed (observer_target_resumed_ftype *f) 00465 { 00466 return generic_observer_attach (&target_resumed_subject, 00467 &observer_target_resumed_notification_stub, 00468 (void *) f); 00469 } 00470 00471 void 00472 observer_detach_target_resumed (struct observer *observer) 00473 { 00474 generic_observer_detach (&target_resumed_subject, observer); 00475 } 00476 00477 void 00478 observer_notify_target_resumed (ptid_t ptid) 00479 { 00480 struct target_resumed_args args; 00481 args.ptid = ptid; 00482 00483 if (observer_debug) 00484 fprintf_unfiltered (gdb_stdlog, "observer_notify_target_resumed() called\n"); 00485 generic_observer_notify (target_resumed_subject, &args); 00486 } 00487 00488 /* about_to_proceed notifications. */ 00489 00490 static struct observer_list *about_to_proceed_subject = NULL; 00491 00492 static void 00493 observer_about_to_proceed_notification_stub (const void *data, const void *args_data) 00494 { 00495 observer_about_to_proceed_ftype *notify = (observer_about_to_proceed_ftype *) data; 00496 notify (); 00497 } 00498 00499 struct observer * 00500 observer_attach_about_to_proceed (observer_about_to_proceed_ftype *f) 00501 { 00502 return generic_observer_attach (&about_to_proceed_subject, 00503 &observer_about_to_proceed_notification_stub, 00504 (void *) f); 00505 } 00506 00507 void 00508 observer_detach_about_to_proceed (struct observer *observer) 00509 { 00510 generic_observer_detach (&about_to_proceed_subject, observer); 00511 } 00512 00513 void 00514 observer_notify_about_to_proceed (void) 00515 { 00516 char *args = NULL; 00517 if (observer_debug) 00518 fprintf_unfiltered (gdb_stdlog, "observer_notify_about_to_proceed() called\n"); 00519 generic_observer_notify (about_to_proceed_subject, &args); 00520 } 00521 00522 /* breakpoint_created notifications. */ 00523 00524 static struct observer_list *breakpoint_created_subject = NULL; 00525 00526 struct breakpoint_created_args { struct breakpoint *b; }; 00527 00528 static void 00529 observer_breakpoint_created_notification_stub (const void *data, const void *args_data) 00530 { 00531 observer_breakpoint_created_ftype *notify = (observer_breakpoint_created_ftype *) data; 00532 const struct breakpoint_created_args *args = args_data; 00533 notify (args->b); 00534 } 00535 00536 struct observer * 00537 observer_attach_breakpoint_created (observer_breakpoint_created_ftype *f) 00538 { 00539 return generic_observer_attach (&breakpoint_created_subject, 00540 &observer_breakpoint_created_notification_stub, 00541 (void *) f); 00542 } 00543 00544 void 00545 observer_detach_breakpoint_created (struct observer *observer) 00546 { 00547 generic_observer_detach (&breakpoint_created_subject, observer); 00548 } 00549 00550 void 00551 observer_notify_breakpoint_created (struct breakpoint *b) 00552 { 00553 struct breakpoint_created_args args; 00554 args.b = b; 00555 00556 if (observer_debug) 00557 fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_created() called\n"); 00558 generic_observer_notify (breakpoint_created_subject, &args); 00559 } 00560 00561 /* breakpoint_deleted notifications. */ 00562 00563 static struct observer_list *breakpoint_deleted_subject = NULL; 00564 00565 struct breakpoint_deleted_args { struct breakpoint *b; }; 00566 00567 static void 00568 observer_breakpoint_deleted_notification_stub (const void *data, const void *args_data) 00569 { 00570 observer_breakpoint_deleted_ftype *notify = (observer_breakpoint_deleted_ftype *) data; 00571 const struct breakpoint_deleted_args *args = args_data; 00572 notify (args->b); 00573 } 00574 00575 struct observer * 00576 observer_attach_breakpoint_deleted (observer_breakpoint_deleted_ftype *f) 00577 { 00578 return generic_observer_attach (&breakpoint_deleted_subject, 00579 &observer_breakpoint_deleted_notification_stub, 00580 (void *) f); 00581 } 00582 00583 void 00584 observer_detach_breakpoint_deleted (struct observer *observer) 00585 { 00586 generic_observer_detach (&breakpoint_deleted_subject, observer); 00587 } 00588 00589 void 00590 observer_notify_breakpoint_deleted (struct breakpoint *b) 00591 { 00592 struct breakpoint_deleted_args args; 00593 args.b = b; 00594 00595 if (observer_debug) 00596 fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_deleted() called\n"); 00597 generic_observer_notify (breakpoint_deleted_subject, &args); 00598 } 00599 00600 /* breakpoint_modified notifications. */ 00601 00602 static struct observer_list *breakpoint_modified_subject = NULL; 00603 00604 struct breakpoint_modified_args { struct breakpoint *b; }; 00605 00606 static void 00607 observer_breakpoint_modified_notification_stub (const void *data, const void *args_data) 00608 { 00609 observer_breakpoint_modified_ftype *notify = (observer_breakpoint_modified_ftype *) data; 00610 const struct breakpoint_modified_args *args = args_data; 00611 notify (args->b); 00612 } 00613 00614 struct observer * 00615 observer_attach_breakpoint_modified (observer_breakpoint_modified_ftype *f) 00616 { 00617 return generic_observer_attach (&breakpoint_modified_subject, 00618 &observer_breakpoint_modified_notification_stub, 00619 (void *) f); 00620 } 00621 00622 void 00623 observer_detach_breakpoint_modified (struct observer *observer) 00624 { 00625 generic_observer_detach (&breakpoint_modified_subject, observer); 00626 } 00627 00628 void 00629 observer_notify_breakpoint_modified (struct breakpoint *b) 00630 { 00631 struct breakpoint_modified_args args; 00632 args.b = b; 00633 00634 if (observer_debug) 00635 fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_modified() called\n"); 00636 generic_observer_notify (breakpoint_modified_subject, &args); 00637 } 00638 00639 /* traceframe_changed notifications. */ 00640 00641 static struct observer_list *traceframe_changed_subject = NULL; 00642 00643 struct traceframe_changed_args { int tfnum; int tpnum; }; 00644 00645 static void 00646 observer_traceframe_changed_notification_stub (const void *data, const void *args_data) 00647 { 00648 observer_traceframe_changed_ftype *notify = (observer_traceframe_changed_ftype *) data; 00649 const struct traceframe_changed_args *args = args_data; 00650 notify (args->tfnum, args->tpnum); 00651 } 00652 00653 struct observer * 00654 observer_attach_traceframe_changed (observer_traceframe_changed_ftype *f) 00655 { 00656 return generic_observer_attach (&traceframe_changed_subject, 00657 &observer_traceframe_changed_notification_stub, 00658 (void *) f); 00659 } 00660 00661 void 00662 observer_detach_traceframe_changed (struct observer *observer) 00663 { 00664 generic_observer_detach (&traceframe_changed_subject, observer); 00665 } 00666 00667 void 00668 observer_notify_traceframe_changed (int tfnum, int tpnum) 00669 { 00670 struct traceframe_changed_args args; 00671 args.tfnum = tfnum, args.tpnum = tpnum; 00672 00673 if (observer_debug) 00674 fprintf_unfiltered (gdb_stdlog, "observer_notify_traceframe_changed() called\n"); 00675 generic_observer_notify (traceframe_changed_subject, &args); 00676 } 00677 00678 /* architecture_changed notifications. */ 00679 00680 static struct observer_list *architecture_changed_subject = NULL; 00681 00682 struct architecture_changed_args { struct gdbarch *newarch; }; 00683 00684 static void 00685 observer_architecture_changed_notification_stub (const void *data, const void *args_data) 00686 { 00687 observer_architecture_changed_ftype *notify = (observer_architecture_changed_ftype *) data; 00688 const struct architecture_changed_args *args = args_data; 00689 notify (args->newarch); 00690 } 00691 00692 struct observer * 00693 observer_attach_architecture_changed (observer_architecture_changed_ftype *f) 00694 { 00695 return generic_observer_attach (&architecture_changed_subject, 00696 &observer_architecture_changed_notification_stub, 00697 (void *) f); 00698 } 00699 00700 void 00701 observer_detach_architecture_changed (struct observer *observer) 00702 { 00703 generic_observer_detach (&architecture_changed_subject, observer); 00704 } 00705 00706 void 00707 observer_notify_architecture_changed (struct gdbarch *newarch) 00708 { 00709 struct architecture_changed_args args; 00710 args.newarch = newarch; 00711 00712 if (observer_debug) 00713 fprintf_unfiltered (gdb_stdlog, "observer_notify_architecture_changed() called\n"); 00714 generic_observer_notify (architecture_changed_subject, &args); 00715 } 00716 00717 /* thread_ptid_changed notifications. */ 00718 00719 static struct observer_list *thread_ptid_changed_subject = NULL; 00720 00721 struct thread_ptid_changed_args { ptid_t old_ptid; ptid_t new_ptid; }; 00722 00723 static void 00724 observer_thread_ptid_changed_notification_stub (const void *data, const void *args_data) 00725 { 00726 observer_thread_ptid_changed_ftype *notify = (observer_thread_ptid_changed_ftype *) data; 00727 const struct thread_ptid_changed_args *args = args_data; 00728 notify (args->old_ptid, args->new_ptid); 00729 } 00730 00731 struct observer * 00732 observer_attach_thread_ptid_changed (observer_thread_ptid_changed_ftype *f) 00733 { 00734 return generic_observer_attach (&thread_ptid_changed_subject, 00735 &observer_thread_ptid_changed_notification_stub, 00736 (void *) f); 00737 } 00738 00739 void 00740 observer_detach_thread_ptid_changed (struct observer *observer) 00741 { 00742 generic_observer_detach (&thread_ptid_changed_subject, observer); 00743 } 00744 00745 void 00746 observer_notify_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid) 00747 { 00748 struct thread_ptid_changed_args args; 00749 args.old_ptid = old_ptid, args.new_ptid = new_ptid; 00750 00751 if (observer_debug) 00752 fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_ptid_changed() called\n"); 00753 generic_observer_notify (thread_ptid_changed_subject, &args); 00754 } 00755 00756 /* inferior_added notifications. */ 00757 00758 static struct observer_list *inferior_added_subject = NULL; 00759 00760 struct inferior_added_args { struct inferior *inf; }; 00761 00762 static void 00763 observer_inferior_added_notification_stub (const void *data, const void *args_data) 00764 { 00765 observer_inferior_added_ftype *notify = (observer_inferior_added_ftype *) data; 00766 const struct inferior_added_args *args = args_data; 00767 notify (args->inf); 00768 } 00769 00770 struct observer * 00771 observer_attach_inferior_added (observer_inferior_added_ftype *f) 00772 { 00773 return generic_observer_attach (&inferior_added_subject, 00774 &observer_inferior_added_notification_stub, 00775 (void *) f); 00776 } 00777 00778 void 00779 observer_detach_inferior_added (struct observer *observer) 00780 { 00781 generic_observer_detach (&inferior_added_subject, observer); 00782 } 00783 00784 void 00785 observer_notify_inferior_added (struct inferior *inf) 00786 { 00787 struct inferior_added_args args; 00788 args.inf = inf; 00789 00790 if (observer_debug) 00791 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_added() called\n"); 00792 generic_observer_notify (inferior_added_subject, &args); 00793 } 00794 00795 /* inferior_appeared notifications. */ 00796 00797 static struct observer_list *inferior_appeared_subject = NULL; 00798 00799 struct inferior_appeared_args { struct inferior *inf; }; 00800 00801 static void 00802 observer_inferior_appeared_notification_stub (const void *data, const void *args_data) 00803 { 00804 observer_inferior_appeared_ftype *notify = (observer_inferior_appeared_ftype *) data; 00805 const struct inferior_appeared_args *args = args_data; 00806 notify (args->inf); 00807 } 00808 00809 struct observer * 00810 observer_attach_inferior_appeared (observer_inferior_appeared_ftype *f) 00811 { 00812 return generic_observer_attach (&inferior_appeared_subject, 00813 &observer_inferior_appeared_notification_stub, 00814 (void *) f); 00815 } 00816 00817 void 00818 observer_detach_inferior_appeared (struct observer *observer) 00819 { 00820 generic_observer_detach (&inferior_appeared_subject, observer); 00821 } 00822 00823 void 00824 observer_notify_inferior_appeared (struct inferior *inf) 00825 { 00826 struct inferior_appeared_args args; 00827 args.inf = inf; 00828 00829 if (observer_debug) 00830 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_appeared() called\n"); 00831 generic_observer_notify (inferior_appeared_subject, &args); 00832 } 00833 00834 /* inferior_exit notifications. */ 00835 00836 static struct observer_list *inferior_exit_subject = NULL; 00837 00838 struct inferior_exit_args { struct inferior *inf; }; 00839 00840 static void 00841 observer_inferior_exit_notification_stub (const void *data, const void *args_data) 00842 { 00843 observer_inferior_exit_ftype *notify = (observer_inferior_exit_ftype *) data; 00844 const struct inferior_exit_args *args = args_data; 00845 notify (args->inf); 00846 } 00847 00848 struct observer * 00849 observer_attach_inferior_exit (observer_inferior_exit_ftype *f) 00850 { 00851 return generic_observer_attach (&inferior_exit_subject, 00852 &observer_inferior_exit_notification_stub, 00853 (void *) f); 00854 } 00855 00856 void 00857 observer_detach_inferior_exit (struct observer *observer) 00858 { 00859 generic_observer_detach (&inferior_exit_subject, observer); 00860 } 00861 00862 void 00863 observer_notify_inferior_exit (struct inferior *inf) 00864 { 00865 struct inferior_exit_args args; 00866 args.inf = inf; 00867 00868 if (observer_debug) 00869 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_exit() called\n"); 00870 generic_observer_notify (inferior_exit_subject, &args); 00871 } 00872 00873 /* inferior_removed notifications. */ 00874 00875 static struct observer_list *inferior_removed_subject = NULL; 00876 00877 struct inferior_removed_args { struct inferior *inf; }; 00878 00879 static void 00880 observer_inferior_removed_notification_stub (const void *data, const void *args_data) 00881 { 00882 observer_inferior_removed_ftype *notify = (observer_inferior_removed_ftype *) data; 00883 const struct inferior_removed_args *args = args_data; 00884 notify (args->inf); 00885 } 00886 00887 struct observer * 00888 observer_attach_inferior_removed (observer_inferior_removed_ftype *f) 00889 { 00890 return generic_observer_attach (&inferior_removed_subject, 00891 &observer_inferior_removed_notification_stub, 00892 (void *) f); 00893 } 00894 00895 void 00896 observer_detach_inferior_removed (struct observer *observer) 00897 { 00898 generic_observer_detach (&inferior_removed_subject, observer); 00899 } 00900 00901 void 00902 observer_notify_inferior_removed (struct inferior *inf) 00903 { 00904 struct inferior_removed_args args; 00905 args.inf = inf; 00906 00907 if (observer_debug) 00908 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_removed() called\n"); 00909 generic_observer_notify (inferior_removed_subject, &args); 00910 } 00911 00912 /* memory_changed notifications. */ 00913 00914 static struct observer_list *memory_changed_subject = NULL; 00915 00916 struct memory_changed_args { struct inferior *inferior; CORE_ADDR addr; ssize_t len; const bfd_byte *data; }; 00917 00918 static void 00919 observer_memory_changed_notification_stub (const void *data, const void *args_data) 00920 { 00921 observer_memory_changed_ftype *notify = (observer_memory_changed_ftype *) data; 00922 const struct memory_changed_args *args = args_data; 00923 notify (args->inferior, args->addr, args->len, args->data); 00924 } 00925 00926 struct observer * 00927 observer_attach_memory_changed (observer_memory_changed_ftype *f) 00928 { 00929 return generic_observer_attach (&memory_changed_subject, 00930 &observer_memory_changed_notification_stub, 00931 (void *) f); 00932 } 00933 00934 void 00935 observer_detach_memory_changed (struct observer *observer) 00936 { 00937 generic_observer_detach (&memory_changed_subject, observer); 00938 } 00939 00940 void 00941 observer_notify_memory_changed (struct inferior *inferior, CORE_ADDR addr, ssize_t len, const bfd_byte *data) 00942 { 00943 struct memory_changed_args args; 00944 args.inferior = inferior, args.addr = addr, args.len = len, args.data = data; 00945 00946 if (observer_debug) 00947 fprintf_unfiltered (gdb_stdlog, "observer_notify_memory_changed() called\n"); 00948 generic_observer_notify (memory_changed_subject, &args); 00949 } 00950 00951 /* before_prompt notifications. */ 00952 00953 static struct observer_list *before_prompt_subject = NULL; 00954 00955 struct before_prompt_args { const char *current_prompt; }; 00956 00957 static void 00958 observer_before_prompt_notification_stub (const void *data, const void *args_data) 00959 { 00960 observer_before_prompt_ftype *notify = (observer_before_prompt_ftype *) data; 00961 const struct before_prompt_args *args = args_data; 00962 notify (args->current_prompt); 00963 } 00964 00965 struct observer * 00966 observer_attach_before_prompt (observer_before_prompt_ftype *f) 00967 { 00968 return generic_observer_attach (&before_prompt_subject, 00969 &observer_before_prompt_notification_stub, 00970 (void *) f); 00971 } 00972 00973 void 00974 observer_detach_before_prompt (struct observer *observer) 00975 { 00976 generic_observer_detach (&before_prompt_subject, observer); 00977 } 00978 00979 void 00980 observer_notify_before_prompt (const char *current_prompt) 00981 { 00982 struct before_prompt_args args; 00983 args.current_prompt = current_prompt; 00984 00985 if (observer_debug) 00986 fprintf_unfiltered (gdb_stdlog, "observer_notify_before_prompt() called\n"); 00987 generic_observer_notify (before_prompt_subject, &args); 00988 } 00989 00990 /* gdb_datadir_changed notifications. */ 00991 00992 static struct observer_list *gdb_datadir_changed_subject = NULL; 00993 00994 static void 00995 observer_gdb_datadir_changed_notification_stub (const void *data, const void *args_data) 00996 { 00997 observer_gdb_datadir_changed_ftype *notify = (observer_gdb_datadir_changed_ftype *) data; 00998 notify (); 00999 } 01000 01001 struct observer * 01002 observer_attach_gdb_datadir_changed (observer_gdb_datadir_changed_ftype *f) 01003 { 01004 return generic_observer_attach (&gdb_datadir_changed_subject, 01005 &observer_gdb_datadir_changed_notification_stub, 01006 (void *) f); 01007 } 01008 01009 void 01010 observer_detach_gdb_datadir_changed (struct observer *observer) 01011 { 01012 generic_observer_detach (&gdb_datadir_changed_subject, observer); 01013 } 01014 01015 void 01016 observer_notify_gdb_datadir_changed (void) 01017 { 01018 char *args = NULL; 01019 if (observer_debug) 01020 fprintf_unfiltered (gdb_stdlog, "observer_notify_gdb_datadir_changed() called\n"); 01021 generic_observer_notify (gdb_datadir_changed_subject, &args); 01022 } 01023 01024 /* command_param_changed notifications. */ 01025 01026 static struct observer_list *command_param_changed_subject = NULL; 01027 01028 struct command_param_changed_args { const char *param; const char *value; }; 01029 01030 static void 01031 observer_command_param_changed_notification_stub (const void *data, const void *args_data) 01032 { 01033 observer_command_param_changed_ftype *notify = (observer_command_param_changed_ftype *) data; 01034 const struct command_param_changed_args *args = args_data; 01035 notify (args->param, args->value); 01036 } 01037 01038 struct observer * 01039 observer_attach_command_param_changed (observer_command_param_changed_ftype *f) 01040 { 01041 return generic_observer_attach (&command_param_changed_subject, 01042 &observer_command_param_changed_notification_stub, 01043 (void *) f); 01044 } 01045 01046 void 01047 observer_detach_command_param_changed (struct observer *observer) 01048 { 01049 generic_observer_detach (&command_param_changed_subject, observer); 01050 } 01051 01052 void 01053 observer_notify_command_param_changed (const char *param, const char *value) 01054 { 01055 struct command_param_changed_args args; 01056 args.param = param, args.value = value; 01057 01058 if (observer_debug) 01059 fprintf_unfiltered (gdb_stdlog, "observer_notify_command_param_changed() called\n"); 01060 generic_observer_notify (command_param_changed_subject, &args); 01061 } 01062 01063 /* tsv_created notifications. */ 01064 01065 static struct observer_list *tsv_created_subject = NULL; 01066 01067 struct tsv_created_args { const struct trace_state_variable *tsv; }; 01068 01069 static void 01070 observer_tsv_created_notification_stub (const void *data, const void *args_data) 01071 { 01072 observer_tsv_created_ftype *notify = (observer_tsv_created_ftype *) data; 01073 const struct tsv_created_args *args = args_data; 01074 notify (args->tsv); 01075 } 01076 01077 struct observer * 01078 observer_attach_tsv_created (observer_tsv_created_ftype *f) 01079 { 01080 return generic_observer_attach (&tsv_created_subject, 01081 &observer_tsv_created_notification_stub, 01082 (void *) f); 01083 } 01084 01085 void 01086 observer_detach_tsv_created (struct observer *observer) 01087 { 01088 generic_observer_detach (&tsv_created_subject, observer); 01089 } 01090 01091 void 01092 observer_notify_tsv_created (const struct trace_state_variable *tsv) 01093 { 01094 struct tsv_created_args args; 01095 args.tsv = tsv; 01096 01097 if (observer_debug) 01098 fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_created() called\n"); 01099 generic_observer_notify (tsv_created_subject, &args); 01100 } 01101 01102 /* tsv_deleted notifications. */ 01103 01104 static struct observer_list *tsv_deleted_subject = NULL; 01105 01106 struct tsv_deleted_args { const struct trace_state_variable *tsv; }; 01107 01108 static void 01109 observer_tsv_deleted_notification_stub (const void *data, const void *args_data) 01110 { 01111 observer_tsv_deleted_ftype *notify = (observer_tsv_deleted_ftype *) data; 01112 const struct tsv_deleted_args *args = args_data; 01113 notify (args->tsv); 01114 } 01115 01116 struct observer * 01117 observer_attach_tsv_deleted (observer_tsv_deleted_ftype *f) 01118 { 01119 return generic_observer_attach (&tsv_deleted_subject, 01120 &observer_tsv_deleted_notification_stub, 01121 (void *) f); 01122 } 01123 01124 void 01125 observer_detach_tsv_deleted (struct observer *observer) 01126 { 01127 generic_observer_detach (&tsv_deleted_subject, observer); 01128 } 01129 01130 void 01131 observer_notify_tsv_deleted (const struct trace_state_variable *tsv) 01132 { 01133 struct tsv_deleted_args args; 01134 args.tsv = tsv; 01135 01136 if (observer_debug) 01137 fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_deleted() called\n"); 01138 generic_observer_notify (tsv_deleted_subject, &args); 01139 } 01140 01141 /* tsv_modified notifications. */ 01142 01143 static struct observer_list *tsv_modified_subject = NULL; 01144 01145 struct tsv_modified_args { const struct trace_state_variable *tsv; }; 01146 01147 static void 01148 observer_tsv_modified_notification_stub (const void *data, const void *args_data) 01149 { 01150 observer_tsv_modified_ftype *notify = (observer_tsv_modified_ftype *) data; 01151 const struct tsv_modified_args *args = args_data; 01152 notify (args->tsv); 01153 } 01154 01155 struct observer * 01156 observer_attach_tsv_modified (observer_tsv_modified_ftype *f) 01157 { 01158 return generic_observer_attach (&tsv_modified_subject, 01159 &observer_tsv_modified_notification_stub, 01160 (void *) f); 01161 } 01162 01163 void 01164 observer_detach_tsv_modified (struct observer *observer) 01165 { 01166 generic_observer_detach (&tsv_modified_subject, observer); 01167 } 01168 01169 void 01170 observer_notify_tsv_modified (const struct trace_state_variable *tsv) 01171 { 01172 struct tsv_modified_args args; 01173 args.tsv = tsv; 01174 01175 if (observer_debug) 01176 fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_modified() called\n"); 01177 generic_observer_notify (tsv_modified_subject, &args); 01178 } 01179 01180 /* test_notification notifications. */ 01181 01182 static struct observer_list *test_notification_subject = NULL; 01183 01184 struct test_notification_args { int somearg; }; 01185 01186 static void 01187 observer_test_notification_notification_stub (const void *data, const void *args_data) 01188 { 01189 observer_test_notification_ftype *notify = (observer_test_notification_ftype *) data; 01190 const struct test_notification_args *args = args_data; 01191 notify (args->somearg); 01192 } 01193 01194 struct observer * 01195 observer_attach_test_notification (observer_test_notification_ftype *f) 01196 { 01197 return generic_observer_attach (&test_notification_subject, 01198 &observer_test_notification_notification_stub, 01199 (void *) f); 01200 } 01201 01202 void 01203 observer_detach_test_notification (struct observer *observer) 01204 { 01205 generic_observer_detach (&test_notification_subject, observer); 01206 } 01207 01208 void 01209 observer_notify_test_notification (int somearg) 01210 { 01211 struct test_notification_args args; 01212 args.somearg = somearg; 01213 01214 if (observer_debug) 01215 fprintf_unfiltered (gdb_stdlog, "observer_notify_test_notification() called\n"); 01216 generic_observer_notify (test_notification_subject, &args); 01217 }