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