This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: Patch: annotations -vs- deprecated hooks


This patch removes a few deprecated hooks associated with annotations.

This requires my previous observer patch.

Some of these are only used by annotations; I changed the annotation
code to use observers instead.  Some of these hooks are called by
annotations but never set.  These I just deleted.

There are still a couple of hooks called by the annotations code that
are used by gdbtk.  This setup seems weird to me.  I guess these ought
to be replaced by observers.

Built and regression tested on x86 F8.  Ok?

Tom

b/gdb/ChangeLog:
2008-07-13  Tom Tromey  <tromey@redhat.com>

	* annotate.h (deprecated_annotate_starting_hook): Remove.
	(deprecated_annotate_stopped_hook): Remove.
	(deprecated_annotate_exited_hook): Remove.
	* Makefile.in (annotate.o): Depend on observer_h.
	* top.c (deprecated_delete_breakpoint_hook): Remove.
	(deprecated_create_breakpoint_hook): Likewise.
	(deprecated_modify_breakpoint_hook): Likewise.
	* interps.c (clear_interpreter_hooks): Update for removed hooks.
	* breakpoint.c (mention): Don't call removed hook.
	(delete_breakpoint): Likewise.
	(disable_breakpoint): Likewise.
	(do_enable_breakpoint): Likewise.
	* annotate.c: Include observer.h.
	(breakpoint_changed): Change type of argument.
	(_initialize_annotate): Register observers.
	(deprecated_annotate_starting_hook): Remove.
	(deprecated_annotate_stopped_hook): Remove.
	(deprecated_annotate_exited_hook): Remove.
	(annotate_starting): Update for hook removal.
	(annotate_stopped): Likewise.
	(annotate_exited): Likewise.
	* defs.h (deprecated_delete_breakpoint_hook): Remove.
	(deprecated_create_breakpoint_hook): Likewise.
	(deprecated_modify_breakpoint_hook): Likewise.

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 4661d7b..1f1b81b 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1908,7 +1908,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(arch_utils_h) $(block_h) \
 	$(regset_h) $(symfile_h) $(gdb_assert_h) $(amd64_tdep_h) \
 	$(i387_tdep_h)
 annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \
-	$(gdbtypes_h) $(breakpoint_h)
+	$(gdbtypes_h) $(breakpoint_h) $(observer_h)
 arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \
 	$(gdbcmd_h) $(inferior_h) $(gdb_string_h) $(regcache_h) \
 	$(gdb_assert_h) $(sim_regno_h) $(gdbcore_h) $(osabi_h) $(version_h) \
diff --git a/gdb/annotate.c b/gdb/annotate.c
index 98a37ae..ed608b6 100644
--- a/gdb/annotate.c
+++ b/gdb/annotate.c
@@ -23,6 +23,7 @@
 #include "target.h"
 #include "gdbtypes.h"
 #include "breakpoint.h"
+#include "observer.h"
 
 
 /* Prototypes for local functions. */
@@ -31,13 +32,11 @@ extern void _initialize_annotate (void);
 
 static void print_value_flags (struct type *);
 
-static void breakpoint_changed (struct breakpoint *);
+static void breakpoint_changed (int);
+
 
-void (*deprecated_annotate_starting_hook) (void);
-void (*deprecated_annotate_stopped_hook) (void);
 void (*deprecated_annotate_signalled_hook) (void);
 void (*deprecated_annotate_signal_hook) (void);
-void (*deprecated_annotate_exited_hook) (void);
 
 static int ignore_count_changed = 0;
 
