public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Introduce tui_win_info::clear_detail method
@ 2019-06-25 13:57 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-06-25 13:57 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8761a91b2614304963bfe211ff8c682c7eba3b51

commit 8761a91b2614304963bfe211ff8c682c7eba3b51
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Jun 16 10:42:09 2019 -0600

    Introduce tui_win_info::clear_detail method
    
    This introduces the clear_detail method and updates the various
    subclasses of tui_win_info to implement it.  A subsequent patch will
    remove tui_clear_win_detail, but that isn't done for now because at
    this point it isn't readily obvious that the NULL check is not needed.
    
    gdb/ChangeLog
    2019-06-25  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui-data.h (struct tui_win_info, struct tui_source_window)
    	(struct tui_data_window, struct tui_cmd_window): Declare
    	clear_detail method.
    	* tui/tui-data.c (tui_source_window::clear_detail)
    	(tui_cmd_window::clear_detail, tui_data_window::clear_detail): New
    	methods.
    	(tui_clear_win_detail): Simplify.

Diff:
---
 gdb/ChangeLog      | 10 ++++++++++
 gdb/tui/tui-data.c | 57 ++++++++++++++++++++++++++++++------------------------
 gdb/tui/tui-data.h |  9 +++++++++
 3 files changed, 51 insertions(+), 25 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a9f7089..cf6dff8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
 2019-06-25  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-data.h (struct tui_win_info, struct tui_source_window)
+	(struct tui_data_window, struct tui_cmd_window): Declare
+	clear_detail method.
+	* tui/tui-data.c (tui_source_window::clear_detail)
+	(tui_cmd_window::clear_detail, tui_data_window::clear_detail): New
+	methods.
+	(tui_clear_win_detail): Simplify.
+
+2019-06-25  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-layout.c (make_source_window, make_disasm_window)
 	(make_source_or_disasm_window): Remove win_info_ptr parameter.
 	Return the new window.
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 3320b4f..9923a2f 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -178,37 +178,44 @@ tui_add_to_source_windows (struct tui_win_info *win_info)
     source_windows.list[source_windows.count++] = win_info;
 }
 
+/* See tui-data.h.  */
+
+void
+tui_source_window::clear_detail ()
+{
+  detail.source_info.gdbarch = NULL;
+  detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
+  detail.source_info.start_line_or_addr.u.addr = 0;
+  detail.source_info.horizontal_offset = 0;
+}
+
+/* See tui-data.h.  */
+
+void
+tui_cmd_window::clear_detail ()
+{
+  wmove (generic.handle, 0, 0);
+}
+
+/* See tui-data.h.  */
+
+void
+tui_data_window::clear_detail ()
+{
+  detail.data_display_info.data_content = NULL;
+  detail.data_display_info.data_content_count = 0;
+  detail.data_display_info.regs_content = NULL;
+  detail.data_display_info.regs_content_count = 0;
+  detail.data_display_info.regs_column_count = 1;
+  detail.data_display_info.display_regs = FALSE;
+}
 
 /* Clear the pertinant detail in the windows.  */
 void
 tui_clear_win_detail (struct tui_win_info *win_info)
 {
   if (win_info != NULL)
-    {
-      switch (win_info->generic.type)
-	{
-	case SRC_WIN:
-	case DISASSEM_WIN:
-	  win_info->detail.source_info.gdbarch = NULL;
-	  win_info->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
-	  win_info->detail.source_info.start_line_or_addr.u.addr = 0;
-	  win_info->detail.source_info.horizontal_offset = 0;
-	  break;
-	case CMD_WIN:
-	  wmove (win_info->generic.handle, 0, 0);
-	  break;
-	case DATA_WIN:
-	  win_info->detail.data_display_info.data_content = NULL;
-	  win_info->detail.data_display_info.data_content_count = 0;
-	  win_info->detail.data_display_info.regs_content = NULL;
-	  win_info->detail.data_display_info.regs_content_count = 0;
-	  win_info->detail.data_display_info.regs_column_count = 1;
-	  win_info->detail.data_display_info.display_regs = FALSE;
-	  break;
-	default:
-	  break;
-	}
-    }
+    win_info->clear_detail ();
 }
 
 
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 1627625..5006604 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -280,6 +280,9 @@ public:
 
   virtual ~tui_win_info ();
 
+  /* Clear the pertinent detail in the window.  */
+  virtual void clear_detail () = 0;
+
   struct tui_gen_win_info generic;	/* General window information.  */
   union
   {
@@ -300,18 +303,24 @@ struct tui_source_window : public tui_win_info
 {
   explicit tui_source_window (enum tui_win_type type);
   DISABLE_COPY_AND_ASSIGN (tui_source_window);
+
+  void clear_detail () override;
 };
 
 struct tui_data_window : public tui_win_info
 {
   tui_data_window ();
   DISABLE_COPY_AND_ASSIGN (tui_data_window);
+
+  void clear_detail () override;
 };
 
 struct tui_cmd_window : public tui_win_info
 {
   tui_cmd_window ();
   DISABLE_COPY_AND_ASSIGN (tui_cmd_window);
+
+  void clear_detail () override;
 };
 
 extern int tui_win_is_source_type (enum tui_win_type win_type);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-25 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 13:57 [binutils-gdb] Introduce tui_win_info::clear_detail method Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).