Home | History | Annotate | Line # | Download | only in mipseb
observer.inc revision 1.2
      1  1.1  christos /* This file is automatically generated.  DO NOT EDIT! */
      2  1.2       mrg /* Generated from: 	NetBSD: mknative-gdb,v 1.6 2013/10/03 18:58:37 christos Exp  */
      3  1.1  christos /* Generated from: NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp  */
      4  1.1  christos 
      5  1.1  christos /* GDB Notifications to Observers.
      6  1.1  christos 
      7  1.2       mrg    Copyright (C) 2004-2013 Free Software Foundation, Inc.
      8  1.1  christos 
      9  1.1  christos    This file is part of GDB.
     10  1.1  christos 
     11  1.1  christos    This program is free software; you can redistribute it and/or modify
     12  1.1  christos    it under the terms of the GNU General Public License as published by
     13  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     14  1.1  christos    (at your option) any later version.
     15  1.1  christos 
     16  1.1  christos    This program is distributed in the hope that it will be useful,
     17  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     18  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19  1.1  christos    GNU General Public License for more details.
     20  1.1  christos 
     21  1.1  christos    You should have received a copy of the GNU General Public License
     22  1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.
     23  1.1  christos 
     24  1.1  christos    --
     25  1.1  christos 
     26  1.1  christos    This file was generated using observer.sh and observer.texi.  */
     27  1.1  christos 
     28  1.1  christos 
     29  1.1  christos /* normal_stop notifications.  */
     30  1.1  christos 
     31  1.1  christos static struct observer_list *normal_stop_subject = NULL;
     32  1.1  christos 
     33  1.1  christos struct normal_stop_args { struct bpstats *bs; int print_frame; };
     34  1.1  christos 
     35  1.1  christos static void
     36  1.1  christos observer_normal_stop_notification_stub (const void *data, const void *args_data)
     37  1.1  christos {
     38  1.1  christos   observer_normal_stop_ftype *notify = (observer_normal_stop_ftype *) data;
     39  1.1  christos   const struct normal_stop_args *args = args_data;
     40  1.1  christos   notify (args->bs, args->print_frame);
     41  1.1  christos }
     42  1.1  christos 
     43  1.1  christos struct observer *
     44  1.1  christos observer_attach_normal_stop (observer_normal_stop_ftype *f)
     45  1.1  christos {
     46  1.1  christos   return generic_observer_attach (&normal_stop_subject,
     47  1.1  christos 				  &observer_normal_stop_notification_stub,
     48  1.1  christos 				  (void *) f);
     49  1.1  christos }
     50  1.1  christos 
     51  1.1  christos void
     52  1.1  christos observer_detach_normal_stop (struct observer *observer)
     53  1.1  christos {
     54  1.1  christos   generic_observer_detach (&normal_stop_subject, observer);
     55  1.1  christos }
     56  1.1  christos 
     57  1.1  christos void
     58  1.1  christos observer_notify_normal_stop (struct bpstats *bs, int print_frame)
     59  1.1  christos {
     60  1.1  christos   struct normal_stop_args args;
     61  1.1  christos   args.bs = bs, args.print_frame = print_frame;
     62  1.1  christos 
     63  1.1  christos   if (observer_debug)
     64  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_normal_stop() called\n");
     65  1.1  christos   generic_observer_notify (normal_stop_subject, &args);
     66  1.1  christos }
     67  1.1  christos 
     68  1.1  christos /* target_changed notifications.  */
     69  1.1  christos 
     70  1.1  christos static struct observer_list *target_changed_subject = NULL;
     71  1.1  christos 
     72  1.1  christos struct target_changed_args { struct target_ops *target; };
     73  1.1  christos 
     74  1.1  christos static void
     75  1.1  christos observer_target_changed_notification_stub (const void *data, const void *args_data)
     76  1.1  christos {
     77  1.1  christos   observer_target_changed_ftype *notify = (observer_target_changed_ftype *) data;
     78  1.1  christos   const struct target_changed_args *args = args_data;
     79  1.1  christos   notify (args->target);
     80  1.1  christos }
     81  1.1  christos 
     82  1.1  christos struct observer *
     83  1.1  christos observer_attach_target_changed (observer_target_changed_ftype *f)
     84  1.1  christos {
     85  1.1  christos   return generic_observer_attach (&target_changed_subject,
     86  1.1  christos 				  &observer_target_changed_notification_stub,
     87  1.1  christos 				  (void *) f);
     88  1.1  christos }
     89  1.1  christos 
     90  1.1  christos void
     91  1.1  christos observer_detach_target_changed (struct observer *observer)
     92  1.1  christos {
     93  1.1  christos   generic_observer_detach (&target_changed_subject, observer);
     94  1.1  christos }
     95  1.1  christos 
     96  1.1  christos void
     97  1.1  christos observer_notify_target_changed (struct target_ops *target)
     98  1.1  christos {
     99  1.1  christos   struct target_changed_args args;
    100  1.1  christos   args.target = target;
    101  1.1  christos 
    102  1.1  christos   if (observer_debug)
    103  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_target_changed() called\n");
    104  1.1  christos   generic_observer_notify (target_changed_subject, &args);
    105  1.1  christos }
    106  1.1  christos 
    107  1.1  christos /* executable_changed notifications.  */
    108  1.1  christos 
    109  1.1  christos static struct observer_list *executable_changed_subject = NULL;
    110  1.1  christos 
    111  1.1  christos static void
    112  1.1  christos observer_executable_changed_notification_stub (const void *data, const void *args_data)
    113  1.1  christos {
    114  1.1  christos   observer_executable_changed_ftype *notify = (observer_executable_changed_ftype *) data;
    115  1.1  christos   notify ();
    116  1.1  christos }
    117  1.1  christos 
    118  1.1  christos struct observer *
    119  1.1  christos observer_attach_executable_changed (observer_executable_changed_ftype *f)
    120  1.1  christos {
    121  1.1  christos   return generic_observer_attach (&executable_changed_subject,
    122  1.1  christos 				  &observer_executable_changed_notification_stub,
    123  1.1  christos 				  (void *) f);
    124  1.1  christos }
    125  1.1  christos 
    126  1.1  christos void
    127  1.1  christos observer_detach_executable_changed (struct observer *observer)
    128  1.1  christos {
    129  1.1  christos   generic_observer_detach (&executable_changed_subject, observer);
    130  1.1  christos }
    131  1.1  christos 
    132  1.1  christos void
    133  1.1  christos observer_notify_executable_changed (void)
    134  1.1  christos {
    135  1.1  christos char *args = NULL;
    136  1.1  christos   if (observer_debug)
    137  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_executable_changed() called\n");
    138  1.1  christos   generic_observer_notify (executable_changed_subject, &args);
    139  1.1  christos }
    140  1.1  christos 
    141  1.1  christos /* inferior_created notifications.  */
    142  1.1  christos 
    143  1.1  christos static struct observer_list *inferior_created_subject = NULL;
    144  1.1  christos 
    145  1.1  christos struct inferior_created_args { struct target_ops *objfile; int from_tty; };
    146  1.1  christos 
    147  1.1  christos static void
    148  1.1  christos observer_inferior_created_notification_stub (const void *data, const void *args_data)
    149  1.1  christos {
    150  1.1  christos   observer_inferior_created_ftype *notify = (observer_inferior_created_ftype *) data;
    151  1.1  christos   const struct inferior_created_args *args = args_data;
    152  1.1  christos   notify (args->objfile, args->from_tty);
    153  1.1  christos }
    154  1.1  christos 
    155  1.1  christos struct observer *
    156  1.1  christos observer_attach_inferior_created (observer_inferior_created_ftype *f)
    157  1.1  christos {
    158  1.1  christos   return generic_observer_attach (&inferior_created_subject,
    159  1.1  christos 				  &observer_inferior_created_notification_stub,
    160  1.1  christos 				  (void *) f);
    161  1.1  christos }
    162  1.1  christos 
    163  1.1  christos void
    164  1.1  christos observer_detach_inferior_created (struct observer *observer)
    165  1.1  christos {
    166  1.1  christos   generic_observer_detach (&inferior_created_subject, observer);
    167  1.1  christos }
    168  1.1  christos 
    169  1.1  christos void
    170  1.1  christos observer_notify_inferior_created (struct target_ops *objfile, int from_tty)
    171  1.1  christos {
    172  1.1  christos   struct inferior_created_args args;
    173  1.1  christos   args.objfile = objfile, args.from_tty = from_tty;
    174  1.1  christos 
    175  1.1  christos   if (observer_debug)
    176  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_created() called\n");
    177  1.1  christos   generic_observer_notify (inferior_created_subject, &args);
    178  1.1  christos }
    179  1.1  christos 
    180  1.2       mrg /* record_changed notifications.  */
    181  1.2       mrg 
    182  1.2       mrg static struct observer_list *record_changed_subject = NULL;
    183  1.2       mrg 
    184  1.2       mrg struct record_changed_args { struct inferior *inferior; int started; };
    185  1.2       mrg 
    186  1.2       mrg static void
    187  1.2       mrg observer_record_changed_notification_stub (const void *data, const void *args_data)
    188  1.2       mrg {
    189  1.2       mrg   observer_record_changed_ftype *notify = (observer_record_changed_ftype *) data;
    190  1.2       mrg   const struct record_changed_args *args = args_data;
    191  1.2       mrg   notify (args->inferior, args->started);
    192  1.2       mrg }
    193  1.2       mrg 
    194  1.2       mrg struct observer *
    195  1.2       mrg observer_attach_record_changed (observer_record_changed_ftype *f)
    196  1.2       mrg {
    197  1.2       mrg   return generic_observer_attach (&record_changed_subject,
    198  1.2       mrg 				  &observer_record_changed_notification_stub,
    199  1.2       mrg 				  (void *) f);
    200  1.2       mrg }
    201  1.2       mrg 
    202  1.2       mrg void
    203  1.2       mrg observer_detach_record_changed (struct observer *observer)
    204  1.2       mrg {
    205  1.2       mrg   generic_observer_detach (&record_changed_subject, observer);
    206  1.2       mrg }
    207  1.2       mrg 
    208  1.2       mrg void
    209  1.2       mrg observer_notify_record_changed (struct inferior *inferior, int started)
    210  1.2       mrg {
    211  1.2       mrg   struct record_changed_args args;
    212  1.2       mrg   args.inferior = inferior, args.started = started;
    213  1.2       mrg 
    214  1.2       mrg   if (observer_debug)
    215  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_record_changed() called\n");
    216  1.2       mrg   generic_observer_notify (record_changed_subject, &args);
    217  1.2       mrg }
    218  1.2       mrg 
    219  1.1  christos /* solib_loaded notifications.  */
    220  1.1  christos 
    221  1.1  christos static struct observer_list *solib_loaded_subject = NULL;
    222  1.1  christos 
    223  1.1  christos struct solib_loaded_args { struct so_list *solib; };
    224  1.1  christos 
    225  1.1  christos static void
    226  1.1  christos observer_solib_loaded_notification_stub (const void *data, const void *args_data)
    227  1.1  christos {
    228  1.1  christos   observer_solib_loaded_ftype *notify = (observer_solib_loaded_ftype *) data;
    229  1.1  christos   const struct solib_loaded_args *args = args_data;
    230  1.1  christos   notify (args->solib);
    231  1.1  christos }
    232  1.1  christos 
    233  1.1  christos struct observer *
    234  1.1  christos observer_attach_solib_loaded (observer_solib_loaded_ftype *f)
    235  1.1  christos {
    236  1.1  christos   return generic_observer_attach (&solib_loaded_subject,
    237  1.1  christos 				  &observer_solib_loaded_notification_stub,
    238  1.1  christos 				  (void *) f);
    239  1.1  christos }
    240  1.1  christos 
    241  1.1  christos void
    242  1.1  christos observer_detach_solib_loaded (struct observer *observer)
    243  1.1  christos {
    244  1.1  christos   generic_observer_detach (&solib_loaded_subject, observer);
    245  1.1  christos }
    246  1.1  christos 
    247  1.1  christos void
    248  1.1  christos observer_notify_solib_loaded (struct so_list *solib)
    249  1.1  christos {
    250  1.1  christos   struct solib_loaded_args args;
    251  1.1  christos   args.solib = solib;
    252  1.1  christos 
    253  1.1  christos   if (observer_debug)
    254  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_solib_loaded() called\n");
    255  1.1  christos   generic_observer_notify (solib_loaded_subject, &args);
    256  1.1  christos }
    257  1.1  christos 
    258  1.1  christos /* solib_unloaded notifications.  */
    259  1.1  christos 
    260  1.1  christos static struct observer_list *solib_unloaded_subject = NULL;
    261  1.1  christos 
    262  1.1  christos struct solib_unloaded_args { struct so_list *solib; };
    263  1.1  christos 
    264  1.1  christos static void
    265  1.1  christos observer_solib_unloaded_notification_stub (const void *data, const void *args_data)
    266  1.1  christos {
    267  1.1  christos   observer_solib_unloaded_ftype *notify = (observer_solib_unloaded_ftype *) data;
    268  1.1  christos   const struct solib_unloaded_args *args = args_data;
    269  1.1  christos   notify (args->solib);
    270  1.1  christos }
    271  1.1  christos 
    272  1.1  christos struct observer *
    273  1.1  christos observer_attach_solib_unloaded (observer_solib_unloaded_ftype *f)
    274  1.1  christos {
    275  1.1  christos   return generic_observer_attach (&solib_unloaded_subject,
    276  1.1  christos 				  &observer_solib_unloaded_notification_stub,
    277  1.1  christos 				  (void *) f);
    278  1.1  christos }
    279  1.1  christos 
    280  1.1  christos void
    281  1.1  christos observer_detach_solib_unloaded (struct observer *observer)
    282  1.1  christos {
    283  1.1  christos   generic_observer_detach (&solib_unloaded_subject, observer);
    284  1.1  christos }
    285  1.1  christos 
    286  1.1  christos void
    287  1.1  christos observer_notify_solib_unloaded (struct so_list *solib)
    288  1.1  christos {
    289  1.1  christos   struct solib_unloaded_args args;
    290  1.1  christos   args.solib = solib;
    291  1.1  christos 
    292  1.1  christos   if (observer_debug)
    293  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_solib_unloaded() called\n");
    294  1.1  christos   generic_observer_notify (solib_unloaded_subject, &args);
    295  1.1  christos }
    296  1.1  christos 
    297  1.1  christos /* new_objfile notifications.  */
    298  1.1  christos 
    299  1.1  christos static struct observer_list *new_objfile_subject = NULL;
    300  1.1  christos 
    301  1.1  christos struct new_objfile_args { struct objfile *objfile; };
    302  1.1  christos 
    303  1.1  christos static void
    304  1.1  christos observer_new_objfile_notification_stub (const void *data, const void *args_data)
    305  1.1  christos {
    306  1.1  christos   observer_new_objfile_ftype *notify = (observer_new_objfile_ftype *) data;
    307  1.1  christos   const struct new_objfile_args *args = args_data;
    308  1.1  christos   notify (args->objfile);
    309  1.1  christos }
    310  1.1  christos 
    311  1.1  christos struct observer *
    312  1.1  christos observer_attach_new_objfile (observer_new_objfile_ftype *f)
    313  1.1  christos {
    314  1.1  christos   return generic_observer_attach (&new_objfile_subject,
    315  1.1  christos 				  &observer_new_objfile_notification_stub,
    316  1.1  christos 				  (void *) f);
    317  1.1  christos }
    318  1.1  christos 
    319  1.1  christos void
    320  1.1  christos observer_detach_new_objfile (struct observer *observer)
    321  1.1  christos {
    322  1.1  christos   generic_observer_detach (&new_objfile_subject, observer);
    323  1.1  christos }
    324  1.1  christos 
    325  1.1  christos void
    326  1.1  christos observer_notify_new_objfile (struct objfile *objfile)
    327  1.1  christos {
    328  1.1  christos   struct new_objfile_args args;
    329  1.1  christos   args.objfile = objfile;
    330  1.1  christos 
    331  1.1  christos   if (observer_debug)
    332  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_new_objfile() called\n");
    333  1.1  christos   generic_observer_notify (new_objfile_subject, &args);
    334  1.1  christos }
    335  1.1  christos 
    336  1.1  christos /* new_thread notifications.  */
    337  1.1  christos 
    338  1.1  christos static struct observer_list *new_thread_subject = NULL;
    339  1.1  christos 
    340  1.1  christos struct new_thread_args { struct thread_info *t; };
    341  1.1  christos 
    342  1.1  christos static void
    343  1.1  christos observer_new_thread_notification_stub (const void *data, const void *args_data)
    344  1.1  christos {
    345  1.1  christos   observer_new_thread_ftype *notify = (observer_new_thread_ftype *) data;
    346  1.1  christos   const struct new_thread_args *args = args_data;
    347  1.1  christos   notify (args->t);
    348  1.1  christos }
    349  1.1  christos 
    350  1.1  christos struct observer *
    351  1.1  christos observer_attach_new_thread (observer_new_thread_ftype *f)
    352  1.1  christos {
    353  1.1  christos   return generic_observer_attach (&new_thread_subject,
    354  1.1  christos 				  &observer_new_thread_notification_stub,
    355  1.1  christos 				  (void *) f);
    356  1.1  christos }
    357  1.1  christos 
    358  1.1  christos void
    359  1.1  christos observer_detach_new_thread (struct observer *observer)
    360  1.1  christos {
    361  1.1  christos   generic_observer_detach (&new_thread_subject, observer);
    362  1.1  christos }
    363  1.1  christos 
    364  1.1  christos void
    365  1.1  christos observer_notify_new_thread (struct thread_info *t)
    366  1.1  christos {
    367  1.1  christos   struct new_thread_args args;
    368  1.1  christos   args.t = t;
    369  1.1  christos 
    370  1.1  christos   if (observer_debug)
    371  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_new_thread() called\n");
    372  1.1  christos   generic_observer_notify (new_thread_subject, &args);
    373  1.1  christos }
    374  1.1  christos 
    375  1.1  christos /* thread_exit notifications.  */
    376  1.1  christos 
    377  1.1  christos static struct observer_list *thread_exit_subject = NULL;
    378  1.1  christos 
    379  1.1  christos struct thread_exit_args { struct thread_info *t; int silent; };
    380  1.1  christos 
    381  1.1  christos static void
    382  1.1  christos observer_thread_exit_notification_stub (const void *data, const void *args_data)
    383  1.1  christos {
    384  1.1  christos   observer_thread_exit_ftype *notify = (observer_thread_exit_ftype *) data;
    385  1.1  christos   const struct thread_exit_args *args = args_data;
    386  1.1  christos   notify (args->t, args->silent);
    387  1.1  christos }
    388  1.1  christos 
    389  1.1  christos struct observer *
    390  1.1  christos observer_attach_thread_exit (observer_thread_exit_ftype *f)
    391  1.1  christos {
    392  1.1  christos   return generic_observer_attach (&thread_exit_subject,
    393  1.1  christos 				  &observer_thread_exit_notification_stub,
    394  1.1  christos 				  (void *) f);
    395  1.1  christos }
    396  1.1  christos 
    397  1.1  christos void
    398  1.1  christos observer_detach_thread_exit (struct observer *observer)
    399  1.1  christos {
    400  1.1  christos   generic_observer_detach (&thread_exit_subject, observer);
    401  1.1  christos }
    402  1.1  christos 
    403  1.1  christos void
    404  1.1  christos observer_notify_thread_exit (struct thread_info *t, int silent)
    405  1.1  christos {
    406  1.1  christos   struct thread_exit_args args;
    407  1.1  christos   args.t = t, args.silent = silent;
    408  1.1  christos 
    409  1.1  christos   if (observer_debug)
    410  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_exit() called\n");
    411  1.1  christos   generic_observer_notify (thread_exit_subject, &args);
    412  1.1  christos }
    413  1.1  christos 
    414  1.1  christos /* thread_stop_requested notifications.  */
    415  1.1  christos 
    416  1.1  christos static struct observer_list *thread_stop_requested_subject = NULL;
    417  1.1  christos 
    418  1.1  christos struct thread_stop_requested_args { ptid_t ptid; };
    419  1.1  christos 
    420  1.1  christos static void
    421  1.1  christos observer_thread_stop_requested_notification_stub (const void *data, const void *args_data)
    422  1.1  christos {
    423  1.1  christos   observer_thread_stop_requested_ftype *notify = (observer_thread_stop_requested_ftype *) data;
    424  1.1  christos   const struct thread_stop_requested_args *args = args_data;
    425  1.1  christos   notify (args->ptid);
    426  1.1  christos }
    427  1.1  christos 
    428  1.1  christos struct observer *
    429  1.1  christos observer_attach_thread_stop_requested (observer_thread_stop_requested_ftype *f)
    430  1.1  christos {
    431  1.1  christos   return generic_observer_attach (&thread_stop_requested_subject,
    432  1.1  christos 				  &observer_thread_stop_requested_notification_stub,
    433  1.1  christos 				  (void *) f);
    434  1.1  christos }
    435  1.1  christos 
    436  1.1  christos void
    437  1.1  christos observer_detach_thread_stop_requested (struct observer *observer)
    438  1.1  christos {
    439  1.1  christos   generic_observer_detach (&thread_stop_requested_subject, observer);
    440  1.1  christos }
    441  1.1  christos 
    442  1.1  christos void
    443  1.1  christos observer_notify_thread_stop_requested (ptid_t ptid)
    444  1.1  christos {
    445  1.1  christos   struct thread_stop_requested_args args;
    446  1.1  christos   args.ptid = ptid;
    447  1.1  christos 
    448  1.1  christos   if (observer_debug)
    449  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_stop_requested() called\n");
    450  1.1  christos   generic_observer_notify (thread_stop_requested_subject, &args);
    451  1.1  christos }
    452  1.1  christos 
    453  1.1  christos /* target_resumed notifications.  */
    454  1.1  christos 
    455  1.1  christos static struct observer_list *target_resumed_subject = NULL;
    456  1.1  christos 
    457  1.1  christos struct target_resumed_args { ptid_t ptid; };
    458  1.1  christos 
    459  1.1  christos static void
    460  1.1  christos observer_target_resumed_notification_stub (const void *data, const void *args_data)
    461  1.1  christos {
    462  1.1  christos   observer_target_resumed_ftype *notify = (observer_target_resumed_ftype *) data;
    463  1.1  christos   const struct target_resumed_args *args = args_data;
    464  1.1  christos   notify (args->ptid);
    465  1.1  christos }
    466  1.1  christos 
    467  1.1  christos struct observer *
    468  1.1  christos observer_attach_target_resumed (observer_target_resumed_ftype *f)
    469  1.1  christos {
    470  1.1  christos   return generic_observer_attach (&target_resumed_subject,
    471  1.1  christos 				  &observer_target_resumed_notification_stub,
    472  1.1  christos 				  (void *) f);
    473  1.1  christos }
    474  1.1  christos 
    475  1.1  christos void
    476  1.1  christos observer_detach_target_resumed (struct observer *observer)
    477  1.1  christos {
    478  1.1  christos   generic_observer_detach (&target_resumed_subject, observer);
    479  1.1  christos }
    480  1.1  christos 
    481  1.1  christos void
    482  1.1  christos observer_notify_target_resumed (ptid_t ptid)
    483  1.1  christos {
    484  1.1  christos   struct target_resumed_args args;
    485  1.1  christos   args.ptid = ptid;
    486  1.1  christos 
    487  1.1  christos   if (observer_debug)
    488  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_target_resumed() called\n");
    489  1.1  christos   generic_observer_notify (target_resumed_subject, &args);
    490  1.1  christos }
    491  1.1  christos 
    492  1.1  christos /* about_to_proceed notifications.  */
    493  1.1  christos 
    494  1.1  christos static struct observer_list *about_to_proceed_subject = NULL;
    495  1.1  christos 
    496  1.1  christos static void
    497  1.1  christos observer_about_to_proceed_notification_stub (const void *data, const void *args_data)
    498  1.1  christos {
    499  1.1  christos   observer_about_to_proceed_ftype *notify = (observer_about_to_proceed_ftype *) data;
    500  1.1  christos   notify ();
    501  1.1  christos }
    502  1.1  christos 
    503  1.1  christos struct observer *
    504  1.1  christos observer_attach_about_to_proceed (observer_about_to_proceed_ftype *f)
    505  1.1  christos {
    506  1.1  christos   return generic_observer_attach (&about_to_proceed_subject,
    507  1.1  christos 				  &observer_about_to_proceed_notification_stub,
    508  1.1  christos 				  (void *) f);
    509  1.1  christos }
    510  1.1  christos 
    511  1.1  christos void
    512  1.1  christos observer_detach_about_to_proceed (struct observer *observer)
    513  1.1  christos {
    514  1.1  christos   generic_observer_detach (&about_to_proceed_subject, observer);
    515  1.1  christos }
    516  1.1  christos 
    517  1.1  christos void
    518  1.1  christos observer_notify_about_to_proceed (void)
    519  1.1  christos {
    520  1.1  christos char *args = NULL;
    521  1.1  christos   if (observer_debug)
    522  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_about_to_proceed() called\n");
    523  1.1  christos   generic_observer_notify (about_to_proceed_subject, &args);
    524  1.1  christos }
    525  1.1  christos 
    526  1.1  christos /* breakpoint_created notifications.  */
    527  1.1  christos 
    528  1.1  christos static struct observer_list *breakpoint_created_subject = NULL;
    529  1.1  christos 
    530  1.2       mrg struct breakpoint_created_args { struct breakpoint *b; };
    531  1.1  christos 
    532  1.1  christos static void
    533  1.1  christos observer_breakpoint_created_notification_stub (const void *data, const void *args_data)
    534  1.1  christos {
    535  1.1  christos   observer_breakpoint_created_ftype *notify = (observer_breakpoint_created_ftype *) data;
    536  1.1  christos   const struct breakpoint_created_args *args = args_data;
    537  1.2       mrg   notify (args->b);
    538  1.1  christos }
    539  1.1  christos 
    540  1.1  christos struct observer *
    541  1.1  christos observer_attach_breakpoint_created (observer_breakpoint_created_ftype *f)
    542  1.1  christos {
    543  1.1  christos   return generic_observer_attach (&breakpoint_created_subject,
    544  1.1  christos 				  &observer_breakpoint_created_notification_stub,
    545  1.1  christos 				  (void *) f);
    546  1.1  christos }
    547  1.1  christos 
    548  1.1  christos void
    549  1.1  christos observer_detach_breakpoint_created (struct observer *observer)
    550  1.1  christos {
    551  1.1  christos   generic_observer_detach (&breakpoint_created_subject, observer);
    552  1.1  christos }
    553  1.1  christos 
    554  1.1  christos void
    555  1.2       mrg observer_notify_breakpoint_created (struct breakpoint *b)
    556  1.1  christos {
    557  1.1  christos   struct breakpoint_created_args args;
    558  1.2       mrg   args.b = b;
    559  1.1  christos 
    560  1.1  christos   if (observer_debug)
    561  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_created() called\n");
    562  1.1  christos   generic_observer_notify (breakpoint_created_subject, &args);
    563  1.1  christos }
    564  1.1  christos 
    565  1.1  christos /* breakpoint_deleted notifications.  */
    566  1.1  christos 
    567  1.1  christos static struct observer_list *breakpoint_deleted_subject = NULL;
    568  1.1  christos 
    569  1.2       mrg struct breakpoint_deleted_args { struct breakpoint *b; };
    570  1.1  christos 
    571  1.1  christos static void
    572  1.1  christos observer_breakpoint_deleted_notification_stub (const void *data, const void *args_data)
    573  1.1  christos {
    574  1.1  christos   observer_breakpoint_deleted_ftype *notify = (observer_breakpoint_deleted_ftype *) data;
    575  1.1  christos   const struct breakpoint_deleted_args *args = args_data;
    576  1.2       mrg   notify (args->b);
    577  1.1  christos }
    578  1.1  christos 
    579  1.1  christos struct observer *
    580  1.1  christos observer_attach_breakpoint_deleted (observer_breakpoint_deleted_ftype *f)
    581  1.1  christos {
    582  1.1  christos   return generic_observer_attach (&breakpoint_deleted_subject,
    583  1.1  christos 				  &observer_breakpoint_deleted_notification_stub,
    584  1.1  christos 				  (void *) f);
    585  1.1  christos }
    586  1.1  christos 
    587  1.1  christos void
    588  1.1  christos observer_detach_breakpoint_deleted (struct observer *observer)
    589  1.1  christos {
    590  1.1  christos   generic_observer_detach (&breakpoint_deleted_subject, observer);
    591  1.1  christos }
    592  1.1  christos 
    593  1.1  christos void
    594  1.2       mrg observer_notify_breakpoint_deleted (struct breakpoint *b)
    595  1.1  christos {
    596  1.1  christos   struct breakpoint_deleted_args args;
    597  1.2       mrg   args.b = b;
    598  1.1  christos 
    599  1.1  christos   if (observer_debug)
    600  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_deleted() called\n");
    601  1.1  christos   generic_observer_notify (breakpoint_deleted_subject, &args);
    602  1.1  christos }
    603  1.1  christos 
    604  1.1  christos /* breakpoint_modified notifications.  */
    605  1.1  christos 
    606  1.1  christos static struct observer_list *breakpoint_modified_subject = NULL;
    607  1.1  christos 
    608  1.2       mrg struct breakpoint_modified_args { struct breakpoint *b; };
    609  1.1  christos 
    610  1.1  christos static void
    611  1.1  christos observer_breakpoint_modified_notification_stub (const void *data, const void *args_data)
    612  1.1  christos {
    613  1.1  christos   observer_breakpoint_modified_ftype *notify = (observer_breakpoint_modified_ftype *) data;
    614  1.1  christos   const struct breakpoint_modified_args *args = args_data;
    615  1.2       mrg   notify (args->b);
    616  1.1  christos }
    617  1.1  christos 
    618  1.1  christos struct observer *
    619  1.1  christos observer_attach_breakpoint_modified (observer_breakpoint_modified_ftype *f)
    620  1.1  christos {
    621  1.1  christos   return generic_observer_attach (&breakpoint_modified_subject,
    622  1.1  christos 				  &observer_breakpoint_modified_notification_stub,
    623  1.1  christos 				  (void *) f);
    624  1.1  christos }
    625  1.1  christos 
    626  1.1  christos void
    627  1.1  christos observer_detach_breakpoint_modified (struct observer *observer)
    628  1.1  christos {
    629  1.1  christos   generic_observer_detach (&breakpoint_modified_subject, observer);
    630  1.1  christos }
    631  1.1  christos 
    632  1.1  christos void
    633  1.2       mrg observer_notify_breakpoint_modified (struct breakpoint *b)
    634  1.1  christos {
    635  1.1  christos   struct breakpoint_modified_args args;
    636  1.2       mrg   args.b = b;
    637  1.1  christos 
    638  1.1  christos   if (observer_debug)
    639  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_breakpoint_modified() called\n");
    640  1.1  christos   generic_observer_notify (breakpoint_modified_subject, &args);
    641  1.1  christos }
    642  1.1  christos 
    643  1.2       mrg /* traceframe_changed notifications.  */
    644  1.1  christos 
    645  1.2       mrg static struct observer_list *traceframe_changed_subject = NULL;
    646  1.1  christos 
    647  1.2       mrg struct traceframe_changed_args { int tfnum; int tpnum; };
    648  1.1  christos 
    649  1.1  christos static void
    650  1.2       mrg observer_traceframe_changed_notification_stub (const void *data, const void *args_data)
    651  1.1  christos {
    652  1.2       mrg   observer_traceframe_changed_ftype *notify = (observer_traceframe_changed_ftype *) data;
    653  1.2       mrg   const struct traceframe_changed_args *args = args_data;
    654  1.2       mrg   notify (args->tfnum, args->tpnum);
    655  1.1  christos }
    656  1.1  christos 
    657  1.1  christos struct observer *
    658  1.2       mrg observer_attach_traceframe_changed (observer_traceframe_changed_ftype *f)
    659  1.1  christos {
    660  1.2       mrg   return generic_observer_attach (&traceframe_changed_subject,
    661  1.2       mrg 				  &observer_traceframe_changed_notification_stub,
    662  1.1  christos 				  (void *) f);
    663  1.1  christos }
    664  1.1  christos 
    665  1.1  christos void
    666  1.2       mrg observer_detach_traceframe_changed (struct observer *observer)
    667  1.1  christos {
    668  1.2       mrg   generic_observer_detach (&traceframe_changed_subject, observer);
    669  1.1  christos }
    670  1.1  christos 
    671  1.1  christos void
    672  1.2       mrg observer_notify_traceframe_changed (int tfnum, int tpnum)
    673  1.1  christos {
    674  1.2       mrg   struct traceframe_changed_args args;
    675  1.2       mrg   args.tfnum = tfnum, args.tpnum = tpnum;
    676  1.1  christos 
    677  1.1  christos   if (observer_debug)
    678  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_traceframe_changed() called\n");
    679  1.2       mrg   generic_observer_notify (traceframe_changed_subject, &args);
    680  1.1  christos }
    681  1.1  christos 
    682  1.1  christos /* architecture_changed notifications.  */
    683  1.1  christos 
    684  1.1  christos static struct observer_list *architecture_changed_subject = NULL;
    685  1.1  christos 
    686  1.1  christos struct architecture_changed_args { struct gdbarch *newarch; };
    687  1.1  christos 
    688  1.1  christos static void
    689  1.1  christos observer_architecture_changed_notification_stub (const void *data, const void *args_data)
    690  1.1  christos {
    691  1.1  christos   observer_architecture_changed_ftype *notify = (observer_architecture_changed_ftype *) data;
    692  1.1  christos   const struct architecture_changed_args *args = args_data;
    693  1.1  christos   notify (args->newarch);
    694  1.1  christos }
    695  1.1  christos 
    696  1.1  christos struct observer *
    697  1.1  christos observer_attach_architecture_changed (observer_architecture_changed_ftype *f)
    698  1.1  christos {
    699  1.1  christos   return generic_observer_attach (&architecture_changed_subject,
    700  1.1  christos 				  &observer_architecture_changed_notification_stub,
    701  1.1  christos 				  (void *) f);
    702  1.1  christos }
    703  1.1  christos 
    704  1.1  christos void
    705  1.1  christos observer_detach_architecture_changed (struct observer *observer)
    706  1.1  christos {
    707  1.1  christos   generic_observer_detach (&architecture_changed_subject, observer);
    708  1.1  christos }
    709  1.1  christos 
    710  1.1  christos void
    711  1.1  christos observer_notify_architecture_changed (struct gdbarch *newarch)
    712  1.1  christos {
    713  1.1  christos   struct architecture_changed_args args;
    714  1.1  christos   args.newarch = newarch;
    715  1.1  christos 
    716  1.1  christos   if (observer_debug)
    717  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_architecture_changed() called\n");
    718  1.1  christos   generic_observer_notify (architecture_changed_subject, &args);
    719  1.1  christos }
    720  1.1  christos 
    721  1.1  christos /* thread_ptid_changed notifications.  */
    722  1.1  christos 
    723  1.1  christos static struct observer_list *thread_ptid_changed_subject = NULL;
    724  1.1  christos 
    725  1.1  christos struct thread_ptid_changed_args { ptid_t old_ptid; ptid_t new_ptid; };
    726  1.1  christos 
    727  1.1  christos static void
    728  1.1  christos observer_thread_ptid_changed_notification_stub (const void *data, const void *args_data)
    729  1.1  christos {
    730  1.1  christos   observer_thread_ptid_changed_ftype *notify = (observer_thread_ptid_changed_ftype *) data;
    731  1.1  christos   const struct thread_ptid_changed_args *args = args_data;
    732  1.1  christos   notify (args->old_ptid, args->new_ptid);
    733  1.1  christos }
    734  1.1  christos 
    735  1.1  christos struct observer *
    736  1.1  christos observer_attach_thread_ptid_changed (observer_thread_ptid_changed_ftype *f)
    737  1.1  christos {
    738  1.1  christos   return generic_observer_attach (&thread_ptid_changed_subject,
    739  1.1  christos 				  &observer_thread_ptid_changed_notification_stub,
    740  1.1  christos 				  (void *) f);
    741  1.1  christos }
    742  1.1  christos 
    743  1.1  christos void
    744  1.1  christos observer_detach_thread_ptid_changed (struct observer *observer)
    745  1.1  christos {
    746  1.1  christos   generic_observer_detach (&thread_ptid_changed_subject, observer);
    747  1.1  christos }
    748  1.1  christos 
    749  1.1  christos void
    750  1.1  christos observer_notify_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid)
    751  1.1  christos {
    752  1.1  christos   struct thread_ptid_changed_args args;
    753  1.1  christos   args.old_ptid = old_ptid, args.new_ptid = new_ptid;
    754  1.1  christos 
    755  1.1  christos   if (observer_debug)
    756  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_thread_ptid_changed() called\n");
    757  1.1  christos   generic_observer_notify (thread_ptid_changed_subject, &args);
    758  1.1  christos }
    759  1.1  christos 
    760  1.1  christos /* inferior_added notifications.  */
    761  1.1  christos 
    762  1.1  christos static struct observer_list *inferior_added_subject = NULL;
    763  1.1  christos 
    764  1.1  christos struct inferior_added_args { struct inferior *inf; };
    765  1.1  christos 
    766  1.1  christos static void
    767  1.1  christos observer_inferior_added_notification_stub (const void *data, const void *args_data)
    768  1.1  christos {
    769  1.1  christos   observer_inferior_added_ftype *notify = (observer_inferior_added_ftype *) data;
    770  1.1  christos   const struct inferior_added_args *args = args_data;
    771  1.1  christos   notify (args->inf);
    772  1.1  christos }
    773  1.1  christos 
    774  1.1  christos struct observer *
    775  1.1  christos observer_attach_inferior_added (observer_inferior_added_ftype *f)
    776  1.1  christos {
    777  1.1  christos   return generic_observer_attach (&inferior_added_subject,
    778  1.1  christos 				  &observer_inferior_added_notification_stub,
    779  1.1  christos 				  (void *) f);
    780  1.1  christos }
    781  1.1  christos 
    782  1.1  christos void
    783  1.1  christos observer_detach_inferior_added (struct observer *observer)
    784  1.1  christos {
    785  1.1  christos   generic_observer_detach (&inferior_added_subject, observer);
    786  1.1  christos }
    787  1.1  christos 
    788  1.1  christos void
    789  1.1  christos observer_notify_inferior_added (struct inferior *inf)
    790  1.1  christos {
    791  1.1  christos   struct inferior_added_args args;
    792  1.1  christos   args.inf = inf;
    793  1.1  christos 
    794  1.1  christos   if (observer_debug)
    795  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_added() called\n");
    796  1.1  christos   generic_observer_notify (inferior_added_subject, &args);
    797  1.1  christos }
    798  1.1  christos 
    799  1.1  christos /* inferior_appeared notifications.  */
    800  1.1  christos 
    801  1.1  christos static struct observer_list *inferior_appeared_subject = NULL;
    802  1.1  christos 
    803  1.1  christos struct inferior_appeared_args { struct inferior *inf; };
    804  1.1  christos 
    805  1.1  christos static void
    806  1.1  christos observer_inferior_appeared_notification_stub (const void *data, const void *args_data)
    807  1.1  christos {
    808  1.1  christos   observer_inferior_appeared_ftype *notify = (observer_inferior_appeared_ftype *) data;
    809  1.1  christos   const struct inferior_appeared_args *args = args_data;
    810  1.1  christos   notify (args->inf);
    811  1.1  christos }
    812  1.1  christos 
    813  1.1  christos struct observer *
    814  1.1  christos observer_attach_inferior_appeared (observer_inferior_appeared_ftype *f)
    815  1.1  christos {
    816  1.1  christos   return generic_observer_attach (&inferior_appeared_subject,
    817  1.1  christos 				  &observer_inferior_appeared_notification_stub,
    818  1.1  christos 				  (void *) f);
    819  1.1  christos }
    820  1.1  christos 
    821  1.1  christos void
    822  1.1  christos observer_detach_inferior_appeared (struct observer *observer)
    823  1.1  christos {
    824  1.1  christos   generic_observer_detach (&inferior_appeared_subject, observer);
    825  1.1  christos }
    826  1.1  christos 
    827  1.1  christos void
    828  1.1  christos observer_notify_inferior_appeared (struct inferior *inf)
    829  1.1  christos {
    830  1.1  christos   struct inferior_appeared_args args;
    831  1.1  christos   args.inf = inf;
    832  1.1  christos 
    833  1.1  christos   if (observer_debug)
    834  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_appeared() called\n");
    835  1.1  christos   generic_observer_notify (inferior_appeared_subject, &args);
    836  1.1  christos }
    837  1.1  christos 
    838  1.1  christos /* inferior_exit notifications.  */
    839  1.1  christos 
    840  1.1  christos static struct observer_list *inferior_exit_subject = NULL;
    841  1.1  christos 
    842  1.1  christos struct inferior_exit_args { struct inferior *inf; };
    843  1.1  christos 
    844  1.1  christos static void
    845  1.1  christos observer_inferior_exit_notification_stub (const void *data, const void *args_data)
    846  1.1  christos {
    847  1.1  christos   observer_inferior_exit_ftype *notify = (observer_inferior_exit_ftype *) data;
    848  1.1  christos   const struct inferior_exit_args *args = args_data;
    849  1.1  christos   notify (args->inf);
    850  1.1  christos }
    851  1.1  christos 
    852  1.1  christos struct observer *
    853  1.1  christos observer_attach_inferior_exit (observer_inferior_exit_ftype *f)
    854  1.1  christos {
    855  1.1  christos   return generic_observer_attach (&inferior_exit_subject,
    856  1.1  christos 				  &observer_inferior_exit_notification_stub,
    857  1.1  christos 				  (void *) f);
    858  1.1  christos }
    859  1.1  christos 
    860  1.1  christos void
    861  1.1  christos observer_detach_inferior_exit (struct observer *observer)
    862  1.1  christos {
    863  1.1  christos   generic_observer_detach (&inferior_exit_subject, observer);
    864  1.1  christos }
    865  1.1  christos 
    866  1.1  christos void
    867  1.1  christos observer_notify_inferior_exit (struct inferior *inf)
    868  1.1  christos {
    869  1.1  christos   struct inferior_exit_args args;
    870  1.1  christos   args.inf = inf;
    871  1.1  christos 
    872  1.1  christos   if (observer_debug)
    873  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_exit() called\n");
    874  1.1  christos   generic_observer_notify (inferior_exit_subject, &args);
    875  1.1  christos }
    876  1.1  christos 
    877  1.1  christos /* inferior_removed notifications.  */
    878  1.1  christos 
    879  1.1  christos static struct observer_list *inferior_removed_subject = NULL;
    880  1.1  christos 
    881  1.1  christos struct inferior_removed_args { struct inferior *inf; };
    882  1.1  christos 
    883  1.1  christos static void
    884  1.1  christos observer_inferior_removed_notification_stub (const void *data, const void *args_data)
    885  1.1  christos {
    886  1.1  christos   observer_inferior_removed_ftype *notify = (observer_inferior_removed_ftype *) data;
    887  1.1  christos   const struct inferior_removed_args *args = args_data;
    888  1.1  christos   notify (args->inf);
    889  1.1  christos }
    890  1.1  christos 
    891  1.1  christos struct observer *
    892  1.1  christos observer_attach_inferior_removed (observer_inferior_removed_ftype *f)
    893  1.1  christos {
    894  1.1  christos   return generic_observer_attach (&inferior_removed_subject,
    895  1.1  christos 				  &observer_inferior_removed_notification_stub,
    896  1.1  christos 				  (void *) f);
    897  1.1  christos }
    898  1.1  christos 
    899  1.1  christos void
    900  1.1  christos observer_detach_inferior_removed (struct observer *observer)
    901  1.1  christos {
    902  1.1  christos   generic_observer_detach (&inferior_removed_subject, observer);
    903  1.1  christos }
    904  1.1  christos 
    905  1.1  christos void
    906  1.1  christos observer_notify_inferior_removed (struct inferior *inf)
    907  1.1  christos {
    908  1.1  christos   struct inferior_removed_args args;
    909  1.1  christos   args.inf = inf;
    910  1.1  christos 
    911  1.1  christos   if (observer_debug)
    912  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_inferior_removed() called\n");
    913  1.1  christos   generic_observer_notify (inferior_removed_subject, &args);
    914  1.1  christos }
    915  1.1  christos 
    916  1.1  christos /* memory_changed notifications.  */
    917  1.1  christos 
    918  1.1  christos static struct observer_list *memory_changed_subject = NULL;
    919  1.1  christos 
    920  1.2       mrg struct memory_changed_args { struct inferior *inferior; CORE_ADDR addr; ssize_t len; const bfd_byte *data; };
    921  1.1  christos 
    922  1.1  christos static void
    923  1.1  christos observer_memory_changed_notification_stub (const void *data, const void *args_data)
    924  1.1  christos {
    925  1.1  christos   observer_memory_changed_ftype *notify = (observer_memory_changed_ftype *) data;
    926  1.1  christos   const struct memory_changed_args *args = args_data;
    927  1.2       mrg   notify (args->inferior, args->addr, args->len, args->data);
    928  1.1  christos }
    929  1.1  christos 
    930  1.1  christos struct observer *
    931  1.1  christos observer_attach_memory_changed (observer_memory_changed_ftype *f)
    932  1.1  christos {
    933  1.1  christos   return generic_observer_attach (&memory_changed_subject,
    934  1.1  christos 				  &observer_memory_changed_notification_stub,
    935  1.1  christos 				  (void *) f);
    936  1.1  christos }
    937  1.1  christos 
    938  1.1  christos void
    939  1.1  christos observer_detach_memory_changed (struct observer *observer)
    940  1.1  christos {
    941  1.1  christos   generic_observer_detach (&memory_changed_subject, observer);
    942  1.1  christos }
    943  1.1  christos 
    944  1.1  christos void
    945  1.2       mrg observer_notify_memory_changed (struct inferior *inferior, CORE_ADDR addr, ssize_t len, const bfd_byte *data)
    946  1.1  christos {
    947  1.1  christos   struct memory_changed_args args;
    948  1.2       mrg   args.inferior = inferior, args.addr = addr, args.len = len, args.data = data;
    949  1.1  christos 
    950  1.1  christos   if (observer_debug)
    951  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_memory_changed() called\n");
    952  1.1  christos   generic_observer_notify (memory_changed_subject, &args);
    953  1.1  christos }
    954  1.1  christos 
    955  1.2       mrg /* before_prompt notifications.  */
    956  1.2       mrg 
    957  1.2       mrg static struct observer_list *before_prompt_subject = NULL;
    958  1.2       mrg 
    959  1.2       mrg struct before_prompt_args { const char *current_prompt; };
    960  1.2       mrg 
    961  1.2       mrg static void
    962  1.2       mrg observer_before_prompt_notification_stub (const void *data, const void *args_data)
    963  1.2       mrg {
    964  1.2       mrg   observer_before_prompt_ftype *notify = (observer_before_prompt_ftype *) data;
    965  1.2       mrg   const struct before_prompt_args *args = args_data;
    966  1.2       mrg   notify (args->current_prompt);
    967  1.2       mrg }
    968  1.2       mrg 
    969  1.2       mrg struct observer *
    970  1.2       mrg observer_attach_before_prompt (observer_before_prompt_ftype *f)
    971  1.2       mrg {
    972  1.2       mrg   return generic_observer_attach (&before_prompt_subject,
    973  1.2       mrg 				  &observer_before_prompt_notification_stub,
    974  1.2       mrg 				  (void *) f);
    975  1.2       mrg }
    976  1.2       mrg 
    977  1.2       mrg void
    978  1.2       mrg observer_detach_before_prompt (struct observer *observer)
    979  1.2       mrg {
    980  1.2       mrg   generic_observer_detach (&before_prompt_subject, observer);
    981  1.2       mrg }
    982  1.2       mrg 
    983  1.2       mrg void
    984  1.2       mrg observer_notify_before_prompt (const char *current_prompt)
    985  1.2       mrg {
    986  1.2       mrg   struct before_prompt_args args;
    987  1.2       mrg   args.current_prompt = current_prompt;
    988  1.2       mrg 
    989  1.2       mrg   if (observer_debug)
    990  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_before_prompt() called\n");
    991  1.2       mrg   generic_observer_notify (before_prompt_subject, &args);
    992  1.2       mrg }
    993  1.2       mrg 
    994  1.2       mrg /* gdb_datadir_changed notifications.  */
    995  1.2       mrg 
    996  1.2       mrg static struct observer_list *gdb_datadir_changed_subject = NULL;
    997  1.2       mrg 
    998  1.2       mrg static void
    999  1.2       mrg observer_gdb_datadir_changed_notification_stub (const void *data, const void *args_data)
   1000  1.2       mrg {
   1001  1.2       mrg   observer_gdb_datadir_changed_ftype *notify = (observer_gdb_datadir_changed_ftype *) data;
   1002  1.2       mrg   notify ();
   1003  1.2       mrg }
   1004  1.2       mrg 
   1005  1.2       mrg struct observer *
   1006  1.2       mrg observer_attach_gdb_datadir_changed (observer_gdb_datadir_changed_ftype *f)
   1007  1.2       mrg {
   1008  1.2       mrg   return generic_observer_attach (&gdb_datadir_changed_subject,
   1009  1.2       mrg 				  &observer_gdb_datadir_changed_notification_stub,
   1010  1.2       mrg 				  (void *) f);
   1011  1.2       mrg }
   1012  1.2       mrg 
   1013  1.2       mrg void
   1014  1.2       mrg observer_detach_gdb_datadir_changed (struct observer *observer)
   1015  1.2       mrg {
   1016  1.2       mrg   generic_observer_detach (&gdb_datadir_changed_subject, observer);
   1017  1.2       mrg }
   1018  1.2       mrg 
   1019  1.2       mrg void
   1020  1.2       mrg observer_notify_gdb_datadir_changed (void)
   1021  1.2       mrg {
   1022  1.2       mrg char *args = NULL;
   1023  1.2       mrg   if (observer_debug)
   1024  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_gdb_datadir_changed() called\n");
   1025  1.2       mrg   generic_observer_notify (gdb_datadir_changed_subject, &args);
   1026  1.2       mrg }
   1027  1.2       mrg 
   1028  1.2       mrg /* command_param_changed notifications.  */
   1029  1.2       mrg 
   1030  1.2       mrg static struct observer_list *command_param_changed_subject = NULL;
   1031  1.2       mrg 
   1032  1.2       mrg struct command_param_changed_args { const char *param; const char *value; };
   1033  1.2       mrg 
   1034  1.2       mrg static void
   1035  1.2       mrg observer_command_param_changed_notification_stub (const void *data, const void *args_data)
   1036  1.2       mrg {
   1037  1.2       mrg   observer_command_param_changed_ftype *notify = (observer_command_param_changed_ftype *) data;
   1038  1.2       mrg   const struct command_param_changed_args *args = args_data;
   1039  1.2       mrg   notify (args->param, args->value);
   1040  1.2       mrg }
   1041  1.2       mrg 
   1042  1.2       mrg struct observer *
   1043  1.2       mrg observer_attach_command_param_changed (observer_command_param_changed_ftype *f)
   1044  1.2       mrg {
   1045  1.2       mrg   return generic_observer_attach (&command_param_changed_subject,
   1046  1.2       mrg 				  &observer_command_param_changed_notification_stub,
   1047  1.2       mrg 				  (void *) f);
   1048  1.2       mrg }
   1049  1.2       mrg 
   1050  1.2       mrg void
   1051  1.2       mrg observer_detach_command_param_changed (struct observer *observer)
   1052  1.2       mrg {
   1053  1.2       mrg   generic_observer_detach (&command_param_changed_subject, observer);
   1054  1.2       mrg }
   1055  1.2       mrg 
   1056  1.2       mrg void
   1057  1.2       mrg observer_notify_command_param_changed (const char *param, const char *value)
   1058  1.2       mrg {
   1059  1.2       mrg   struct command_param_changed_args args;
   1060  1.2       mrg   args.param = param, args.value = value;
   1061  1.2       mrg 
   1062  1.2       mrg   if (observer_debug)
   1063  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_command_param_changed() called\n");
   1064  1.2       mrg   generic_observer_notify (command_param_changed_subject, &args);
   1065  1.2       mrg }
   1066  1.2       mrg 
   1067  1.2       mrg /* tsv_created notifications.  */
   1068  1.2       mrg 
   1069  1.2       mrg static struct observer_list *tsv_created_subject = NULL;
   1070  1.2       mrg 
   1071  1.2       mrg struct tsv_created_args { const struct trace_state_variable *tsv; };
   1072  1.2       mrg 
   1073  1.2       mrg static void
   1074  1.2       mrg observer_tsv_created_notification_stub (const void *data, const void *args_data)
   1075  1.2       mrg {
   1076  1.2       mrg   observer_tsv_created_ftype *notify = (observer_tsv_created_ftype *) data;
   1077  1.2       mrg   const struct tsv_created_args *args = args_data;
   1078  1.2       mrg   notify (args->tsv);
   1079  1.2       mrg }
   1080  1.2       mrg 
   1081  1.2       mrg struct observer *
   1082  1.2       mrg observer_attach_tsv_created (observer_tsv_created_ftype *f)
   1083  1.2       mrg {
   1084  1.2       mrg   return generic_observer_attach (&tsv_created_subject,
   1085  1.2       mrg 				  &observer_tsv_created_notification_stub,
   1086  1.2       mrg 				  (void *) f);
   1087  1.2       mrg }
   1088  1.2       mrg 
   1089  1.2       mrg void
   1090  1.2       mrg observer_detach_tsv_created (struct observer *observer)
   1091  1.2       mrg {
   1092  1.2       mrg   generic_observer_detach (&tsv_created_subject, observer);
   1093  1.2       mrg }
   1094  1.2       mrg 
   1095  1.2       mrg void
   1096  1.2       mrg observer_notify_tsv_created (const struct trace_state_variable *tsv)
   1097  1.2       mrg {
   1098  1.2       mrg   struct tsv_created_args args;
   1099  1.2       mrg   args.tsv = tsv;
   1100  1.2       mrg 
   1101  1.2       mrg   if (observer_debug)
   1102  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_created() called\n");
   1103  1.2       mrg   generic_observer_notify (tsv_created_subject, &args);
   1104  1.2       mrg }
   1105  1.2       mrg 
   1106  1.2       mrg /* tsv_deleted notifications.  */
   1107  1.2       mrg 
   1108  1.2       mrg static struct observer_list *tsv_deleted_subject = NULL;
   1109  1.2       mrg 
   1110  1.2       mrg struct tsv_deleted_args { const struct trace_state_variable *tsv; };
   1111  1.2       mrg 
   1112  1.2       mrg static void
   1113  1.2       mrg observer_tsv_deleted_notification_stub (const void *data, const void *args_data)
   1114  1.2       mrg {
   1115  1.2       mrg   observer_tsv_deleted_ftype *notify = (observer_tsv_deleted_ftype *) data;
   1116  1.2       mrg   const struct tsv_deleted_args *args = args_data;
   1117  1.2       mrg   notify (args->tsv);
   1118  1.2       mrg }
   1119  1.2       mrg 
   1120  1.2       mrg struct observer *
   1121  1.2       mrg observer_attach_tsv_deleted (observer_tsv_deleted_ftype *f)
   1122  1.2       mrg {
   1123  1.2       mrg   return generic_observer_attach (&tsv_deleted_subject,
   1124  1.2       mrg 				  &observer_tsv_deleted_notification_stub,
   1125  1.2       mrg 				  (void *) f);
   1126  1.2       mrg }
   1127  1.2       mrg 
   1128  1.2       mrg void
   1129  1.2       mrg observer_detach_tsv_deleted (struct observer *observer)
   1130  1.2       mrg {
   1131  1.2       mrg   generic_observer_detach (&tsv_deleted_subject, observer);
   1132  1.2       mrg }
   1133  1.2       mrg 
   1134  1.2       mrg void
   1135  1.2       mrg observer_notify_tsv_deleted (const struct trace_state_variable *tsv)
   1136  1.2       mrg {
   1137  1.2       mrg   struct tsv_deleted_args args;
   1138  1.2       mrg   args.tsv = tsv;
   1139  1.2       mrg 
   1140  1.2       mrg   if (observer_debug)
   1141  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_deleted() called\n");
   1142  1.2       mrg   generic_observer_notify (tsv_deleted_subject, &args);
   1143  1.2       mrg }
   1144  1.2       mrg 
   1145  1.2       mrg /* tsv_modified notifications.  */
   1146  1.2       mrg 
   1147  1.2       mrg static struct observer_list *tsv_modified_subject = NULL;
   1148  1.2       mrg 
   1149  1.2       mrg struct tsv_modified_args { const struct trace_state_variable *tsv; };
   1150  1.2       mrg 
   1151  1.2       mrg static void
   1152  1.2       mrg observer_tsv_modified_notification_stub (const void *data, const void *args_data)
   1153  1.2       mrg {
   1154  1.2       mrg   observer_tsv_modified_ftype *notify = (observer_tsv_modified_ftype *) data;
   1155  1.2       mrg   const struct tsv_modified_args *args = args_data;
   1156  1.2       mrg   notify (args->tsv);
   1157  1.2       mrg }
   1158  1.2       mrg 
   1159  1.2       mrg struct observer *
   1160  1.2       mrg observer_attach_tsv_modified (observer_tsv_modified_ftype *f)
   1161  1.2       mrg {
   1162  1.2       mrg   return generic_observer_attach (&tsv_modified_subject,
   1163  1.2       mrg 				  &observer_tsv_modified_notification_stub,
   1164  1.2       mrg 				  (void *) f);
   1165  1.2       mrg }
   1166  1.2       mrg 
   1167  1.2       mrg void
   1168  1.2       mrg observer_detach_tsv_modified (struct observer *observer)
   1169  1.2       mrg {
   1170  1.2       mrg   generic_observer_detach (&tsv_modified_subject, observer);
   1171  1.2       mrg }
   1172  1.2       mrg 
   1173  1.2       mrg void
   1174  1.2       mrg observer_notify_tsv_modified (const struct trace_state_variable *tsv)
   1175  1.2       mrg {
   1176  1.2       mrg   struct tsv_modified_args args;
   1177  1.2       mrg   args.tsv = tsv;
   1178  1.2       mrg 
   1179  1.2       mrg   if (observer_debug)
   1180  1.2       mrg     fprintf_unfiltered (gdb_stdlog, "observer_notify_tsv_modified() called\n");
   1181  1.2       mrg   generic_observer_notify (tsv_modified_subject, &args);
   1182  1.2       mrg }
   1183  1.2       mrg 
   1184  1.1  christos /* test_notification notifications.  */
   1185  1.1  christos 
   1186  1.1  christos static struct observer_list *test_notification_subject = NULL;
   1187  1.1  christos 
   1188  1.1  christos struct test_notification_args { int somearg; };
   1189  1.1  christos 
   1190  1.1  christos static void
   1191  1.1  christos observer_test_notification_notification_stub (const void *data, const void *args_data)
   1192  1.1  christos {
   1193  1.1  christos   observer_test_notification_ftype *notify = (observer_test_notification_ftype *) data;
   1194  1.1  christos   const struct test_notification_args *args = args_data;
   1195  1.1  christos   notify (args->somearg);
   1196  1.1  christos }
   1197  1.1  christos 
   1198  1.1  christos struct observer *
   1199  1.1  christos observer_attach_test_notification (observer_test_notification_ftype *f)
   1200  1.1  christos {
   1201  1.1  christos   return generic_observer_attach (&test_notification_subject,
   1202  1.1  christos 				  &observer_test_notification_notification_stub,
   1203  1.1  christos 				  (void *) f);
   1204  1.1  christos }
   1205  1.1  christos 
   1206  1.1  christos void
   1207  1.1  christos observer_detach_test_notification (struct observer *observer)
   1208  1.1  christos {
   1209  1.1  christos   generic_observer_detach (&test_notification_subject, observer);
   1210  1.1  christos }
   1211  1.1  christos 
   1212  1.1  christos void
   1213  1.1  christos observer_notify_test_notification (int somearg)
   1214  1.1  christos {
   1215  1.1  christos   struct test_notification_args args;
   1216  1.1  christos   args.somearg = somearg;
   1217  1.1  christos 
   1218  1.1  christos   if (observer_debug)
   1219  1.1  christos     fprintf_unfiltered (gdb_stdlog, "observer_notify_test_notification() called\n");
   1220  1.1  christos   generic_observer_notify (test_notification_subject, &args);
   1221  1.1  christos }
   1222