aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-07-25 16:12:03 +0000
committerTom Tromey <tromey@redhat.com>2008-07-25 16:12:03 +0000
commit383f836e2002b1bc1793238ed099ed7aa215fec3 (patch)
treedfac517ac150fd2c7eb853e204f405d4bd6f5362 /gdb
parent2a00e4fb8e170de97cb80a0140ba4d42a8ffd42f (diff)
downloadgdb-383f836e2002b1bc1793238ed099ed7aa215fec3.zip
gdb-383f836e2002b1bc1793238ed099ed7aa215fec3.tar.gz
gdb-383f836e2002b1bc1793238ed099ed7aa215fec3.tar.bz2
gdb:
* tui/tui-hooks.c: Include observer.h. (tui_event_default, tui_old_event_hooks, tui_event_hooks): Remove. (tui_bp_created_observer, tui_bp_deleted_observer, tui_bp_modified_observer): New globals. (tui_install_hooks): Use observers, not events. (tui_remove_hooks): Likewise. * mi/mi-cmd-break.c: Include observer.h, not gdb-events.h. (mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New globals. (breakpoint_notify): Check mi_can_breakpoint_notify. (breakpoint_hooks): Remove. (mi_cmd_break_insert): Attach observers. Don't use events. * tracepoint.c: Include observer.h, not gdb-events.h. (tracepoint_operation, trace_pass_command): Notify observer. * interps.c: Don't include gdb-events.h. (clear_interpreter_hooks): Don't call clear_gdb_event_hooks. * gdbarch.c: Rebuild. * gdbarch.sh: Emit include for observer.h, not gdb-events.h. (deprecated_current_gdbarch_select_hack): Notify observer. * breakpoint.h: Don't include gdb-events.h. * breakpoint.c: Don't include gdb-events.h. (condition_command): Notify observer. (commands_command): Likewise. (commands_from_control_command): Likewise. (mention, delete_breakpoint, set_ignore_count): Likewise. (disable_breakpoint, do_enable_breakpoint): Likewise. * Makefile.in (gdb_events_h): Remove. (breakpoint_h): Update. (COMMON_OBS): Remove gdb-events.o. (gdb-events.o): Remove. (breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o, gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update. * gdb-events.c: Remove. * gdb-events.h: Remove. * gdb-events.sh: Remove. gdb/doc: * observer.texi (GDB Observers): Document new observers: breakpoint_created, breakpoint_deleted, breakpoint_modified, tracepoint_created, tracepoint_deleted, tracepoint_modified, architecture_changed. gdb/gdbtk: * generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h. (gdbtk_add_hooks): Use observers, not events. (gdbtk_architecture_changed): Add argument, for observer. * generic/gdbtk-bp.c: Include observer.h. (gdb_set_bp): Notify observer. (gdb_set_bp_addr): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog39
-rw-r--r--gdb/Makefile.in23
-rw-r--r--gdb/breakpoint.c17
-rw-r--r--gdb/breakpoint.h2
-rw-r--r--gdb/doc/ChangeLog7
-rw-r--r--gdb/doc/observer.texi38
-rw-r--r--gdb/gdb-events.c349
-rw-r--r--gdb/gdb-events.h94
-rwxr-xr-xgdb/gdb-events.sh509
-rw-r--r--gdb/gdbarch.c4
-rwxr-xr-xgdb/gdbarch.sh4
-rw-r--r--gdb/interps.c2
-rw-r--r--gdb/mi/mi-cmd-break.c36
-rw-r--r--gdb/tracepoint.c10
-rw-r--r--gdb/tui/tui-hooks.c39
15 files changed, 150 insertions, 1023 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 735d58c..cd87ce9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,42 @@
+2008-07-25 Tom Tromey <tromey@redhat.com>
+
+ * tui/tui-hooks.c: Include observer.h.
+ (tui_event_default, tui_old_event_hooks, tui_event_hooks):
+ Remove.
+ (tui_bp_created_observer, tui_bp_deleted_observer,
+ tui_bp_modified_observer): New globals.
+ (tui_install_hooks): Use observers, not events.
+ (tui_remove_hooks): Likewise.
+ * mi/mi-cmd-break.c: Include observer.h, not gdb-events.h.
+ (mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New
+ globals.
+ (breakpoint_notify): Check mi_can_breakpoint_notify.
+ (breakpoint_hooks): Remove.
+ (mi_cmd_break_insert): Attach observers. Don't use events.
+ * tracepoint.c: Include observer.h, not gdb-events.h.
+ (tracepoint_operation, trace_pass_command): Notify observer.
+ * interps.c: Don't include gdb-events.h.
+ (clear_interpreter_hooks): Don't call clear_gdb_event_hooks.
+ * gdbarch.c: Rebuild.
+ * gdbarch.sh: Emit include for observer.h, not gdb-events.h.
+ (deprecated_current_gdbarch_select_hack): Notify observer.
+ * breakpoint.h: Don't include gdb-events.h.
+ * breakpoint.c: Don't include gdb-events.h.
+ (condition_command): Notify observer.
+ (commands_command): Likewise.
+ (commands_from_control_command): Likewise.
+ (mention, delete_breakpoint, set_ignore_count): Likewise.
+ (disable_breakpoint, do_enable_breakpoint): Likewise.
+ * Makefile.in (gdb_events_h): Remove.
+ (breakpoint_h): Update.
+ (COMMON_OBS): Remove gdb-events.o.
+ (gdb-events.o): Remove.
+ (breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o,
+ gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update.
+ * gdb-events.c: Remove.
+ * gdb-events.h: Remove.
+ * gdb-events.sh: Remove.
+
2008-07-24 Pedro Alves <pedro@codesourcery.com>
* remote.c (remote_threads_extra_info): Don't query the remote
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index e2397df..312a8df 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -742,7 +742,7 @@ ax_h = ax.h $(doublest_h)
bcache_h = bcache.h
bfd_target_h = bfd-target.h
block_h = block.h
-breakpoint_h = breakpoint.h $(frame_h) $(value_h) $(gdb_events_h) $(vec_h)
+breakpoint_h = breakpoint.h $(frame_h) $(value_h) $(vec_h)
bsd_kvm_h = bsd-kvm.h
bsd_uthread_h = bsd-uthread.h
buildsym_h = buildsym.h
@@ -787,7 +787,6 @@ gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_h)
gdbcore_h = gdbcore.h $(bfd_h)
gdb_curses_h = gdb_curses.h
gdb_dirent_h = gdb_dirent.h
-gdb_events_h = gdb-events.h
gdb_h = gdb.h
gdb_expat_h = gdb_expat.h
gdb_locale_h = gdb_locale.h
@@ -1062,7 +1061,6 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
findcmd.o \
std-regs.o \
signals.o \
- gdb-events.o \
exec.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o \
dbxread.o coffread.o coff-pe-read.o \
dwarf2read.o mipsread.o stabsread.o corefile.o \
@@ -1972,7 +1970,7 @@ breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \
$(gdb_string_h) $(demangle_h) $(annotate_h) $(symfile_h) \
$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solib_h) \
- $(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h) \
+ $(solist_h) $(observer_h) $(exceptions_h) \
$(mi_common_h) $(memattr_h) $(ada_lang_h) $(top_h) $(hashtab_h)
bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \
$(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \
@@ -2167,9 +2165,8 @@ gcore.o: gcore.c $(defs_h) $(elf_bfd_h) $(infcall_h) $(inferior_h) \
$(gdb_assert_h)
gdbarch.o: gdbarch.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) $(inferior_h) \
$(symcat_h) $(floatformat_h) $(gdb_assert_h) $(gdb_string_h) \
- $(gdb_events_h) $(reggroups_h) $(osabi_h) $(gdb_obstack_h)
+ $(reggroups_h) $(osabi_h) $(gdb_obstack_h) $(observer_h)
gdb.o: gdb.c $(defs_h) $(main_h) $(gdb_string_h) $(interps_h)
-gdb-events.o: gdb-events.c $(defs_h) $(gdb_events_h) $(gdbcmd_h)
gdbtypes.o: gdbtypes.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(expression_h) \
$(language_h) $(target_h) $(value_h) $(demangle_h) $(complaints_h) \
@@ -2341,7 +2338,7 @@ inf-ttrace.o: inf-ttrace.c $(defs_h) $(command_h) $(gdbcore_h) \
$(gdb_assert_h) $(gdb_string_h) $(inf_child_h) $(inf_ttrace_h)
interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
$(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
- $(gdb_events_h) $(gdb_assert_h) $(top_h) $(exceptions_h)
+ $(gdb_assert_h) $(top_h) $(exceptions_h)
iq2000-tdep.o: iq2000-tdep.c $(defs_h) $(frame_h) $(frame_base_h) \
$(frame_unwind_h) $(dwarf2_frame_h) $(gdbtypes_h) $(value_h) \
$(dis_asm_h) $(gdb_string_h) $(arch_utils_h) $(regcache_h) \
@@ -2933,9 +2930,9 @@ top.o: top.c $(defs_h) $(gdbcmd_h) $(call_cmds_h) $(cli_cmds_h) \
tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(gdbtypes_h) \
$(expression_h) $(gdbcmd_h) $(value_h) $(target_h) $(language_h) \
$(gdb_string_h) $(inferior_h) $(tracepoint_h) $(remote_h) \
- $(linespec_h) $(regcache_h) $(completer_h) $(gdb_events_h) \
+ $(linespec_h) $(regcache_h) $(completer_h) \
$(block_h) $(dictionary_h) $(ax_h) $(ax_gdb_h) $(readline_h) \
- $(readline_history_h)
+ $(readline_history_h) $(observer_h)
trad-frame.o: trad-frame.c $(defs_h) $(frame_h) $(trad_frame_h) \
$(regcache_h) $(frame_unwind_h) $(value_h)
tramp-frame.o: tramp-frame.c $(defs_h) $(tramp_frame_h) $(frame_unwind_h) \
@@ -3151,7 +3148,7 @@ gdbtk-bp.o: $(srcdir)/gdbtk/generic/gdbtk-bp.c \
$(srcdir)/gdbtk/generic/gdbtk.h \
$(srcdir)/gdbtk/generic/gdbtk-cmds.h \
$(defs_h) $(breakpoint_h) $(tracepoint_h) \
- $(symfile_h) $(symtab_h) $(gdb_string_h)
+ $(symfile_h) $(symtab_h) $(gdb_string_h) $(observer_h)
$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \
$(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-bp.c \
@@ -3172,7 +3169,7 @@ gdbtk-hooks.o: $(srcdir)/gdbtk/generic/gdbtk-hooks.c \
$(srcdir)/gdbtk/generic/gdbtk.h $(defs_h) \
$(symtab_h) $(inferior_h) $(command_h) \
$(bfd_h) $(symfile_h) $(objfiles_h) $(target_h) $(gdb_string_h) \
- $(tracepoint_h)
+ $(tracepoint_h) $(observer_h)
$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\
$(srcdir)/gdbtk/generic/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\"
@@ -3232,7 +3229,7 @@ gdbtk-wrapper.o: $(srcdir)/gdbtk/generic/gdbtk-wrapper.c \
mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \
$(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
- $(mi_getopt_h) $(gdb_events_h) $(gdb_h)
+ $(mi_getopt_h) $(gdb_h) $(observer_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c
mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \
$(mi_cmds_h) $(mi_getopt_h) $(gdb_string_h) $(ui_out_h) $(disasm_h)
@@ -3326,7 +3323,7 @@ tui-file.o: $(srcdir)/tui/tui-file.c $(defs_h) $(ui_file_h) $(tui_file_h) \
tui-hooks.o: $(srcdir)/tui/tui-hooks.c $(defs_h) $(symtab_h) $(inferior_h) \
$(command_h) $(bfd_h) $(symfile_h) $(objfiles_h) $(target_h) \
$(gdbcore_h) $(event_loop_h) $(event_top_h) $(frame_h) \
- $(breakpoint_h) $(gdb_events_h) $(ui_out_h) $(top_h) $(observer_h) \
+ $(breakpoint_h) $(ui_out_h) $(top_h) $(observer_h) \
$(tui_h) $(tui_hooks_h) $(tui_data_h) $(tui_layout_h) $(tui_io_h) \
$(tui_regs_h) $(tui_win_h) $(tui_stack_h) $(tui_windata_h) \
$(tui_winsource_h) $(gdb_curses_h) $(readline_h)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 463da57..3324f20 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -57,7 +57,6 @@
#include "top.h"
#include "wrapper.h"
-#include "gdb-events.h"
#include "mi/mi-common.h"
/* Prototypes for local functions. */
@@ -619,7 +618,7 @@ condition_command (char *arg, int from_tty)
}
}
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return;
}
@@ -658,7 +657,7 @@ commands_command (char *arg, int from_tty)
free_command_lines (&b->commands);
b->commands = l;
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return;
}
error (_("No breakpoint number %d."), bnum);
@@ -704,7 +703,7 @@ commands_from_control_command (char *arg, struct command_line *cmd)
list after it finishes execution. */
b->commands = copy_command_lines (cmd->body_list[0]);
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return simple_control;
}
error (_("No breakpoint number %d."), bnum);
@@ -4895,7 +4894,7 @@ mention (struct breakpoint *b)
been done for deprecated_delete_breakpoint_hook and so on. */
if (deprecated_create_breakpoint_hook)
deprecated_create_breakpoint_hook (b);
- breakpoint_create_event (b->number);
+ observer_notify_breakpoint_created (b->number);
if (b->ops != NULL && b->ops->print_mention != NULL)
b->ops->print_mention (b);
@@ -7216,7 +7215,7 @@ delete_breakpoint (struct breakpoint *bpt)
if (deprecated_delete_breakpoint_hook)
deprecated_delete_breakpoint_hook (bpt);
- breakpoint_delete_event (bpt->number);
+ observer_notify_breakpoint_deleted (bpt->number);
if (breakpoint_chain == bpt)
breakpoint_chain = bpt->next;
@@ -7721,7 +7720,7 @@ set_ignore_count (int bptnum, int count, int from_tty)
count, bptnum);
}
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return;
}
@@ -7871,7 +7870,7 @@ disable_breakpoint (struct breakpoint *bpt)
if (deprecated_modify_breakpoint_hook)
deprecated_modify_breakpoint_hook (bpt);
- breakpoint_modify_event (bpt->number);
+ observer_notify_breakpoint_modified (bpt->number);
}
static void
@@ -7996,7 +7995,7 @@ have been allocated for other watchpoints.\n"), bpt->number);
if (deprecated_modify_breakpoint_hook)
deprecated_modify_breakpoint_hook (bpt);
- breakpoint_modify_event (bpt->number);
+ observer_notify_breakpoint_modified (bpt->number);
}
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 3223857..a5358db 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -24,8 +24,6 @@
#include "value.h"
#include "vec.h"
-#include "gdb-events.h"
-
struct value;
struct block;
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 7d1efb2..d5917c6 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,10 @@
+2008-07-25 Tom Tromey <tromey@redhat.com>
+
+ * observer.texi (GDB Observers): Document new observers:
+ breakpoint_created, breakpoint_deleted, breakpoint_modified,
+ tracepoint_created, tracepoint_deleted, tracepoint_modified,
+ architecture_changed.
+
2008-07-21 Stan Shebs <stan@codesourcery.com>
* gdbint.texinfo: Refer to target_so_ops.in_dynsym_resolve_code
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 572f237..8d1db14 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -2,7 +2,7 @@
@c This file is part of the GDB manual.
@c
-@c Copyright (C) 2003, 2004, 2005, 2006
+@c Copyright (C) 2003, 2004, 2005, 2006, 2008
@c Free Software Foundation, Inc.
@c
@c See the file gdbint.texinfo for copying conditions.
@@ -139,3 +139,39 @@ The thread specified by @var{t} has exited.
The target was resumed. The @var{ptid} parameter specifies which
thread was resume, and may be RESUME_ALL if all threads are resumed.
@end deftypefun
+
+@deftypefun void breakpoint_created (int @var{bpnum})
+A new breakpoint has been created. The argument @var{bpnum} is the
+number of the newly-created breakpoint.
+@end deftypefun
+
+@deftypefun void breakpoint_deleted (int @var{bpnum})
+A breakpoint has been destroyed. The argument @var{bpnum} is the
+number of the newly-destroyed breakpoint.
+@end deftypefun
+
+@deftypefun void breakpoint_modified (int @var{bpnum})
+A breakpoint has been modified in some way. The argument @var{bpnum}
+is the number of the modified breakpoint.
+@end deftypefun
+
+@deftypefun void tracepoint_created (int @var{tpnum})
+A new tracepoint has been created. The argument @var{tpnum} is the
+number of the newly-created tracepoint.
+@end deftypefun
+
+@deftypefun void tracepoint_deleted (int @var{tpnum})
+A tracepoint has been destroyed. The argument @var{tpnum} is the
+number of the newly-destroyed tracepoint.
+@end deftypefun
+
+@deftypefun void tracepoint_modified (int @var{tpnum})
+A tracepoint has been modified in some way. The argument @var{tpnum}
+is the number of the modified tracepoint.
+@end deftypefun
+
+@deftypefun void architecture_changed (struct gdbarch *@var{newarch})
+The current architecture has changed. The argument @var{newarch} is
+a pointer to the new architecture.
+@end deftypefun
+
diff --git a/gdb/gdb-events.c b/gdb/gdb-events.c
deleted file mode 100644
index d688475..0000000
--- a/gdb/gdb-events.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* User Interface Events.
-
- Copyright (C) 1999, 2001, 2002, 2004, 2005, 2007, 2008
- Free Software Foundation, Inc.
-
- Contributed by Cygnus Solutions.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Work in progress */
-
-/* This file was created with the aid of ``gdb-events.sh''.
-
- The bourn shell script ``gdb-events.sh'' creates the files
- ``new-gdb-events.c'' and ``new-gdb-events.h and then compares
- them against the existing ``gdb-events.[hc]''. Any differences
- found being reported.
-
- If editing this file, please also run gdb-events.sh and merge any
- changes into that script. Conversely, when making sweeping changes
- to this file, modifying gdb-events.sh and using its output may
- prove easier. */
-
-
-#include "defs.h"
-#include "gdb-events.h"
-#include "gdbcmd.h"
-
-static struct gdb_events null_event_hooks;
-static struct gdb_events queue_event_hooks;
-static struct gdb_events *current_event_hooks = &null_event_hooks;
-
-int gdb_events_debug;
-static void
-show_gdb_events_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
-{
- fprintf_filtered (file, _("Event debugging is %s.\n"), value);
-}
-
-
-void
-breakpoint_create_event (int b)
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "breakpoint_create_event\n");
- if (!current_event_hooks->breakpoint_create)
- return;
- current_event_hooks->breakpoint_create (b);
-}
-
-void
-breakpoint_delete_event (int b)
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "breakpoint_delete_event\n");
- if (!current_event_hooks->breakpoint_delete)
- return;
- current_event_hooks->breakpoint_delete (b);
-}
-
-void
-breakpoint_modify_event (int b)
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "breakpoint_modify_event\n");
- if (!current_event_hooks->breakpoint_modify)
- return;
- current_event_hooks->breakpoint_modify (b);
-}
-
-void
-tracepoint_create_event (int number)
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "tracepoint_create_event\n");
- if (!current_event_hooks->tracepoint_create)
- return;
- current_event_hooks->tracepoint_create (number);
-}
-
-void
-tracepoint_delete_event (int number)
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "tracepoint_delete_event\n");
- if (!current_event_hooks->tracepoint_delete)
- return;
- current_event_hooks->tracepoint_delete (number);
-}
-
-void
-tracepoint_modify_event (int number)
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "tracepoint_modify_event\n");
- if (!current_event_hooks->tracepoint_modify)
- return;
- current_event_hooks->tracepoint_modify (number);
-}
-
-void
-architecture_changed_event (void)
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "architecture_changed_event\n");
- if (!current_event_hooks->architecture_changed)
- return;
- current_event_hooks->architecture_changed ();
-}
-
-struct gdb_events *
-deprecated_set_gdb_event_hooks (struct gdb_events *vector)
-{
- struct gdb_events *old_events = current_event_hooks;
- if (vector == NULL)
- current_event_hooks = &queue_event_hooks;
- else
- current_event_hooks = vector;
- return old_events;
-}
-
-void
-clear_gdb_event_hooks (void)
-{
- deprecated_set_gdb_event_hooks (&null_event_hooks);
-}
-
-enum gdb_event
-{
- breakpoint_create,
- breakpoint_delete,
- breakpoint_modify,
- tracepoint_create,
- tracepoint_delete,
- tracepoint_modify,
- architecture_changed,
- nr_gdb_events
-};
-
-struct breakpoint_create
- {
- int b;
- };
-
-struct breakpoint_delete
- {
- int b;
- };
-
-struct breakpoint_modify
- {
- int b;
- };
-
-struct tracepoint_create
- {
- int number;
- };
-
-struct tracepoint_delete
- {
- int number;
- };
-
-struct tracepoint_modify
- {
- int number;
- };
-
-struct event
- {
- enum gdb_event type;
- struct event *next;
- union
- {
- struct breakpoint_create breakpoint_create;
- struct breakpoint_delete breakpoint_delete;
- struct breakpoint_modify breakpoint_modify;
- struct tracepoint_create tracepoint_create;
- struct tracepoint_delete tracepoint_delete;
- struct tracepoint_modify tracepoint_modify;
- }
- data;
- };
-struct event *pending_events;
-struct event *delivering_events;
-
-static void
-append (struct event *new_event)
-{
- struct event **event = &pending_events;
- while ((*event) != NULL)
- event = &((*event)->next);
- (*event) = new_event;
- (*event)->next = NULL;
-}
-
-static void
-queue_breakpoint_create (int b)
-{
- struct event *event = XMALLOC (struct event);
- event->type = breakpoint_create;
- event->data.breakpoint_create.b = b;
- append (event);
-}
-
-static void
-queue_breakpoint_delete (int b)
-{
- struct event *event = XMALLOC (struct event);
- event->type = breakpoint_delete;
- event->data.breakpoint_delete.b = b;
- append (event);
-}
-
-static void
-queue_breakpoint_modify (int b)
-{
- struct event *event = XMALLOC (struct event);
- event->type = breakpoint_modify;
- event->data.breakpoint_modify.b = b;
- append (event);
-}
-
-static void
-queue_tracepoint_create (int number)
-{
- struct event *event = XMALLOC (struct event);
- event->type = tracepoint_create;
- event->data.tracepoint_create.number = number;
- append (event);
-}
-
-static void
-queue_tracepoint_delete (int number)
-{
- struct event *event = XMALLOC (struct event);
- event->type = tracepoint_delete;
- event->data.tracepoint_delete.number = number;
- append (event);
-}
-
-static void
-queue_tracepoint_modify (int number)
-{
- struct event *event = XMALLOC (struct event);
- event->type = tracepoint_modify;
- event->data.tracepoint_modify.number = number;
- append (event);
-}
-
-static void
-queue_architecture_changed (void)
-{
- struct event *event = XMALLOC (struct event);
- event->type = architecture_changed;
- append (event);
-}
-
-void
-gdb_events_deliver (struct gdb_events *vector)
-{
- /* Just zap any events left around from last time. */
- while (delivering_events != NULL)
- {
- struct event *event = delivering_events;
- delivering_events = event->next;
- xfree (event);
- }
- /* Process any pending events. Because one of the deliveries could
- bail out we move everything off of the pending queue onto an
- in-progress queue where it can, later, be cleaned up if
- necessary. */
- delivering_events = pending_events;
- pending_events = NULL;
- while (delivering_events != NULL)
- {
- struct event *event = delivering_events;
- switch (event->type)
- {
- case breakpoint_create:
- vector->breakpoint_create
- (event->data.breakpoint_create.b);
- break;
- case breakpoint_delete:
- vector->breakpoint_delete
- (event->data.breakpoint_delete.b);
- break;
- case breakpoint_modify:
- vector->breakpoint_modify
- (event->data.breakpoint_modify.b);
- break;
- case tracepoint_create:
- vector->tracepoint_create
- (event->data.tracepoint_create.number);
- break;
- case tracepoint_delete:
- vector->tracepoint_delete
- (event->data.tracepoint_delete.number);
- break;
- case tracepoint_modify:
- vector->tracepoint_modify
- (event->data.tracepoint_modify.number);
- break;
- case architecture_changed:
- vector->architecture_changed ();
- break;
- }
- delivering_events = event->next;
- xfree (event);
- }
-}
-
-void _initialize_gdb_events (void);
-void
-_initialize_gdb_events (void)
-{
- struct cmd_list_element *c;
- queue_event_hooks.breakpoint_create = queue_breakpoint_create;
- queue_event_hooks.breakpoint_delete = queue_breakpoint_delete;
- queue_event_hooks.breakpoint_modify = queue_breakpoint_modify;
- queue_event_hooks.tracepoint_create = queue_tracepoint_create;
- queue_event_hooks.tracepoint_delete = queue_tracepoint_delete;
- queue_event_hooks.tracepoint_modify = queue_tracepoint_modify;
- queue_event_hooks.architecture_changed = queue_architecture_changed;
-
- add_setshow_zinteger_cmd ("event", class_maintenance,
- &gdb_events_debug, _("\
-Set event debugging."), _("\
-Show event debugging."), _("\
-When non-zero, event/notify debugging is enabled."),
- NULL,
- show_gdb_events_debug,
- &setdebuglist, &showdebuglist);
-}
diff --git a/gdb/gdb-events.h b/gdb/gdb-events.h
deleted file mode 100644
index 9c38c0a..0000000
--- a/gdb/gdb-events.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* User Interface Events.
-
- Copyright (C) 1999, 2001, 2002, 2004, 2007, 2008
- Free Software Foundation, Inc.
-
- Contributed by Cygnus Solutions.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Work in progress */
-
-/* This file was created with the aid of ``gdb-events.sh''.
-
- The bourn shell script ``gdb-events.sh'' creates the files
- ``new-gdb-events.c'' and ``new-gdb-events.h and then compares
- them against the existing ``gdb-events.[hc]''. Any differences
- found being reported.
-
- If editing this file, please also run gdb-events.sh and merge any
- changes into that script. Conversely, when making sweeping changes
- to this file, modifying gdb-events.sh and using its output may
- prove easier. */
-
-
-#ifndef GDB_EVENTS_H
-#define GDB_EVENTS_H
-
-
-/* COMPAT: pointer variables for old, unconverted events.
- A call to set_gdb_events() will automatically update these. */
-
-
-
-/* Type definition of all hook functions. Recommended pratice is to
- first declare each hook function using the below ftype and then
- define it. */
-
-typedef void (gdb_events_breakpoint_create_ftype) (int b);
-typedef void (gdb_events_breakpoint_delete_ftype) (int b);
-typedef void (gdb_events_breakpoint_modify_ftype) (int b);
-typedef void (gdb_events_tracepoint_create_ftype) (int number);
-typedef void (gdb_events_tracepoint_delete_ftype) (int number);
-typedef void (gdb_events_tracepoint_modify_ftype) (int number);
-typedef void (gdb_events_architecture_changed_ftype) (void);
-
-
-/* gdb-events: object. */
-
-struct gdb_events
- {
- gdb_events_breakpoint_create_ftype *breakpoint_create;
- gdb_events_breakpoint_delete_ftype *breakpoint_delete;
- gdb_events_breakpoint_modify_ftype *breakpoint_modify;
- gdb_events_tracepoint_create_ftype *tracepoint_create;
- gdb_events_tracepoint_delete_ftype *tracepoint_delete;
- gdb_events_tracepoint_modify_ftype *tracepoint_modify;
- gdb_events_architecture_changed_ftype *architecture_changed;
- };
-
-
-/* Interface into events functions.
- Where a *_p() predicate is present, it must be called before
- calling the hook proper. */
-extern void breakpoint_create_event (int b);
-extern void breakpoint_delete_event (int b);
-extern void breakpoint_modify_event (int b);
-extern void tracepoint_create_event (int number);
-extern void tracepoint_delete_event (int number);
-extern void tracepoint_modify_event (int number);
-extern void architecture_changed_event (void);
-
-/* Install custom gdb-events hooks. */
-extern struct gdb_events *deprecated_set_gdb_event_hooks (struct gdb_events *vector);
-
-/* Deliver any pending events. */
-extern void gdb_events_deliver (struct gdb_events *vector);
-
-/* Clear event handlers. */
-extern void clear_gdb_event_hooks (void);
-
-#endif
diff --git a/gdb/gdb-events.sh b/gdb/gdb-events.sh
deleted file mode 100755
index e4e79c5..0000000
--- a/gdb/gdb-events.sh
+++ /dev/null
@@ -1,509 +0,0 @@
-#!/bin/sh
-
-# User Interface Events.
-#
-# Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008
-# Free Software Foundation, Inc.
-#
-# Contributed by Cygnus Solutions.
-#
-# This file is part of GDB.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-IFS=:
-
-read="class returntype function formal actual attrib"
-
-function_list ()
-{
- # category:
- # # -> disable
- # * -> compatibility - pointer variable that is initialized
- # by set_gdb_events().
- # ? -> Predicate and function proper.
- # f -> always call (must have a void returntype)
- # return-type
- # name
- # formal argument list
- # actual argument list
- # attributes
- # description
- cat <<EOF |
-f:void:breakpoint_create:int b:b
-f:void:breakpoint_delete:int b:b
-f:void:breakpoint_modify:int b:b
-f:void:tracepoint_create:int number:number
-f:void:tracepoint_delete:int number:number
-f:void:tracepoint_modify:int number:number
-f:void:architecture_changed:void
-EOF
- grep -v '^#'
-}
-
-copyright ()
-{
- cat <<EOF
-/* User Interface Events.
-
- Copyright (C) 1999, 2001, 2002, 2004, 2005, 2007
- Free Software Foundation, Inc.
-
- Contributed by Cygnus Solutions.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Work in progress */
-
-/* This file was created with the aid of \`\`gdb-events.sh''.
-
- The bourn shell script \`\`gdb-events.sh'' creates the files
- \`\`new-gdb-events.c'' and \`\`new-gdb-events.h and then compares
- them against the existing \`\`gdb-events.[hc]''. Any differences
- found being reported.
-
- If editing this file, please also run gdb-events.sh and merge any
- changes into that script. Conversely, when making sweeping changes
- to this file, modifying gdb-events.sh and using its output may
- prove easier. */
-
-EOF
-}
-
-#
-# The .h file
-#
-
-exec > new-gdb-events.h
-copyright
-cat <<EOF
-
-#ifndef GDB_EVENTS_H
-#define GDB_EVENTS_H
-EOF
-
-# pointer declarations
-echo ""
-echo ""
-cat <<EOF
-/* COMPAT: pointer variables for old, unconverted events.
- A call to set_gdb_events() will automatically update these. */
-EOF
-echo ""
-function_list | while eval read $read
-do
- case "${class}" in
- "*" )
- echo "extern ${returntype} (*${function}_event) (${formal})${attrib};"
- ;;
- esac
-done
-
-# function typedef's
-echo ""
-echo ""
-cat <<EOF
-/* Type definition of all hook functions. Recommended pratice is to
- first declare each hook function using the below ftype and then
- define it. */
-EOF
-echo ""
-function_list | while eval read $read
-do
- echo "typedef ${returntype} (gdb_events_${function}_ftype) (${formal});"
-done
-
-# gdb_events object
-echo ""
-echo ""
-cat <<EOF
-/* gdb-events: object. */
-EOF
-echo ""
-echo "struct gdb_events"
-echo " {"
-function_list | while eval read $read
-do
- echo " gdb_events_${function}_ftype *${function}${attrib};"
-done
-echo " };"
-
-# function declarations
-echo ""
-echo ""
-cat <<EOF
-/* Interface into events functions.
- Where a *_p() predicate is present, it must be called before
- calling the hook proper. */
-EOF
-function_list | while eval read $read
-do
- case "${class}" in
- "*" ) continue ;;
- "?" )
- echo "extern int ${function}_p (void);"
- echo "extern ${returntype} ${function}_event (${formal})${attrib};"
- ;;
- "f" )
- echo "extern ${returntype} ${function}_event (${formal})${attrib};"
- ;;
- esac
-done
-
-# our set function
-cat <<EOF
-
-/* Install custom gdb-events hooks. */
-extern struct gdb_events *deprecated_set_gdb_event_hooks (struct gdb_events *vector);
-
-/* Deliver any pending events. */
-extern void gdb_events_deliver (struct gdb_events *vector);
-
-/* Clear event handlers. */
-extern void clear_gdb_event_hooks (void);
-EOF
-
-# close it off
-echo ""
-echo "#endif"
-exec 1>&2
-#../move-if-change new-gdb-events.h gdb-events.h
-if test -r gdb-events.h
-then
- diff -c gdb-events.h new-gdb-events.h
- if [ $? = 1 ]
- then
- echo "gdb-events.h changed? cp new-gdb-events.h gdb-events.h" 1>&2
- fi
-else
- echo "File missing? mv new-gdb-events.h gdb-events.h" 1>&2
-fi
-
-
-
-#
-# C file
-#
-
-exec > new-gdb-events.c
-copyright
-cat <<EOF
-
-#include "defs.h"
-#include "gdb-events.h"
-#include "gdbcmd.h"
-
-static struct gdb_events null_event_hooks;
-static struct gdb_events queue_event_hooks;
-static struct gdb_events *current_event_hooks = &null_event_hooks;
-
-int gdb_events_debug;
-static void
-show_gdb_events_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
-{
- fprintf_filtered (file, _("Event debugging is %s.\\n"), value);
-}
-
-EOF
-
-# function bodies
-function_list | while eval read $read
-do
- case "${class}" in
- "*" ) continue ;;
- "?" )
-cat <<EOF
-
-int
-${function}_event_p (${formal})
-{
- return current_event_hooks->${function};
-}
-
-${returntype}
-${function}_event (${formal})
-{
- return current_events->${function} (${actual});
-}
-EOF
- ;;
- "f" )
-cat <<EOF
-
-void
-${function}_event (${formal})
-{
- if (gdb_events_debug)
- fprintf_unfiltered (gdb_stdlog, "${function}_event\n");
- if (!current_event_hooks->${function})
- return;
- current_event_hooks->${function} (${actual});
-}
-EOF
- ;;
- esac
-done
-
-# Set hooks function
-echo ""
-cat <<EOF
-struct gdb_events *
-deprecated_set_gdb_event_hooks (struct gdb_events *vector)
-{
- struct gdb_events *old_events = current_event_hooks;
- if (vector == NULL)
- current_event_hooks = &queue_event_hooks;
- else
- current_event_hooks = vector;
- return old_events;
-EOF
-function_list | while eval read $read
-do
- case "${class}" in
- "*" )
- echo " ${function}_event = hooks->${function};"
- ;;
- esac
-done
-cat <<EOF
-}
-EOF
-
-# Clear hooks function
-echo ""
-cat <<EOF
-void
-clear_gdb_event_hooks (void)
-{
- deprecated_set_gdb_event_hooks (&null_event_hooks);
-}
-EOF
-
-# event type
-echo ""
-cat <<EOF
-enum gdb_event
-{
-EOF
-function_list | while eval read $read
-do
- case "${class}" in
- "f" )
- echo " ${function},"
- ;;
- esac
-done
-cat <<EOF
- nr_gdb_events
-};
-EOF
-
-# event data
-echo ""
-function_list | while eval read $read
-do
- case "${class}" in
- "f" )
- if test ${actual}
- then
- echo "struct ${function}"
- echo " {"
- echo " `echo ${formal} | tr '[,]' '[;]'`;"
- echo " };"
- echo ""
- fi
- ;;
- esac
-done
-
-# event queue
-cat <<EOF
-struct event
- {
- enum gdb_event type;
- struct event *next;
- union
- {
-EOF
-function_list | while eval read $read
-do
- case "${class}" in
- "f" )
- if test ${actual}
- then
- echo " struct ${function} ${function};"
- fi
- ;;
- esac
-done
-cat <<EOF
- }
- data;
- };
-struct event *pending_events;
-struct event *delivering_events;
-EOF
-
-# append
-echo ""
-cat <<EOF
-static void
-append (struct event *new_event)
-{
- struct event **event = &pending_events;
- while ((*event) != NULL)
- event = &((*event)->next);
- (*event) = new_event;
- (*event)->next = NULL;
-}
-EOF
-
-# schedule a given event
-function_list | while eval read $read
-do
- case "${class}" in
- "f" )
- echo ""
- echo "static void"
- echo "queue_${function} (${formal})"
- echo "{"
- echo " struct event *event = XMALLOC (struct event);"
- echo " event->type = ${function};"
- for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
- echo " event->data.${function}.${arg} = ${arg};"
- done
- echo " append (event);"
- echo "}"
- ;;
- esac
-done
-
-# deliver
-echo ""
-cat <<EOF
-void
-gdb_events_deliver (struct gdb_events *vector)
-{
- /* Just zap any events left around from last time. */
- while (delivering_events != NULL)
- {
- struct event *event = delivering_events;
- delivering_events = event->next;
- xfree (event);
- }
- /* Process any pending events. Because one of the deliveries could
- bail out we move everything off of the pending queue onto an
- in-progress queue where it can, later, be cleaned up if
- necessary. */
- delivering_events = pending_events;
- pending_events = NULL;
- while (delivering_events != NULL)
- {
- struct event *event = delivering_events;
- switch (event->type)
- {
-EOF
-function_list | while eval read $read
-do
- case "${class}" in
- "f" )
- echo " case ${function}:"
- if test ${actual}
- then
- echo " vector->${function}"
- sep=" ("
- ass=""
- for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
- ass="${ass}${sep}event->data.${function}.${arg}"
- sep=",
- "
- done
- echo "${ass});"
- else
- echo " vector->${function} ();"
- fi
- echo " break;"
- ;;
- esac
-done
-cat <<EOF
- }
- delivering_events = event->next;
- xfree (event);
- }
-}
-EOF
-
-# Finally the initialization
-echo ""
-cat <<EOF
-void _initialize_gdb_events (void);
-void
-_initialize_gdb_events (void)
-{
- struct cmd_list_element *c;
-EOF
-function_list | while eval read $read
-do
- case "${class}" in
- "f" )
- echo " queue_event_hooks.${function} = queue_${function};"
- ;;
- esac
-done
-cat <<EOF
-
- add_setshow_zinteger_cmd ("event", class_maintenance,
- &gdb_events_debug, _("\\
-Set event debugging."), _("\\
-Show event debugging."), _("\\
-When non-zero, event/notify debugging is enabled."),
- NULL,
- show_gdb_events_debug,
- &setdebuglist, &showdebuglist);
-}
-EOF
-
-# close things off
-exec 1>&2
-#../move-if-change new-gdb-events.c gdb-events.c
-# Replace any leading spaces with tabs
-sed < new-gdb-events.c > tmp-gdb-events.c \
- -e 's/\( \)* /\1 /g'
-mv tmp-gdb-events.c new-gdb-events.c
-# Move if changed?
-if test -r gdb-events.c
-then
- diff -c gdb-events.c new-gdb-events.c
- if [ $? = 1 ]
- then
- echo "gdb-events.c changed? cp new-gdb-events.c gdb-events.c" 1>&2
- fi
-else
- echo "File missing? mv new-gdb-events.c gdb-events.c" 1>&2
-fi
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 8a139da..6b173c2 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -44,10 +44,10 @@
#include "gdb_assert.h"
#include "gdb_string.h"
-#include "gdb-events.h"
#include "reggroups.h"
#include "osabi.h"
#include "gdb_obstack.h"
+#include "observer.h"
/* Static function declarations */
@@ -3650,7 +3650,7 @@ deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
gdb_assert (current_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
current_gdbarch = new_gdbarch;
- architecture_changed_event ();
+ observer_notify_architecture_changed (new_gdbarch);
reinit_frame_cache ();
}
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 2731833..af7aea4 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1130,10 +1130,10 @@ cat <<EOF
#include "gdb_assert.h"
#include "gdb_string.h"
-#include "gdb-events.h"
#include "reggroups.h"
#include "osabi.h"
#include "gdb_obstack.h"
+#include "observer.h"
/* Static function declarations */
@@ -2018,7 +2018,7 @@ deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
gdb_assert (current_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
current_gdbarch = new_gdbarch;
- architecture_changed_event ();
+ observer_notify_architecture_changed (new_gdbarch);
reinit_frame_cache ();
}
diff --git a/gdb/interps.c b/gdb/interps.c
index b4c804a..194ac62 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -37,7 +37,6 @@
#include "interps.h"
#include "completer.h"
#include "gdb_string.h"
-#include "gdb-events.h"
#include "gdb_assert.h"
#include "top.h" /* For command_loop. */
#include "exceptions.h"
@@ -352,7 +351,6 @@ clear_interpreter_hooks (void)
deprecated_error_hook = 0;
deprecated_error_begin_hook = 0;
deprecated_command_loop_hook = 0;
- clear_gdb_event_hooks ();
}
/* This is a lazy init routine, called the first time the interpreter
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 1bfb567..96e38a9 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -24,32 +24,32 @@
#include "breakpoint.h"
#include "gdb_string.h"
#include "mi-getopt.h"
-#include "gdb-events.h"
#include "gdb.h"
#include "exceptions.h"
+#include "observer.h"
enum
{
FROM_TTY = 0
};
-/* Output a single breakpoint. */
+/* True if MI breakpoint observers have been registered. */
+
+static int mi_breakpoint_observers_installed;
+
+/* Control whether breakpoint_notify may act. */
+
+static int mi_can_breakpoint_notify;
+
+/* Output a single breakpoint, when allowed. */
static void
breakpoint_notify (int b)
{
- gdb_breakpoint_query (uiout, b, NULL);
+ if (mi_can_breakpoint_notify)
+ gdb_breakpoint_query (uiout, b, NULL);
}
-
-struct gdb_events breakpoint_hooks =
-{
- breakpoint_notify,
- breakpoint_notify,
- breakpoint_notify,
-};
-
-
enum bp_type
{
REG_BP,
@@ -132,7 +132,15 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
address = argv[optind];
/* Now we have what we need, let's insert the breakpoint! */
- old_hooks = deprecated_set_gdb_event_hooks (&breakpoint_hooks);
+ if (! mi_breakpoint_observers_installed)
+ {
+ observer_attach_breakpoint_created (breakpoint_notify);
+ observer_attach_breakpoint_modified (breakpoint_notify);
+ observer_attach_breakpoint_deleted (breakpoint_notify);
+ mi_breakpoint_observers_installed = 1;
+ }
+
+ mi_can_breakpoint_notify = 1;
/* Make sure we restore hooks even if exception is thrown. */
TRY_CATCH (e, RETURN_MASK_ALL)
{
@@ -163,7 +171,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
_("mi_cmd_break_insert: Bad switch."));
}
}
- deprecated_set_gdb_event_hooks (old_hooks);
+ mi_can_breakpoint_notify = 0;
if (e.reason < 0)
throw_exception (e);
}
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 7cd98be..249e7ee 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -34,9 +34,9 @@
#include "linespec.h"
#include "regcache.h"
#include "completer.h"
-#include "gdb-events.h"
#include "block.h"
#include "dictionary.h"
+#include "observer.h"
#include "ax.h"
#include "ax-gdb.h"
@@ -570,11 +570,11 @@ tracepoint_operation (struct tracepoint *t, int from_tty,
{
case enable_op:
t->enabled_p = 1;
- tracepoint_modify_event (t->number);
+ observer_notify_tracepoint_modified (t->number);
break;
case disable_op:
t->enabled_p = 0;
- tracepoint_modify_event (t->number);
+ observer_notify_tracepoint_modified (t->number);
break;
case delete_op:
if (tracepoint_chain == t)
@@ -587,7 +587,7 @@ tracepoint_operation (struct tracepoint *t, int from_tty,
break;
}
- tracepoint_delete_event (t->number);
+ observer_notify_tracepoint_deleted (t->number);
if (t->addr_string)
xfree (t->addr_string);
@@ -739,7 +739,7 @@ trace_pass_command (char *args, int from_tty)
if (t1 == (struct tracepoint *) -1 || t1 == t2)
{
t2->pass_count = count;
- tracepoint_modify_event (t2->number);
+ observer_notify_tracepoint_modified (t2->number);
if (from_tty)
printf_filtered ("Setting tracepoint %d's passcount to %d\n",
t2->number, count);
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 0a15d2f..25c72ec 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -31,7 +31,6 @@
#include "event-top.h"
#include "frame.h"
#include "breakpoint.h"
-#include "gdb-events.h"
#include "ui-out.h"
#include "top.h"
#include "observer.h"
@@ -157,23 +156,6 @@ tui_event_modify_breakpoint (int number)
tui_update_all_breakpoint_info ();
}
-static void
-tui_event_default (int number)
-{
- ;
-}
-
-static struct gdb_events *tui_old_event_hooks;
-
-static struct gdb_events tui_event_hooks = {
- tui_event_create_breakpoint,
- tui_event_delete_breakpoint,
- tui_event_modify_breakpoint,
- tui_event_default,
- tui_event_default,
- tui_event_default
-};
-
/* Called when going to wait for the target.
Leave curses mode and setup program mode. */
static ptid_t
@@ -262,6 +244,11 @@ tui_detach_hook (void)
tui_display_main ();
}
+/* Observers created when installing TUI hooks. */
+static struct observer *tui_bp_created_observer;
+static struct observer *tui_bp_deleted_observer;
+static struct observer *tui_bp_modified_observer;
+
/* Install the TUI specific hooks. */
void
tui_install_hooks (void)
@@ -273,7 +260,12 @@ tui_install_hooks (void)
deprecated_query_hook = tui_query_hook;
/* Install the event hooks. */
- tui_old_event_hooks = deprecated_set_gdb_event_hooks (&tui_event_hooks);
+ tui_bp_created_observer
+ = observer_attach_breakpoint_created (tui_event_create_breakpoint);
+ tui_bp_deleted_observer
+ = observer_attach_breakpoint_deleted (tui_event_delete_breakpoint);
+ tui_bp_modified_observer
+ = observer_attach_breakpoint_modified (tui_event_modify_breakpoint);
deprecated_register_changed_hook = tui_register_changed_hook;
deprecated_detach_hook = tui_detach_hook;
@@ -290,8 +282,13 @@ tui_remove_hooks (void)
deprecated_register_changed_hook = 0;
deprecated_detach_hook = 0;
- /* Restore the previous event hooks. */
- deprecated_set_gdb_event_hooks (tui_old_event_hooks);
+ /* Remove our observers. */
+ observer_detach_breakpoint_created (tui_bp_created_observer);
+ tui_bp_created_observer = NULL;
+ observer_detach_breakpoint_deleted (tui_bp_deleted_observer);
+ tui_bp_deleted_observer = NULL;
+ observer_detach_breakpoint_modified (tui_bp_modified_observer);
+ tui_bp_modified_observer = NULL;
}
void _initialize_tui_hooks (void);