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