@@ -99,28 +98,15 @@ annotate_watchpoint (int num)
 void
 annotate_starting (void)
 {
-
-  if (deprecated_annotate_starting_hook)
-    deprecated_annotate_starting_hook ();
-  else
-    {
-      if (annotation_level > 1)
-	{
-	  printf_filtered (("\n\032\032starting\n"));
-	}
-    }
+  if (annotation_level > 1)
+    printf_filtered (("\n\032\032starting\n"));
 }
 
 void
 annotate_stopped (void)
 {
-  if (deprecated_annotate_stopped_hook)
-    deprecated_annotate_stopped_hook ();
-  else
-    {
-      if (annotation_level > 1)
-	printf_filtered (("\n\032\032stopped\n"));
-    }
+  if (annotation_level > 1)
+    printf_filtered (("\n\032\032stopped\n"));
   if (annotation_level > 1 && ignore_count_changed)
     {
       ignore_count_changed = 0;
@@ -131,13 +117,8 @@ annotate_stopped (void)
 void
 annotate_exited (int exitstatus)
 {
-  if (deprecated_annotate_exited_hook)
-    deprecated_annotate_exited_hook ();
-  else
-    {
-      if (annotation_level > 1)
-	printf_filtered (("\n\032\032exited %d\n"), exitstatus);
-    }
+  if (annotation_level > 1)
+    printf_filtered (("\n\032\032exited %d\n"), exitstatus);
 }
 
 void
@@ -578,7 +559,7 @@ annotate_array_section_end (void)
 }
 
 static void
-breakpoint_changed (struct breakpoint *b)
+breakpoint_changed (int bpno)
 {
   breakpoints_changed ();
 }
@@ -588,7 +569,7 @@ _initialize_annotate (void)
 {
   if (annotation_level == 2)
     {
-      deprecated_delete_breakpoint_hook = breakpoint_changed;
-      deprecated_modify_breakpoint_hook = breakpoint_changed;
+      observer_attach_breakpoint_deleted (breakpoint_changed);
+      observer_attach_breakpoint_modified (breakpoint_changed);
     }
 }
diff --git a/gdb/annotate.h b/gdb/annotate.h
index bbc274f..6fb1954 100644
--- a/gdb/annotate.h
+++ b/gdb/annotate.h
@@ -99,8 +99,5 @@ extern void annotate_elt_rep_end (void);
 extern void annotate_elt (void);
 extern void annotate_array_section_end (void);
 
-extern void (*deprecated_annotate_starting_hook) (void);
-extern void (*deprecated_annotate_stopped_hook) (void);
 extern void (*deprecated_annotate_signalled_hook) (void);
 extern void (*deprecated_annotate_signal_hook) (void);
-extern void (*deprecated_annotate_exited_hook) (void);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4f4f78f..4fde5a5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4889,10 +4889,7 @@ mention (struct breakpoint *b)
   /* FIXME: This is misplaced; mention() is called by things (like
      hitting a watchpoint) other than breakpoint creation.  It should
      be possible to clean this up and at the same time replace the
-     random calls to breakpoint_changed with this hook, as has already
-     been done for deprecated_delete_breakpoint_hook and so on.  */
-  if (deprecated_create_breakpoint_hook)
-    deprecated_create_breakpoint_hook (b);
+     random calls to breakpoint_changed with this hook.  */
   observer_notify_breakpoint_created (b->number);
 
   if (b->ops != NULL && b->ops->print_mention != NULL)
@@ -7212,8 +7209,6 @@ delete_breakpoint (struct breakpoint *bpt)
   if (bpt->type == bp_none)
     return;
 
-  if (deprecated_delete_breakpoint_hook)
-    deprecated_delete_breakpoint_hook (bpt);
   observer_notify_breakpoint_deleted (bpt->number);
 
   if (breakpoint_chain == bpt)
@@ -7867,8 +7862,6 @@ disable_breakpoint (struct breakpoint *bpt)
 
   update_global_location_list (0);
 
-  if (deprecated_modify_breakpoint_hook)
-    deprecated_modify_breakpoint_hook (bpt);
   observer_notify_breakpoint_modified (bpt->number);
 }
 
@@ -7992,8 +7985,6 @@ have been allocated for other watchpoints.\n"), bpt->number);
   update_global_location_list (1);
   breakpoints_changed ();
   
-  if (deprecated_modify_breakpoint_hook)
-    deprecated_modify_breakpoint_hook (bpt);
   observer_notify_breakpoint_modified (bpt->number);
 }
 
diff --git a/gdb/defs.h b/gdb/defs.h
index 6e6aa80..cae619e 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -1053,9 +1053,6 @@ extern int (*deprecated_query_hook) (const char *, va_list)
 extern void (*deprecated_warning_hook) (const char *, va_list)
      ATTRIBUTE_FPTR_PRINTF(1,0);
 extern void (*deprecated_flush_hook) (struct ui_file * stream);
-extern void (*deprecated_create_breakpoint_hook) (struct breakpoint * b);
-extern void (*deprecated_delete_breakpoint_hook) (struct breakpoint * bpt);
-extern void (*deprecated_modify_breakpoint_hook) (struct breakpoint * bpt);
 extern void (*deprecated_interactive_hook) (void);
 extern void (*deprecated_readline_begin_hook) (char *, ...)
      ATTRIBUTE_FPTR_PRINTF_1;
diff --git a/gdb/interps.c b/gdb/interps.c
index 194ac62..3bb7811 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -336,9 +336,6 @@ clear_interpreter_hooks (void)
   /*print_frame_more_info_hook = 0; */
   deprecated_query_hook = 0;
   deprecated_warning_hook = 0;
-  deprecated_create_breakpoint_hook = 0;
-  deprecated_delete_breakpoint_hook = 0;
-  deprecated_modify_breakpoint_hook = 0;
   deprecated_interactive_hook = 0;
   deprecated_readline_begin_hook = 0;
   deprecated_readline_hook = 0;
diff --git a/gdb/top.c b/gdb/top.c
index 7ef539f..7f46caf 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -246,13 +246,6 @@ void (*deprecated_readline_begin_hook) (char *, ...);
 char *(*deprecated_readline_hook) (char *);
 void (*deprecated_readline_end_hook) (void);
 
-/* Called as appropriate to notify the interface of the specified breakpoint
-   conditions.  */
-
-void (*deprecated_create_breakpoint_hook) (struct breakpoint * bpt);
-void (*deprecated_delete_breakpoint_hook) (struct breakpoint * bpt);
-void (*deprecated_modify_breakpoint_hook) (struct breakpoint * bpt);
-
 /* Called as appropriate to notify the interface that we have attached
    to or detached from an already running process. */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]