Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Philipp Rudo <prudo@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: arnez@linux.vnet.ibm.com
Subject: [PATCH 11/11] Remove deprecated_print_frame_info_listing_hook
Date: Tue, 28 Feb 2017 14:50:00 -0000	[thread overview]
Message-ID: <20170228145016.22604-12-prudo@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170228145016.22604-1-prudo@linux.vnet.ibm.com>

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


  parent reply	other threads:[~2017-02-28 14:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 14:50 [PATCH 00/11] Cleanup deprecated_*_hooks in defs.h Philipp Rudo
2017-02-28 14:50 ` [PATCH 02/11] Remove unused deprecated_ui_loop_hook Philipp Rudo
2017-02-28 14:50 ` [PATCH 09/11] Remove unused deprecated_call_command_hook Philipp Rudo
2017-02-28 14:50 ` [PATCH 01/11] Remove unused deprecated_{pre|post}_add_symbol_hook Philipp Rudo
2017-02-28 14:50 ` [PATCH 05/11] Remove unused deprecated_readline{_begin|_end}_hook Philipp Rudo
2017-02-28 14:50 ` Philipp Rudo [this message]
2017-02-28 14:50 ` [PATCH 06/11] Remove unused deprecated_context_hook Philipp Rudo
2017-02-28 14:50 ` [PATCH 08/11] Remove unused deprecated_{attach|detach}_hook Philipp Rudo
2017-02-28 14:50 ` [PATCH 10/11] Remove unused deprecated_ui_load_progress_hook Philipp Rudo
2017-02-28 14:50 ` [PATCH 03/11] Remove unused deprecated_warning_hook Philipp Rudo
2017-02-28 15:28 ` [PATCH 00/11] Cleanup deprecated_*_hooks in defs.h Tom Tromey
2017-02-28 15:52   ` Simon Marchi
2017-03-01  9:11     ` Philipp Rudo
2017-03-01 22:17       ` Yao Qi
2017-02-28 18:01 ` [PATCH 04/11] Remove unused deprecated_interactive_hook Philipp Rudo
2017-02-28 19:37 ` [PATCH 00/11] Cleanup deprecated_*_hooks in defs.h Keith Seitz
2017-02-28 19:45 ` [PATCH 07/11] Remove unused deprecated_target_wait_hook Philipp Rudo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170228145016.22604-12-prudo@linux.vnet.ibm.com \
    --to=prudo@linux.vnet.ibm.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox