1/* GDB Notifications to Observers. 2 3 Copyright 2004 Free Software Foundation, Inc. 4 5 This file is part of GDB. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place - Suite 330, 20 Boston, MA 02111-1307, USA. 21 22 -- 23 24 This file was generated using observer.sh and observer.texi. */ 25 26 27/* normal_stop notifications. */ 28 29static struct observer_list *normal_stop_subject = NULL; 30 31struct normal_stop_args { struct bpstats *bs; }; 32 33static void 34observer_normal_stop_notification_stub (const void *data, const void *args_data) 35{ 36 observer_normal_stop_ftype *notify = (observer_normal_stop_ftype *) data; 37 const struct normal_stop_args *args = args_data; 38 notify (args->bs); 39} 40 41struct observer * 42observer_attach_normal_stop (observer_normal_stop_ftype *f) 43{ 44 return generic_observer_attach (&normal_stop_subject, 45 &observer_normal_stop_notification_stub, 46 (void *) f); 47} 48 49void 50observer_detach_normal_stop (struct observer *observer) 51{ 52 generic_observer_detach (&normal_stop_subject, observer); 53} 54 55void 56observer_notify_normal_stop (struct bpstats *bs) 57{ 58 struct normal_stop_args args; 59 args.bs = bs; 60 if (observer_debug) 61 fprintf_unfiltered (gdb_stdlog, "observer_notify_normal_stop() called\n"); 62 generic_observer_notify (normal_stop_subject, &args); 63} 64 65/* target_changed notifications. */ 66 67static struct observer_list *target_changed_subject = NULL; 68 69struct target_changed_args { struct target_ops *target; }; 70 71static void 72observer_target_changed_notification_stub (const void *data, const void *args_data) 73{ 74 observer_target_changed_ftype *notify = (observer_target_changed_ftype *) data; 75 const struct target_changed_args *args = args_data; 76 notify (args->target); 77} 78 79struct observer * 80observer_attach_target_changed (observer_target_changed_ftype *f) 81{ 82 return generic_observer_attach (&target_changed_subject, 83 &observer_target_changed_notification_stub, 84 (void *) f); 85} 86 87void 88observer_detach_target_changed (struct observer *observer) 89{ 90 generic_observer_detach (&target_changed_subject, observer); 91} 92 93void 94observer_notify_target_changed (struct target_ops *target) 95{ 96 struct target_changed_args args; 97 args.target = target; 98 if (observer_debug) 99 fprintf_unfiltered (gdb_stdlog, "observer_notify_target_changed() called\n"); 100 generic_observer_notify (target_changed_subject, &args); 101} 102 103/* inferior_created notifications. */ 104 105static struct observer_list *inferior_created_subject = NULL; 106 107struct inferior_created_args { struct target_ops *objfile; int from_tty; }; 108 109static void 110observer_inferior_created_notification_stub (const void *data, const void *args_data) 111{ 112 observer_inferior_created_ftype *notify = (observer_inferior_created_ftype *) data; 113 const struct inferior_created_args *args = args_data; 114 notify (args->objfile, args->from_tty); 115} 116 117struct observer * 118observer_attach_inferior_created (observer_inferior_created_ftype *f) 119{ 120 return generic_observer_attach (&inferior_created_subject, 121 &observer_inferior_created_notification_stub, 122 (void *) f); 123} 124 125void 126observer_detach_inferior_created (struct observer *observer) 127{ 128 generic_observer_detach (&inferior_created_subject, observer); 129} 130 131void 132observer_notify_inferior_created (struct target_ops *objfile, int from_tty) 133{ 134 struct inferior_created_args args; 135 args.objfile = objfile, args.from_tty = from_tty; 136 if (observer_debug) 137 fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_created() called\n"); 138 generic_observer_notify (inferior_created_subject, &args); 139} 140 141/* solib_unloaded notifications. */ 142 143static struct observer_list *solib_unloaded_subject = NULL; 144 145struct solib_unloaded_args { struct so_list *solib; }; 146 147static void 148observer_solib_unloaded_notification_stub (const void *data, const void *args_data) 149{ 150 observer_solib_unloaded_ftype *notify = (observer_solib_unloaded_ftype *) data; 151 const struct solib_unloaded_args *args = args_data; 152 notify (args->solib); 153} 154 155struct observer * 156observer_attach_solib_unloaded (observer_solib_unloaded_ftype *f) 157{ 158 return generic_observer_attach (&solib_unloaded_subject, 159 &observer_solib_unloaded_notification_stub, 160 (void *) f); 161} 162 163void 164observer_detach_solib_unloaded (struct observer *observer) 165{ 166 generic_observer_detach (&solib_unloaded_subject, observer); 167} 168 169void 170observer_notify_solib_unloaded (struct so_list *solib) 171{ 172 struct solib_unloaded_args args; 173 args.solib = solib; 174 if (observer_debug) 175 fprintf_unfiltered (gdb_stdlog, "observer_notify_solib_unloaded() called\n"); 176 generic_observer_notify (solib_unloaded_subject, &args); 177} 178