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]

[PATCH 11/11] Remove deprecated_print_frame_info_listing_hook


This patch removes deprecated_print_frame_info_listing_hook.

In contrast to the previous patches this one needs to change some
functionality for the TUI front-end.  According to the comment in
tui/tui-hooks.c:tui_install_hooks the hook is only used to tell
print_frame_info that TUI is active.  So check directly if tui_active is
set and remove deprecated_print_frame_info_listing_hook.

A quick test shows that this patch does not change TUIs behavior.
Nevertheless it would be better if somebody with more experience with TUI
takes a look at it.

gdb/ChangeLog

	* defs.h (deprecated_print_frame_info_listing_hook): Remove.
	* top.c (deprecated_print_frame_info_listing_hook): Remove.
	* stack.c (tui/tui.h): New include.
	(TUI_ACTIVE): New define.
	(print_frame_info): Adjust.
	* tui/tui-hooks (tui_dummy_print_frame_info_listing_hook): Remove.
	(tui_install_hooks, tui_remove_hooks): Adjust.
	* interps.c (clear_interpreter_hooks): Adjust.
---
 gdb/defs.h          |  4 ----
 gdb/interps.c       |  1 -
 gdb/stack.c         | 42 +++++++++++++++++-------------------------
 gdb/top.c           |  6 ------
 gdb/tui/tui-hooks.c | 19 -------------------
 5 files changed, 17 insertions(+), 55 deletions(-)

diff --git a/gdb/defs.h b/gdb/defs.h
index e15ddf7..ac51ed2 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -666,10 +666,6 @@ extern void (*deprecated_show_load_progress) (const char *section,
 					      unsigned long section_size, 
 					      unsigned long total_sent, 
 					      unsigned long total_size);
-extern void (*deprecated_print_frame_info_listing_hook) (struct symtab * s,
-							 int line,
-							 int stopline,
-							 int noerror);
 extern int (*deprecated_query_hook) (const char *, va_list)
      ATTRIBUTE_FPTR_PRINTF(1,0);
 
diff --git a/gdb/interps.c b/gdb/interps.c
index aaab99c..2d983d6 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -388,7 +388,6 @@ interp_exec (struct interp *interp, const char *command_str)
 void
 clear_interpreter_hooks (void)
 {
-  deprecated_print_frame_info_listing_hook = 0;
   /*print_frame_more_info_hook = 0; */
   deprecated_query_hook = 0;
   deprecated_error_begin_hook = 0;
diff --git a/gdb/stack.c b/gdb/stack.c
index aa3a80e..d13ec30 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -48,6 +48,13 @@
 #include "cli/cli-utils.h"
 #include "objfiles.h"
 
+#ifdef TUI
+#include "tui/tui.h"
+#define TUI_ACTIVE tui_active
+#else
+#define TUI_ACTIVE 0
+#endif
+
 #include "safe-ctype.h"
 #include "symfile.h"
 #include "extension.h"
@@ -889,34 +896,19 @@ print_frame_info (struct frame_info *frame, int print_level,
       if (annotation_level)
 	done = identify_source_line (sal.symtab, sal.line, mid_statement,
 				     get_frame_pc (frame));
-      if (!done)
+      if (!done && !TUI_ACTIVE)
 	{
-	  if (deprecated_print_frame_info_listing_hook)
-	    deprecated_print_frame_info_listing_hook (sal.symtab, 
-						      sal.line, 
-						      sal.line + 1, 0);
-	  else
-	    {
-	      struct value_print_options opts;
-
-	      get_user_print_options (&opts);
-	      /* We used to do this earlier, but that is clearly
-		 wrong.  This function is used by many different
-		 parts of gdb, including normal_stop in infrun.c,
-		 which uses this to print out the current PC
-		 when we stepi/nexti into the middle of a source
-		 line.  Only the command line really wants this
-		 behavior.  Other UIs probably would like the
-		 ability to decide for themselves if it is desired.  */
-	      if (opts.addressprint && mid_statement)
-		{
-		  uiout->field_core_addr ("addr",
-					  gdbarch, get_frame_pc (frame));
-		  uiout->text ("\t");
-		}
+	  struct value_print_options opts;
 
-	      print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
+	  get_user_print_options (&opts);
+	  if (opts.addressprint && mid_statement)
+	    {
+	      uiout->field_core_addr ("addr",
+				      gdbarch, get_frame_pc (frame));
+	      uiout->text ("\t");
 	    }
+
+	  print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
 	}
 
       /* If disassemble-next-line is set to on and there is line debug
diff --git a/gdb/top.c b/gdb/top.c
index 6fac99b..d637209 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -184,12 +184,6 @@ char *lim_at_start;
 
 /* Hooks for alternate command interfaces.  */
 
-/* Called from print_frame_info to list the line we stopped in.  */
-
-void (*deprecated_print_frame_info_listing_hook) (struct symtab * s, 
-						  int line,
-						  int stopline, 
-						  int noerror);
 /* Replaces most of query.  */
 
 int (*deprecated_query_hook) (const char *, va_list);
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 315f5b2..ccc0143 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -160,17 +160,6 @@ tui_refresh_frame_and_register_information (int registers_too_p)
   do_cleanups (old_chain);
 }
 
-/* Dummy callback for deprecated_print_frame_info_listing_hook which is called
-   from print_frame_info.  */
-
-static void
-tui_dummy_print_frame_info_listing_hook (struct symtab *s,
-					 int line,
-					 int stopline, 
-					 int noerror)
-{
-}
-
 /* Perform all necessary cleanups regarding our module's inferior data
    that is required after the inferior INF just exited.  */
 
@@ -219,13 +208,6 @@ static struct observer *tui_register_changed_observer;
 void
 tui_install_hooks (void)
 {
-  /* If this hook is not set to something then print_frame_info will
-     assume that the CLI, not the TUI, is active, and will print the frame info
-     for us in such a way that we are not prepared to handle.  This hook is
-     otherwise effectively obsolete.  */
-  deprecated_print_frame_info_listing_hook
-    = tui_dummy_print_frame_info_listing_hook;
-
   /* Install the event hooks.  */
   tui_bp_created_observer
     = observer_attach_breakpoint_created (tui_event_create_breakpoint);
@@ -247,7 +229,6 @@ tui_install_hooks (void)
 void
 tui_remove_hooks (void)
 {
-  deprecated_print_frame_info_listing_hook = 0;
   deprecated_query_hook = 0;
   /* Remove our observers.  */
   observer_detach_breakpoint_created (tui_bp_created_observer);
-- 
2.8.4


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