public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 09/15] Turn tui_erase_source_content into a method
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (10 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 14/15] Change TUI source window iteration Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 01/15] Simplify TUI boxing Tom Tromey
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes tui_erase_source_content into a method on
tui_source_window_base.  The bulk of the work is moved into a helper
method, so that the callers can each pass the string appropriate to
the particular window class.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<do_erase_source_content>: New method.
	<erase_source_content>: New method.
	(tui_erase_source_content): Don't declare.
	* tui/tui-winsource.c (tui_clear_source_content): Update.
	(tui_source_window_base::do_erase_source_content): Rename from
	tui_erase_source_content.
	(tui_source_window_base::show_source_content): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
	* tui/tui-source.h (struct tui_source_window)
	<erase_source_content>: New method.
	* tui/tui-disasm.h (struct tui_disasm_window)
	<erase_source_content>: New method.
---
 gdb/ChangeLog           | 16 ++++++++++++++++
 gdb/tui/tui-disasm.h    |  5 +++++
 gdb/tui/tui-source.h    |  5 +++++
 gdb/tui/tui-win.c       | 10 +++++-----
 gdb/tui/tui-winsource.c | 40 ++++++++++++++++------------------------
 gdb/tui/tui-winsource.h |  7 ++++++-
 6 files changed, 53 insertions(+), 30 deletions(-)

diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index 71b911182f8..24073e1dc19 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -48,6 +48,11 @@ struct tui_disasm_window : public tui_source_window_base
 		     int line_no, CORE_ADDR addr)
     override;
 
+  void erase_source_content () override
+  {
+    do_erase_source_content (NO_DISASSEM_STRING);
+  }
+
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 42338790947..2926777ab3f 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -51,6 +51,11 @@ struct tui_source_window : public tui_source_window_base
 		     int line_no, CORE_ADDR addr)
     override;
 
+  void erase_source_content () override
+  {
+    do_erase_source_content (NO_SRC_STRING);
+  }
+
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index ff4f2ee5b39..7210f6c4119 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -595,7 +595,7 @@ tui_resize_all (void)
 	  first_win->make_visible_with_new_height ();
 	  TUI_CMD_WIN->make_visible_with_new_height ();
 	  if (src_win->content.empty ())
-	    tui_erase_source_content (src_win);
+	    src_win->erase_source_content ();
 	  break;
 	default:
 	  if (cur_layout == SRC_DISASSEM_COMMAND)
@@ -659,7 +659,7 @@ tui_resize_all (void)
 	  second_win->make_visible_with_new_height ();
 	  TUI_CMD_WIN->make_visible_with_new_height ();
 	  if (src_win->content.empty ())
-	    tui_erase_source_content (src_win);
+	    src_win->erase_source_content ();
 	  break;
 	}
 
@@ -1065,7 +1065,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 		  tui_source_window_base *src_base
 		    = (tui_source_window_base *) src_win_info;
 		  if (src_base->content.empty ())
-		    tui_erase_source_content (src_base);
+		    src_base->erase_source_content ();
 		}
 	    }
 	  else
@@ -1169,9 +1169,9 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 	      second_win->make_visible_with_new_height ();
 	      first_win->make_visible_with_new_height ();
 	      if (src1 != nullptr && src1->content.empty ())
-		tui_erase_source_content (src1);
+		src1->erase_source_content ();
 	      if (second_win->content.empty ())
-		tui_erase_source_content (second_win);
+		second_win->erase_source_content ();
 	    }
 	}
     }
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 121f19abd8b..d955efcd575 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -198,7 +198,7 @@ tui_clear_source_content (struct tui_source_window_base *win_info)
     {
       int i;
 
-      tui_erase_source_content (win_info);
+      win_info->erase_source_content ();
       for (i = 0; i < win_info->content.size (); i++)
 	{
 	  struct tui_source_element *element = &win_info->content[i];
@@ -211,38 +211,30 @@ tui_clear_source_content (struct tui_source_window_base *win_info)
 
 
 void
-tui_erase_source_content (struct tui_source_window_base *win_info)
+tui_source_window_base::do_erase_source_content (const char *str)
 {
   int x_pos;
-  int half_width = (win_info->width - 2) / 2;
+  int half_width = (width - 2) / 2;
 
-  if (win_info->handle != NULL)
+  if (handle != NULL)
     {
-      werase (win_info->handle);
-      win_info->check_and_display_highlight_if_needed ();
+      werase (handle);
+      check_and_display_highlight_if_needed ();
 
-      const char *no_src_str;
-
-      if (win_info->type == SRC_WIN)
-	no_src_str = NO_SRC_STRING;
-      else
-	no_src_str = NO_DISASSEM_STRING;
-      if (strlen (no_src_str) >= half_width)
+      if (strlen (str) >= half_width)
 	x_pos = 1;
       else
-	x_pos = half_width - strlen (no_src_str);
-      mvwaddstr (win_info->handle,
-		 (win_info->height / 2),
+	x_pos = half_width - strlen (str);
+      mvwaddstr (handle,
+		 (height / 2),
 		 x_pos,
-		 (char *) no_src_str);
-
-      win_info->content.clear ();
-      win_info->refresh_window ();
+		 (char *) str);
 
-      struct tui_gen_win_info *exec_info = win_info->execution_info;
+      content.clear ();
+      refresh_window ();
 
-      werase (exec_info->handle);
-      exec_info->refresh_window ();
+      werase (execution_info->handle);
+      execution_info->refresh_window ();
     }
 }
 
@@ -284,7 +276,7 @@ tui_source_window_base::show_source_content ()
         tui_show_source_line (this, lineno);
     }
   else
-    tui_erase_source_content (this);
+    erase_source_content ();
 
   check_and_display_highlight_if_needed ();
   refresh_window ();
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 320c8370166..60031d3bdb0 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -100,6 +100,9 @@ protected:
   void do_scroll_horizontal (int num_to_scroll) override;
   void do_make_visible_with_new_height () override;
 
+  /* Erase the content and display STRING.  */
+  void do_erase_source_content (const char *string);
+
 public:
 
   void clear_detail ();
@@ -131,6 +134,9 @@ public:
   virtual void maybe_update (struct frame_info *fi, symtab_and_line sal,
 			     int line_no, CORE_ADDR addr) = 0;
 
+  /* Erase the source content.  */
+  virtual void erase_source_content () = 0;
+
   /* Does the locator belong to this window?  */
   bool m_has_locator = false;
   /* Execution information window.  */
@@ -180,7 +186,6 @@ extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
 extern void tui_update_source_windows_with_line (struct symtab *, 
 						 int);
 extern void tui_clear_source_content (struct tui_source_window_base *);
-extern void tui_erase_source_content (struct tui_source_window_base *);
 
 /* Constant definitions. */
 #define SCROLL_THRESHOLD 2	/* Threshold for lazy scroll.  */
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 03/15] Move locator code to tui-stack.c
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (5 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 06/15] Change tui_addr_is_displayed into a method Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 07/15] Change tui_line_is_displayed to be a method Tom Tromey
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The locator is mostly implemented in tui-stack.c.  This moves the
remaining bits to tui-stack.c and tui-stack.h, as appropriate.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c: Include tui-stack.h.
	* tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN)
	(struct tui_locator_window): Move from tui-data.h.
	* tui/tui-stack.c (_locator, tui_locator_win_info_ptr)
	(tui_initialize_static_data): Move from tui-data.c.
	* tui/tui-data.h (MAX_LOCATOR_ELEMENT_LEN)
	(struct tui_locator_window): Move to tui-stack.c.
	* tui/tui-data.c (_locator, tui_locator_win_info_ptr)
	(tui_initialize_static_data): Move to tui-stack.c.
---
 gdb/ChangeLog            | 12 ++++++++++++
 gdb/tui/tui-data.c       | 25 -------------------------
 gdb/tui/tui-data.h       | 25 -------------------------
 gdb/tui/tui-stack.c      | 25 +++++++++++++++++++++++++
 gdb/tui/tui-stack.h      | 27 +++++++++++++++++++++++++++
 gdb/tui/tui-wingeneral.c |  1 +
 6 files changed, 65 insertions(+), 50 deletions(-)

diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index add1f33926f..c308237d187 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -36,7 +36,6 @@ struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
 ** Private data
 ****************************/
 static int term_height, term_width;
-static struct tui_locator_window _locator;
 static std::vector<tui_source_window_base *> source_windows;
 static struct tui_win_info *win_with_focus = NULL;
 
@@ -128,15 +127,6 @@ tui_add_to_source_windows (struct tui_source_window_base *win_info)
     source_windows.push_back (win_info);
 }
 
-/* Accessor for the locator win info.  Answers a pointer to the static
-   locator win info struct.  */
-struct tui_locator_window *
-tui_locator_win_info_ptr (void)
-{
-  return &_locator;
-}
-
-
 /* Accessor for the term_height.  */
 int
 tui_term_height (void)
@@ -253,21 +243,6 @@ tui_partial_win_by_name (const char *name)
   return NULL;
 }
 
-
-void
-tui_initialize_static_data ()
-{
-  tui_gen_win_info *win = tui_locator_win_info_ptr ();
-  win->width =
-    win->height =
-    win->origin.x =
-    win->origin.y =
-    win->viewport_height = 0;
-  win->handle = NULL;
-  win->is_visible = false;
-  win->title = 0;
-}
-
 /* See tui-data.h.  */
 
 void
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 017e7a40f52..b5eeecdee97 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -148,31 +148,6 @@ struct tui_line_or_address
     } u;
 };
 
-#ifdef PATH_MAX
-# define MAX_LOCATOR_ELEMENT_LEN        PATH_MAX
-#else
-# define MAX_LOCATOR_ELEMENT_LEN        1024
-#endif
-
-/* Locator window class.  */
-
-struct tui_locator_window : public tui_gen_win_info
-{
-  tui_locator_window ()
-    : tui_gen_win_info (LOCATOR_WIN)
-  {
-    full_name[0] = 0;
-    proc_name[0] = 0;
-  }
-
-  char full_name[MAX_LOCATOR_ELEMENT_LEN];
-  char proc_name[MAX_LOCATOR_ELEMENT_LEN];
-  int line_no = 0;
-  CORE_ADDR addr = 0;
-  /* Architecture associated with code at this location.  */
-  struct gdbarch *gdbarch = nullptr;
-};
-
 /* This defines information about each logical window.  */
 struct tui_win_info : public tui_gen_win_info
 {
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 0a712231fa5..c67ac1ba549 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -39,6 +39,8 @@
 
 #include "gdb_curses.h"
 
+static struct tui_locator_window _locator;
+
 /* Get a printable name for the function at the address.
    The symbol name is demangled if demangling is turned on.
    Returns a pointer to a static area holding the result.  */
@@ -56,6 +58,29 @@ static int tui_set_locator_info (struct gdbarch *gdbarch,
 static void tui_update_command (const char *, int);
 \f
 
+/* Accessor for the locator win info.  Answers a pointer to the static
+   locator win info struct.  */
+struct tui_locator_window *
+tui_locator_win_info_ptr (void)
+{
+  return &_locator;
+}
+
+void
+tui_initialize_static_data ()
+{
+  tui_gen_win_info *win = tui_locator_win_info_ptr ();
+  win->width =
+    win->height =
+    win->origin.x =
+    win->origin.y =
+    win->viewport_height = 0;
+  win->handle = NULL;
+  win->is_visible = false;
+  win->title = 0;
+}
+
+
 /* Create the status line to display as much information as we can on
    this single line: target name, process number, current function,
    current line, current PC, SingleKey mode.  */
diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h
index 0a88f49932e..51c976b2f56 100644
--- a/gdb/tui/tui-stack.h
+++ b/gdb/tui/tui-stack.h
@@ -22,8 +22,35 @@
 #ifndef TUI_TUI_STACK_H
 #define TUI_TUI_STACK_H
 
+#include "tui/tui-data.h"
+
 struct frame_info;
 
+#ifdef PATH_MAX
+# define MAX_LOCATOR_ELEMENT_LEN        PATH_MAX
+#else
+# define MAX_LOCATOR_ELEMENT_LEN        1024
+#endif
+
+/* Locator window class.  */
+
+struct tui_locator_window : public tui_gen_win_info
+{
+  tui_locator_window ()
+    : tui_gen_win_info (LOCATOR_WIN)
+  {
+    full_name[0] = 0;
+    proc_name[0] = 0;
+  }
+
+  char full_name[MAX_LOCATOR_ELEMENT_LEN];
+  char proc_name[MAX_LOCATOR_ELEMENT_LEN];
+  int line_no = 0;
+  CORE_ADDR addr = 0;
+  /* Architecture associated with code at this location.  */
+  struct gdbarch *gdbarch = nullptr;
+};
+
 extern void tui_update_locator_fullname (const char *);
 extern void tui_show_locator_content (void);
 extern int tui_show_frame_info (struct frame_info *);
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index e2d06bcebad..52583cfb8ac 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -24,6 +24,7 @@
 #include "tui/tui-data.h"
 #include "tui/tui-wingeneral.h"
 #include "tui/tui-win.h"
+#include "tui/tui-stack.h"
 
 #include "gdb_curses.h"
 
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 06/15] Change tui_addr_is_displayed into a method
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (4 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 15/15] TUI window resize should not need invisibility Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-15 16:28   ` Pedro Alves
  2019-08-14 16:21 ` [PATCH 03/15] Move locator code to tui-stack.c Tom Tromey
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes tui_addr_is_displayed to be a method on
tui_disasm_window, now that it is obvious that it can only be called
for this type.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_addr_is_displayed): Don't declare.
	* tui/tui-winsource.c (tui_addr_is_displayed): Move to
	tui-disasm.c.
	* tui/tui-disasm.h (struct tui_disasm_window) <addr_is_displayed>:
	Declare.
	* tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): New
	method.
	(tui_disasm_window::maybe_update): Update.
---
 gdb/ChangeLog           | 11 +++++++++++
 gdb/tui/tui-disasm.c    | 20 +++++++++++++++++++-
 gdb/tui/tui-disasm.h    |  4 ++++
 gdb/tui/tui-winsource.c | 28 ----------------------------
 gdb/tui/tui-winsource.h |  3 ---
 5 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index fcb33bccfd7..e55f35da214 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -381,6 +381,24 @@ tui_disasm_window::location_matches_p (struct bp_location *loc, int line_no)
 	  && content[line_no].line_or_addr.u.addr == loc->address);
 }
 
+bool
+tui_disasm_window::addr_is_displayed (CORE_ADDR addr) const
+{
+  bool is_displayed = false;
+  int threshold = SCROLL_THRESHOLD;
+
+  int i = 0;
+  while (i < content.size () - threshold && !is_displayed)
+    {
+      is_displayed
+	= (content[i].line_or_addr.loa == LOA_ADDRESS
+	   && content[i].line_or_addr.u.addr == addr);
+      i++;
+    }
+
+  return is_displayed;
+}
+
 void
 tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
 				 int line_no, CORE_ADDR addr)
@@ -402,7 +420,7 @@ tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
 
   a.loa = LOA_ADDRESS;
   a.u.addr = low;
-  if (!tui_addr_is_displayed (addr, this, TRUE))
+  if (!addr_is_displayed (addr))
     tui_update_source_window (this, get_frame_arch (fi),
 			      sal.symtab, a, TRUE);
   else
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index 20bc4290ffc..71b911182f8 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -51,6 +51,10 @@ struct tui_disasm_window : public tui_source_window_base
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
+
+private:
+  bool addr_is_displayed (CORE_ADDR addr) const;
+
 };
 
 extern enum tui_status tui_set_disassem_content (tui_source_window_base *,
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 1b2b4393fd9..e8e7061d0f2 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -668,31 +668,3 @@ tui_line_is_displayed (int line,
 
   return is_displayed;
 }
-
-
-/* Answer whether a particular line number or address is displayed
-   in the current source window.  */
-int
-tui_addr_is_displayed (CORE_ADDR addr, 
-		       struct tui_source_window_base *win_info,
-		       int check_threshold)
-{
-  int is_displayed = FALSE;
-  int i, threshold;
-
-  if (check_threshold)
-    threshold = SCROLL_THRESHOLD;
-  else
-    threshold = 0;
-  i = 0;
-  while (i < win_info->content.size () - threshold
-	 && !is_displayed)
-    {
-      is_displayed
-	= win_info->content[i].line_or_addr.loa == LOA_ADDRESS
-	  && win_info->content[i].line_or_addr.u.addr == addr;
-      i++;
-    }
-
-  return is_displayed;
-}
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index ed6cbec7626..fb9c05cadc8 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -175,9 +175,6 @@ extern void tui_alloc_source_buffer (struct tui_source_window_base *);
 extern int tui_line_is_displayed (int,
 				  struct tui_source_window_base *,
 				  int);
-extern int tui_addr_is_displayed (CORE_ADDR,
-				  struct tui_source_window_base *,
-				  int);
 
 
 /* Constant definitions. */
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 01/15] Simplify TUI boxing
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (11 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 09/15] Turn tui_erase_source_content into a method Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 10/15] Remove tui_clear_source_content Tom Tromey
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

In the TUI, whether or not a window can be boxed is a property of the
window's type.  This adds a can_box method to the window classes, and
changes tui_make_window to defer to this, removing the "box_it"
paramter.  This also lets us remove "enum tui_box", as it is no longer
used.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_window): Update.
	* tui/tui-wingeneral.c (tui_make_window): Remove "box_it"
	parameter.
	(tui_gen_win_info::make_visible): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from):
	Update.
	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method.
	(enum tui_box): Remove.
	(struct tui_win_info) <can_box>: New method.
	* tui/tui-command.h (struct tui_cmd_window) <can_box>: New
	method.
---
 gdb/ChangeLog            | 16 ++++++++++++++++
 gdb/tui/tui-command.h    |  5 +++++
 gdb/tui/tui-data.h       | 18 +++++++++++-------
 gdb/tui/tui-layout.c     |  4 ++--
 gdb/tui/tui-regs.c       |  2 +-
 gdb/tui/tui-wingeneral.c |  7 +++----
 gdb/tui/tui-wingeneral.h |  2 +-
 7 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h
index af80b1449fa..14d77500882 100644
--- a/gdb/tui/tui-command.h
+++ b/gdb/tui/tui-command.h
@@ -55,6 +55,11 @@ struct tui_cmd_window : public tui_win_info
     return false;
   }
 
+  bool can_box () const override
+  {
+    return false;
+  }
+
   int start_line = 0;
 
 protected:
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 3493b5ed68b..017e7a40f52 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -67,6 +67,12 @@ public:
   virtual void reset (int height, int width,
 		      int origin_x, int origin_y);
 
+  /* Return true if this can be boxed.  */
+  virtual bool can_box () const
+  {
+    return false;
+  }
+
   /* Window handle.  */
   WINDOW *handle = nullptr;
   /* Type of window.  */
@@ -85,13 +91,6 @@ public:
   char *title = nullptr;
 };
 
-/* Whether or not a window should be drawn with a box.  */
-enum tui_box
-{
-  DONT_BOX_WINDOW = 0,
-  BOX_WINDOW
-};
-
 /* Constant definitions.  */
 #define DEFAULT_TAB_LEN         8
 #define NO_SRC_STRING           "[ No Source Available ]"
@@ -248,6 +247,11 @@ public:
     return true;
   }
 
+  bool can_box () const override
+  {
+    return true;
+  }
+
   void check_and_display_highlight_if_needed ();
 
   /* Can this window ever be highlighted?  */
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 3683835954d..69b929d37b2 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -546,7 +546,7 @@ show_source_disasm_command (void)
 		      tui_term_height () - cmd_height);
   /* FIXME tui_cmd_window won't recreate the handle on
      make_visible, so we need this instead.  */
-  tui_make_window (TUI_CMD_WIN, DONT_BOX_WINDOW);
+  tui_make_window (TUI_CMD_WIN);
   current_layout = SRC_DISASSEM_COMMAND;
 }
 
@@ -674,6 +674,6 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 		      src_height);
   /* FIXME tui_cmd_window won't recreate the handle on
      make_visible, so we need this instead.  */
-  tui_make_window (TUI_CMD_WIN, DONT_BOX_WINDOW);
+  tui_make_window (TUI_CMD_WIN);
   current_layout = layout_type;
 }
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index aaba94da467..bb8d545c47b 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -320,7 +320,7 @@ tui_data_window::display_registers_from (int start_element_no)
 		  data_item_win->width = item_win_width;
 		  data_item_win->origin.x = (item_win_width * j) + 1;
 		  data_item_win->origin.y = cur_y;
-		  tui_make_window (data_item_win, DONT_BOX_WINDOW);
+		  tui_make_window (data_item_win);
                   scrollok (data_item_win->handle, FALSE);
 		}
               touchwin (data_item_win->handle);
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 8ff5aa5fce8..e2d06bcebad 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -125,7 +125,7 @@ tui_win_info::check_and_display_highlight_if_needed ()
 
 
 void
-tui_make_window (struct tui_gen_win_info *win_info, enum tui_box box_it)
+tui_make_window (struct tui_gen_win_info *win_info)
 {
   WINDOW *handle;
 
@@ -136,7 +136,7 @@ tui_make_window (struct tui_gen_win_info *win_info, enum tui_box box_it)
   win_info->handle = handle;
   if (handle != NULL)
     {
-      if (box_it == BOX_WINDOW)
+      if (win_info->can_box ())
 	box_win (win_info, NO_HILITE);
       win_info->is_visible = true;
       scrollok (handle, TRUE);
@@ -155,8 +155,7 @@ tui_gen_win_info::make_visible (bool visible)
   is_visible = visible;
 
   if (visible)
-    tui_make_window (this, (tui_win_is_auxiliary (type)
-			    ? DONT_BOX_WINDOW : BOX_WINDOW));
+    tui_make_window (this);
   else
     {
       tui_delete_win (handle);
diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h
index 54d6eb684f7..6a9de4c9b1c 100644
--- a/gdb/tui/tui-wingeneral.h
+++ b/gdb/tui/tui-wingeneral.h
@@ -31,7 +31,7 @@ struct tui_gen_win_info;
 extern void tui_make_all_invisible (void);
 
 extern void tui_unhighlight_win (struct tui_win_info *);
-extern void tui_make_window (struct tui_gen_win_info *, enum tui_box);
+extern void tui_make_window (struct tui_gen_win_info *);
 extern void tui_highlight_win (struct tui_win_info *);
 extern void tui_refresh_all ();
 extern void tui_delete_win (WINDOW *window);
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 15/15] TUI window resize should not need invisibility
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (3 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 08/15] Remove tui_alloc_source_buffer Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 06/15] Change tui_addr_is_displayed into a method Tom Tromey
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

When resizing a window, the TUI currently first makes it invisible,
then changes the size, and then restores its visibility.

I think this is done because curses doesn't truly support resizing a
window -- there is a "wresize" extension, but the man page says it
isn't available in all versions of curses.

First, this is probably not a major problem any more.  I imagine most
of those old systems are gone now.

Second, I think it's a better API to have this detail hidden inside of
the resize method.

This patch changes the code to follow this idea, and changes the
ordinary resize method to use wresize when it is available.  The
special case for the command window is also moved to methods on the
command window.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_layout, show_source_disasm_command)
	(show_data): Don't change window visibility.
	(tui_gen_win_info::resize): Remove special case for command
	window.  Use wresize, when available.
	(show_source_or_disasm_and_command): Don't change window
	visibility.
	* tui/tui-command.h (struct tui_cmd_window) <resize>: Declare.
	<make_visible>: New method.
	* tui/tui-command.c (tui_cmd_window::resize): New method.
---
 gdb/ChangeLog         | 12 ++++++++++++
 gdb/tui/tui-command.c | 35 ++++++++++++++++++++++++++++++++++
 gdb/tui/tui-command.h |  7 +++++++
 gdb/tui/tui-layout.c  | 44 +++++++++++++++++++++----------------------
 4 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c
index 034abd57982..ddbd8bccea5 100644
--- a/gdb/tui/tui-command.c
+++ b/gdb/tui/tui-command.c
@@ -25,6 +25,7 @@
 #include "tui/tui-win.h"
 #include "tui/tui-io.h"
 #include "tui/tui-command.h"
+#include "tui/tui-wingeneral.h"
 
 #include "gdb_curses.h"
 
@@ -48,6 +49,40 @@ tui_cmd_window::max_height () const
   return tui_term_height () - 4;
 }
 
+void
+tui_cmd_window::resize (int height_, int width_, int origin_x, int origin_y)
+{
+  width = width_;
+  height = height_;
+  if (height > 1)
+    {
+      /* Note this differs from the base class implementation, because
+	 this window can't be boxed.  */
+      viewport_height = height - 1;
+    }
+  else
+    viewport_height = 1;
+  origin.x = origin_x;
+  origin.y = origin_y;
+
+  if (handle == nullptr)
+    tui_make_window (this);
+  else
+    {
+      /* Another reason we don't call the base class method here is
+	 that for the command window in particular, we want to avoid
+	 destroying the underlying handle.  We don't currently track
+	 the contents of this window, and so have no way to re-render
+	 it.  However we can at least move it and keep the old size if
+	 wresize isn't available.  */
+#ifdef HAVE_WRESIZE
+      wresize (handle, height, width);
+#endif
+      mvwin (handle, origin.y, origin.x);
+      wmove (handle, 0, 0);
+    }
+}
+
 /* See tui-command.h.  */
 
 void
diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h
index 1892956fe77..1fce0a18126 100644
--- a/gdb/tui/tui-command.h
+++ b/gdb/tui/tui-command.h
@@ -56,6 +56,13 @@ struct tui_cmd_window : public tui_win_info
     return false;
   }
 
+  void resize (int height, int width, int origin_x, int origin_y) override;
+
+  void make_visible (bool visible) override
+  {
+    /* The command window can't be made invisible.  */
+  }
+
   int start_line = 0;
 
 protected:
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 4ea604a1017..e0e804bac2a 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -76,9 +76,7 @@ show_layout (enum tui_layout_type layout)
 
   if (layout != cur_layout)
     {
-      /* First make the current layout be invisible.  */
       tui_make_all_invisible ();
-      tui_locator_win_info_ptr ()->make_visible (false);
       switch (layout)
 	{
 	case SRC_DATA_COMMAND:
@@ -506,7 +504,6 @@ show_source_disasm_command (void)
 		       tui_term_width (),
 		       0,
 		       0);
-  TUI_SRC_WIN->make_visible (true);
   TUI_SRC_WIN->m_has_locator = false;
 
   struct tui_locator_window *locator = tui_locator_win_info_ptr ();
@@ -519,14 +516,12 @@ show_source_disasm_command (void)
 			  tui_term_width (),
 			  0,
 			  src_height - 1);
-  TUI_DISASM_WIN->make_visible (true);
   locator->resize (2 /* 1 */ ,
 		   tui_term_width (),
 		   0,
 		   (src_height + asm_height) - 1);
   TUI_SRC_WIN->m_has_locator = false;
   TUI_DISASM_WIN->m_has_locator = true;
-  locator->make_visible (true);
   tui_show_locator_content ();
   TUI_DISASM_WIN->show_source_content ();
 
@@ -536,7 +531,6 @@ show_source_disasm_command (void)
 		       tui_term_width (),
 		       0,
 		       tui_term_height () - cmd_height);
-  TUI_CMD_WIN->make_visible (true);
   current_layout = SRC_DISASSEM_COMMAND;
 }
 
@@ -558,7 +552,6 @@ show_data (enum tui_layout_type new_layout)
   if (tui_win_list[DATA_WIN] == nullptr)
     tui_win_list[DATA_WIN] = new tui_data_window ();
   tui_win_list[DATA_WIN]->resize (data_height, tui_term_width (), 0, 0);
-  tui_win_list[DATA_WIN]->make_visible (true);
 
   if (new_layout == SRC_DATA_COMMAND)
     win_type = SRC_WIN;
@@ -583,11 +576,11 @@ show_data (enum tui_layout_type new_layout)
 		   tui_term_width (),
 		   0,
 		   total_height - 1);
-  base->make_visible (true);
+  TUI_CMD_WIN->resize (TUI_CMD_WIN->height, tui_term_width (),
+		       0, total_height);
+
   base->m_has_locator = true;
-  locator->make_visible (true);
   tui_show_locator_content ();
-  TUI_CMD_WIN->make_visible (true);
   current_layout = new_layout;
 }
 
@@ -595,20 +588,29 @@ void
 tui_gen_win_info::resize (int height_, int width_,
 			  int origin_x_, int origin_y_)
 {
-  int h = height_;
-
   width = width_;
-  height = h;
-  if (h > 1)
-    {
-      viewport_height = h - 1;
-      if (type != CMD_WIN)
-	viewport_height--;
-    }
+  height = height_;
+  if (height > 1)
+    viewport_height = height - 2;
   else
     viewport_height = 1;
   origin.x = origin_x_;
   origin.y = origin_y_;
+
+  if (handle != nullptr)
+    {
+#ifdef HAVE_WRESIZE
+      wresize (handle, height, width);
+      mvwin (handle, origin.y, origin.x);
+      wmove (handle, 0, 0);
+#else
+      tui_delete_win (handle);
+      handle = NULL;
+#endif
+    }
+
+  if (handle == nullptr)
+    tui_make_window (this);
 }
 
 /* Show the Source/Command or the Disassem layout.  */
@@ -647,11 +649,8 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 		    tui_term_width (),
 		    0,
 		    0);
-  win_info->make_visible (true);
-
 
   win_info->m_has_locator = true;
-  locator->make_visible (true);
   tui_show_locator_content ();
   win_info->show_source_content ();
 
@@ -661,6 +660,5 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 		       tui_term_width (),
 		       0,
 		       src_height);
-  TUI_CMD_WIN->make_visible (true);
   current_layout = layout_type;
 }
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 10/15] Remove tui_clear_source_content
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (12 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 01/15] Simplify TUI boxing Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:23 ` [PATCH 04/15] Avoid string_file in tui_make_status_line Tom Tromey
  2019-08-15 16:29 ` [PATCH 00/15] Another round of TUI refactoring Pedro Alves
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

tui_clear_source_content is not needed.  Instead, the callers can call
erase_source_content, which is also changed to clear the content
vector.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_clear_source_content): Don't declare.
	* tui/tui-winsource.c (tui_update_source_window_as_is): Don't call
	tui_clear_source_content.
	(tui_clear_source_content): Remove.
	(tui_source_window_base::do_erase_source_content): Hoist call to
	content.clear().
	* tui/tui-stack.c (tui_show_frame_info): Don't call
	tui_clear_source_content.
---
 gdb/ChangeLog           | 11 +++++++++++
 gdb/tui/tui-stack.c     |  2 +-
 gdb/tui/tui-winsource.c | 25 +++----------------------
 gdb/tui/tui-winsource.h |  1 -
 4 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 09ee87f4027..f61aa526004 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -411,7 +411,7 @@ tui_show_frame_info (struct frame_info *fi)
       tui_show_locator_content ();
       for (struct tui_source_window_base *win_info : tui_source_windows ())
 	{
-	  tui_clear_source_content (win_info);
+	  win_info->erase_source_content ();
 	  win_info->update_exec_info ();
 	}
 
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index d955efcd575..95a2ac27094 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -98,7 +98,7 @@ tui_update_source_window_as_is (struct tui_source_window_base *win_info,
     ret = tui_set_disassem_content (win_info, gdbarch, line_or_addr.u.addr);
 
   if (ret == TUI_FAILURE)
-    tui_clear_source_content (win_info);
+    win_info->erase_source_content ();
   else
     {
       tui_update_breakpoint_info (win_info, nullptr, false);
@@ -153,7 +153,7 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
   else
     {
       for (struct tui_source_window_base *win_info : tui_source_windows ())
-	tui_clear_source_content (win_info);
+	win_info->erase_source_content ();
     }
 }
 
@@ -191,31 +191,13 @@ tui_update_source_windows_with_line (struct symtab *s, int line)
     }
 }
 
-void
-tui_clear_source_content (struct tui_source_window_base *win_info)
-{
-  if (win_info != NULL)
-    {
-      int i;
-
-      win_info->erase_source_content ();
-      for (i = 0; i < win_info->content.size (); i++)
-	{
-	  struct tui_source_element *element = &win_info->content[i];
-
-	  element->break_mode = 0;
-	  element->is_exec_point = false;
-	}
-    }
-}
-
-
 void
 tui_source_window_base::do_erase_source_content (const char *str)
 {
   int x_pos;
   int half_width = (width - 2) / 2;
 
+  content.clear ();
   if (handle != NULL)
     {
       werase (handle);
@@ -230,7 +212,6 @@ tui_source_window_base::do_erase_source_content (const char *str)
 		 x_pos,
 		 (char *) str);
 
-      content.clear ();
       refresh_window ();
 
       werase (execution_info->handle);
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 60031d3bdb0..b5528011f5a 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -185,7 +185,6 @@ extern void tui_update_source_window_as_is (struct tui_source_window_base *,
 extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
 extern void tui_update_source_windows_with_line (struct symtab *, 
 						 int);
-extern void tui_clear_source_content (struct tui_source_window_base *);
 
 /* Constant definitions. */
 #define SCROLL_THRESHOLD 2	/* Threshold for lazy scroll.  */
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 00/15] Another round of TUI refactoring
@ 2019-08-14 16:21 Tom Tromey
  2019-08-14 16:21 ` [PATCH 11/15] Minor simplification in tui_default_win_viewport_height Tom Tromey
                   ` (15 more replies)
  0 siblings, 16 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches

Here's another round of TUI refactoring.  This is extracted from a
longer series that I'm submitting in pieces to make it simpler to
read.

Most of these are straightforward.  Patch #8 fixes an existing bug,
see the commentary there for a description.

I tested these on x86-64 Fedora 28, by building each one and running
the gdb.tui tests.

Tom


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 07/15] Change tui_line_is_displayed to be a method
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (6 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 03/15] Move locator code to tui-stack.c Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 13/15] Rename the "reset" method to "resize" Tom Tromey
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes tui_line_is_displayed to be a method on
tui_source_window, now that it is obvious that it can only be called
for this type.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_line_is_displayed): Don't declare.
	* tui/tui-winsource.c (tui_line_is_displayed): Move to
	tui-source.c.
	* tui/tui-source.h (struct tui_source_window) <line_is_displayed>:
	Declare.
	* tui/tui-source.c (tui_source_window::line_is_displayed): New
	method.
	(tui_source_window::maybe_update): Update.
---
 gdb/ChangeLog           | 11 +++++++++++
 gdb/tui/tui-source.c    | 21 ++++++++++++++++++++-
 gdb/tui/tui-source.h    |  4 ++++
 gdb/tui/tui-winsource.c | 28 ----------------------------
 gdb/tui/tui-winsource.h |  3 ---
 5 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 34b8f54557d..7c173f8a6f9 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -294,6 +294,25 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
 			   symtab_to_fullname (loc->symtab)) == 0);
 }
 
+/* See tui-source.h.  */
+
+bool
+tui_source_window::line_is_displayed (int line) const
+{
+  bool is_displayed = false;
+  int threshold = SCROLL_THRESHOLD;
+  int i = 0;
+  while (i < content.size () - threshold && !is_displayed)
+    {
+      is_displayed
+	= (content[i].line_or_addr.loa == LOA_LINE
+	   && content[i].line_or_addr.u.line_no == line);
+      i++;
+    }
+
+  return is_displayed;
+}
+
 void
 tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
 				 int line_no, CORE_ADDR addr)
@@ -310,7 +329,7 @@ tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
   l.loa = LOA_LINE;
   l.u.line_no = start_line;
   if (!(source_already_displayed
-	&& tui_line_is_displayed (line_no, this, TRUE)))
+	&& line_is_displayed (line_no)))
     tui_update_source_window (this, get_frame_arch (fi),
 			      sal.symtab, l, TRUE);
   else
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index dc4470e9e5a..42338790947 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -59,6 +59,10 @@ private:
 
   void style_changed ();
 
+  /* Answer whether a particular line number or address is displayed
+     in the current source window.  */
+  bool line_is_displayed (int line) const;
+
   /* A token used to register and unregister an observer.  */
   gdb::observers::token m_observable;
 };
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index e8e7061d0f2..a85269657cf 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -640,31 +640,3 @@ tui_alloc_source_buffer (struct tui_source_window_base *win_info)
 	win_info->content[i].line = (char *) xmalloc (line_width);
     }
 }
-
-
-/* Answer whether a particular line number or address is displayed
-   in the current source window.  */
-int
-tui_line_is_displayed (int line, 
-		       struct tui_source_window_base *win_info,
-		       int check_threshold)
-{
-  int is_displayed = FALSE;
-  int i, threshold;
-
-  if (check_threshold)
-    threshold = SCROLL_THRESHOLD;
-  else
-    threshold = 0;
-  i = 0;
-  while (i < win_info->content.size () - threshold
-	 && !is_displayed)
-    {
-      is_displayed
-	= win_info->content[i].line_or_addr.loa == LOA_LINE
-	  && win_info->content[i].line_or_addr.u.line_no == line;
-      i++;
-    }
-
-  return is_displayed;
-}
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index fb9c05cadc8..f88f6b7de45 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -172,9 +172,6 @@ extern void tui_clear_source_content (struct tui_source_window_base *);
 extern void tui_erase_source_content (struct tui_source_window_base *);
 
 extern void tui_alloc_source_buffer (struct tui_source_window_base *);
-extern int tui_line_is_displayed (int,
-				  struct tui_source_window_base *,
-				  int);
 
 
 /* Constant definitions. */
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 11/15] Minor simplification in tui_default_win_viewport_height
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 05/15] Move contents of tui_show_frame_info to new method Tom Tromey
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

tui_default_win_viewport_height doesn't need to look at tui_win_list;
it can simply check the type directly.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (tui_default_win_viewport_height): Don't
	examine tui_win_list.
---
 gdb/ChangeLog        | 5 +++++
 gdb/tui/tui-layout.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index c2abcf4429d..d10c9a043d6 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -304,7 +304,7 @@ tui_default_win_viewport_height (enum tui_win_type type,
 
   h = tui_default_win_height (type, layout);
 
-  if (tui_win_list[type] == TUI_CMD_WIN)
+  if (type == CMD_WIN)
     h -= 1;
   else
     h -= 2;
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 08/15] Remove tui_alloc_source_buffer
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (2 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 02/15] Remove FIXMEs from tui-layout.c Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 15/15] TUI window resize should not need invisibility Tom Tromey
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

There is no longer any need for tui_alloc_source_buffer.  The two
callers of this function immediately change the contents of the
window, undoing the work done by this function.

This required adding a move constructor to tui_source_element -- a
mildly surprising find, but without this, resizing the vector will
cause crashes.  This issue was masked earlier because
tui_alloc_source_buffer handled this.

Note that a patch for this bug was submitted here:

    https://sourceware.org/ml/gdb-patches/2019-08/msg00094.html

That patch is better, IMO, but the author as yet hasn't responded to a
request for a ChangeLog entry.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare.
	(struct tui_source_element): Add DISABLE_COPY_AND_ASSIGN, and move
	constructor.
	* tui/tui-winsource.c (tui_alloc_source_buffer): Remove.
	* tui/tui-source.c (tui_set_source_content): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Update.
---
 gdb/ChangeLog           |  9 +++++++++
 gdb/tui/tui-disasm.c    |  2 --
 gdb/tui/tui-source.c    |  1 -
 gdb/tui/tui-winsource.c | 20 --------------------
 gdb/tui/tui-winsource.h | 14 +++++++++++---
 5 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index e55f35da214..23943947085 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -179,8 +179,6 @@ tui_set_disassem_content (tui_source_window_base *win_info,
   if (pc == 0)
     return TUI_FAILURE;
 
-  tui_alloc_source_buffer (win_info);
-
   win_info->gdbarch = gdbarch;
   win_info->start_line_or_addr.loa = LOA_ADDRESS;
   win_info->start_line_or_addr.u.addr = pc;
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 7c173f8a6f9..3d88f66d549 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -135,7 +135,6 @@ tui_set_source_content (tui_source_window_base *win_info,
       int line_width, nlines;
 
       ret = TUI_SUCCESS;
-      tui_alloc_source_buffer (win_info);
       line_width = win_info->width - 1;
       /* Take hilite (window border) into account, when
 	 calculating the number of lines.  */
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index a85269657cf..121f19abd8b 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -620,23 +620,3 @@ tui_source_window_base::update_exec_info ()
     }
   execution_info->refresh_window ();
 }
-
-
-void
-tui_alloc_source_buffer (struct tui_source_window_base *win_info)
-{
-  int i, line_width, max_lines;
-
-  /* The window width/height includes the highlight box.  Determine actual
-     content dimensions, including string null-terminators.  */
-  max_lines = win_info->height - 2;
-  line_width = win_info->width - 2 + 1;
-
-  /* Allocate the buffer for the source lines.  */
-  win_info->content.resize (max_lines);
-  for (i = 0; i < max_lines; i++)
-    {
-      if (win_info->content[i].line == nullptr)
-	win_info->content[i].line = (char *) xmalloc (line_width);
-    }
-}
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index f88f6b7de45..320c8370166 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -69,6 +69,17 @@ struct tui_source_element
     xfree (line);
   }
 
+  DISABLE_COPY_AND_ASSIGN (tui_source_element);
+
+  tui_source_element (tui_source_element &&other)
+    : line (other.line),
+      line_or_addr (other.line_or_addr),
+      is_exec_point (other.is_exec_point),
+      break_mode (other.break_mode)
+  {
+    other.line = nullptr;
+  }
+
   char *line = nullptr;
   struct tui_line_or_address line_or_addr;
   bool is_exec_point = false;
@@ -171,9 +182,6 @@ extern void tui_update_source_windows_with_line (struct symtab *,
 extern void tui_clear_source_content (struct tui_source_window_base *);
 extern void tui_erase_source_content (struct tui_source_window_base *);
 
-extern void tui_alloc_source_buffer (struct tui_source_window_base *);
-
-
 /* Constant definitions. */
 #define SCROLL_THRESHOLD 2	/* Threshold for lazy scroll.  */
 
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 12/15] Remove tui_initialize_static_data
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (8 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 13/15] Rename the "reset" method to "resize" Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 14/15] Change TUI source window iteration Tom Tromey
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

tui_initialize_static_data is not needed, because locator moving and
resizing is already handled in the layout code.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.c (tui_initialize_static_data): Remove.
	* tui/tui-interp.c (tui_interp::init): Don't call
	tui_initialize_static_data.
	* tui/tui-data.h (tui_initialize_static_data): Don't declare.
---
 gdb/ChangeLog        |  7 +++++++
 gdb/tui/tui-data.h   |  1 -
 gdb/tui/tui-interp.c |  2 --
 gdb/tui/tui-stack.c  | 15 ---------------
 4 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index b5eeecdee97..eaf3e061dcf 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -317,7 +317,6 @@ struct all_tui_windows
 
 
 /* Data Manipulation Functions.  */
-extern void tui_initialize_static_data (void);
 extern struct tui_win_info *tui_partial_win_by_name (const char *);
 extern enum tui_layout_type tui_current_layout (void);
 extern int tui_term_height (void);
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index d1146fed0e6..ea562acb6ce 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -242,8 +242,6 @@ tui_interp::init (bool top_level)
   /* Install exit handler to leave the screen in a good shape.  */
   atexit (tui_exit);
 
-  tui_initialize_static_data ();
-
   tui_initialize_io ();
   tui_initialize_win ();
   if (ui_file_isatty (gdb_stdout))
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index f61aa526004..f4d6d3865e1 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -66,21 +66,6 @@ tui_locator_win_info_ptr (void)
   return &_locator;
 }
 
-void
-tui_initialize_static_data ()
-{
-  tui_gen_win_info *win = tui_locator_win_info_ptr ();
-  win->width =
-    win->height =
-    win->origin.x =
-    win->origin.y =
-    win->viewport_height = 0;
-  win->handle = NULL;
-  win->is_visible = false;
-  win->title = 0;
-}
-
-
 /* Create the status line to display as much information as we can on
    this single line: target name, process number, current function,
    current line, current PC, SingleKey mode.  */
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 02/15] Remove FIXMEs from tui-layout.c
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
  2019-08-14 16:21 ` [PATCH 11/15] Minor simplification in tui_default_win_viewport_height Tom Tromey
  2019-08-14 16:21 ` [PATCH 05/15] Move contents of tui_show_frame_info to new method Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 08/15] Remove tui_alloc_source_buffer Tom Tromey
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

An earlier patch added a couple of FIXME comments to tui-layout.c.
This removes them.  This is possible due to the previous patch that
changed how boxing works in the TUI -- now, no special case for the
command window is needed in box_win.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Use make_visible method, not
	tui_make_window.
	* tui/tui-command.h (struct tui_cmd_window) <make_visible>:
	Remove.
---
 gdb/ChangeLog         | 8 ++++++++
 gdb/tui/tui-command.h | 4 ----
 gdb/tui/tui-layout.c  | 8 ++------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h
index 14d77500882..1892956fe77 100644
--- a/gdb/tui/tui-command.h
+++ b/gdb/tui/tui-command.h
@@ -35,10 +35,6 @@ struct tui_cmd_window : public tui_win_info
 
   DISABLE_COPY_AND_ASSIGN (tui_cmd_window);
 
-  void make_visible (bool visible) override
-  {
-  }
-
   int max_height () const override;
 
   void refresh_window () override
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 69b929d37b2..c2abcf4429d 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -544,9 +544,7 @@ show_source_disasm_command (void)
 		      tui_term_width (),
 		      0,
 		      tui_term_height () - cmd_height);
-  /* FIXME tui_cmd_window won't recreate the handle on
-     make_visible, so we need this instead.  */
-  tui_make_window (TUI_CMD_WIN);
+  TUI_CMD_WIN->make_visible (true);
   current_layout = SRC_DISASSEM_COMMAND;
 }
 
@@ -672,8 +670,6 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 		      tui_term_width (),
 		      0,
 		      src_height);
-  /* FIXME tui_cmd_window won't recreate the handle on
-     make_visible, so we need this instead.  */
-  tui_make_window (TUI_CMD_WIN);
+  TUI_CMD_WIN->make_visible (true);
   current_layout = layout_type;
 }
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 05/15] Move contents of tui_show_frame_info to new method
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
  2019-08-14 16:21 ` [PATCH 11/15] Minor simplification in tui_default_win_viewport_height Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-15 16:28   ` Pedro Alves
  2019-08-14 16:21 ` [PATCH 02/15] Remove FIXMEs from tui-layout.c Tom Tromey
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This moves much of the body of tui_show_frame_info to a new method on
tui_source_window_base.  This removes a check for the type of a
window.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<maybe_update>: Declare.
	* tui/tui-stack.c (tui_show_frame_info): Call maybe_update
	method.
	* tui/tui-source.h (struct tui_source_window) <maybe_update>:
	Declare.
	* tui/tui-source.c (tui_source_window::maybe_update): New method.
	* tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>:
	Declare.
	* tui/tui-disasm.c (tui_disasm_window::maybe_update): New method.
---
 gdb/ChangeLog           | 13 +++++++++
 gdb/tui/tui-disasm.c    | 31 ++++++++++++++++++++++
 gdb/tui/tui-disasm.h    |  4 +++
 gdb/tui/tui-source.c    | 26 ++++++++++++++++++
 gdb/tui/tui-source.h    |  4 +++
 gdb/tui/tui-stack.c     | 58 +----------------------------------------
 gdb/tui/tui-winsource.h |  4 +++
 7 files changed, 83 insertions(+), 57 deletions(-)

diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index a442a00019e..fcb33bccfd7 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -380,3 +380,34 @@ tui_disasm_window::location_matches_p (struct bp_location *loc, int line_no)
   return (content[line_no].line_or_addr.loa == LOA_ADDRESS
 	  && content[line_no].line_or_addr.u.addr == loc->address);
 }
+
+void
+tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
+				 int line_no, CORE_ADDR addr)
+{
+  CORE_ADDR low;
+
+  if (find_pc_partial_function (get_frame_pc (fi),
+				NULL, &low, NULL) == 0)
+    {
+      /* There is no symbol available for current PC.  There is no
+	 safe way how to "disassemble backwards".  */
+      low = get_frame_pc (fi);
+    }
+  else
+    low = tui_get_low_disassembly_address (get_frame_arch (fi),
+					   low, get_frame_pc (fi));
+
+  struct tui_line_or_address a;
+
+  a.loa = LOA_ADDRESS;
+  a.u.addr = low;
+  if (!tui_addr_is_displayed (addr, this, TRUE))
+    tui_update_source_window (this, get_frame_arch (fi),
+			      sal.symtab, a, TRUE);
+  else
+    {
+      a.u.addr = addr;
+      set_is_exec_point_at (a);
+    }
+}
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index 19672a74df1..20bc4290ffc 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -44,6 +44,10 @@ struct tui_disasm_window : public tui_source_window_base
 
   bool location_matches_p (struct bp_location *loc, int line_no) override;
 
+  void maybe_update (struct frame_info *fi, symtab_and_line sal,
+		     int line_no, CORE_ADDR addr)
+    override;
+
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 619d9374500..34b8f54557d 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -293,3 +293,29 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
 	  && filename_cmp (fullname,
 			   symtab_to_fullname (loc->symtab)) == 0);
 }
+
+void
+tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
+				 int line_no, CORE_ADDR addr)
+{
+  int start_line = (line_no - (viewport_height / 2)) + 1;
+  if (start_line <= 0)
+    start_line = 1;
+
+  bool source_already_displayed = (sal.symtab != 0
+				   && showing_source_p (fullname));
+
+  struct tui_line_or_address l;
+
+  l.loa = LOA_LINE;
+  l.u.line_no = start_line;
+  if (!(source_already_displayed
+	&& tui_line_is_displayed (line_no, this, TRUE)))
+    tui_update_source_window (this, get_frame_arch (fi),
+			      sal.symtab, l, TRUE);
+  else
+    {
+      l.u.line_no = line_no;
+      set_is_exec_point_at (l);
+    }
+}
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 49d79aba629..dc4470e9e5a 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -47,6 +47,10 @@ struct tui_source_window : public tui_source_window_base
 
   bool showing_source_p (const char *filename) const;
 
+  void maybe_update (struct frame_info *fi, symtab_and_line sal,
+		     int line_no, CORE_ADDR addr)
+    override;
+
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 1d7491dff93..09ee87f4027 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -364,7 +364,6 @@ tui_show_frame_info (struct frame_info *fi)
   if (fi)
     {
       struct tui_locator_window *locator = tui_locator_win_info_ptr ();
-      int source_already_displayed;
       CORE_ADDR pc;
 
       symtab_and_line sal = find_frame_sal (fi);
@@ -373,10 +372,6 @@ tui_show_frame_info (struct frame_info *fi)
       if (sal.symtab != nullptr)
 	fullname = symtab_to_fullname (sal.symtab);
 
-      source_already_displayed = (sal.symtab != 0
-				  && TUI_SRC_WIN != nullptr
-				  && TUI_SRC_WIN->showing_source_p (fullname));
-
       if (get_frame_pc_if_available (fi, &pc))
 	locator_changed_p
 	  = tui_set_locator_info (get_frame_arch (fi),
@@ -399,58 +394,7 @@ tui_show_frame_info (struct frame_info *fi)
       tui_show_locator_content ();
       for (struct tui_source_window_base *win_info : tui_source_windows ())
 	{
-	  if (win_info == TUI_SRC_WIN)
-	    {
-	      int start_line = (locator->line_no -
-				(win_info->viewport_height / 2)) + 1;
-	      if (start_line <= 0)
-		start_line = 1;
-
-	      struct tui_line_or_address l;
-
-	      l.loa = LOA_LINE;
-	      l.u.line_no = start_line;
-	      if (!(source_already_displayed
-		    && tui_line_is_displayed (locator->line_no,
-					      win_info, TRUE)))
-		tui_update_source_window (win_info, get_frame_arch (fi),
-					  sal.symtab, l, TRUE);
-	      else
-		{
-		  l.u.line_no = locator->line_no;
-		  win_info->set_is_exec_point_at (l);
-		}
-	    }
-	  else
-	    {
-	      CORE_ADDR low;
-
-	      if (find_pc_partial_function (get_frame_pc (fi),
-					    NULL, &low, NULL) == 0)
-		{
-		  /* There is no symbol available for current PC.  There is no
-		     safe way how to "disassemble backwards".  */
-		  low = get_frame_pc (fi);
-		}
-	      else
-		low = tui_get_low_disassembly_address (get_frame_arch (fi),
-						       low, get_frame_pc (fi));
-
-	      struct tui_line_or_address a;
-
-	      a.loa = LOA_ADDRESS;
-	      a.u.addr = low;
-	      if (!tui_addr_is_displayed (locator->addr,
-					  win_info, TRUE))
-		tui_update_source_window (win_info, get_frame_arch (fi),
-					  sal.symtab, a, TRUE);
-	      else
-		{
-		  a.u.addr = locator->addr;
-		  win_info->set_is_exec_point_at (a);
-		}
-	    }
-
+	  win_info->maybe_update (fi, sal, locator->line_no, locator->addr);
 	  win_info->update_exec_info ();
 	}
 
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index abb7ea34816..ed6cbec7626 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -23,6 +23,7 @@
 #define TUI_TUI_WINSOURCE_H
 
 #include "tui/tui-data.h"
+#include "symtab.h"
 
 /* Flags to tell what kind of breakpoint is at current line.  */
 enum tui_bp_flag
@@ -116,6 +117,9 @@ public:
 
   void update_exec_info ();
 
+  virtual void maybe_update (struct frame_info *fi, symtab_and_line sal,
+			     int line_no, CORE_ADDR addr) = 0;
+
   /* Does the locator belong to this window?  */
   bool m_has_locator = false;
   /* Execution information window.  */
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 14/15] Change TUI source window iteration
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (9 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 12/15] Remove tui_initialize_static_data Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 09/15] Turn tui_erase_source_content into a method Tom Tromey
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Currently the TUI does separate bookkeeping to track which source
windows exist.  It seems better to me to just refer to the list of
windows for this, so this patch removes the special handling and
instead adds a new iterator.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_iterator): New.
	(struct tui_source_windows): New.
	* tui/tui-winsource.c (tui_display_main): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
	(new_height_ok, parse_scrolling_args): Update.
	* tui/tui-layout.c (show_layout, show_data): Update.
	* tui/tui-data.h (tui_source_windows, tui_clear_source_windows)
	(tui_add_to_source_windows): Don't declare.
	* tui/tui-data.c (source_windows, tui_source_windows)
	(tui_clear_source_windows, tui_add_to_source_windows): Remove.
---
 gdb/ChangeLog           | 13 ++++++++
 gdb/tui/tui-data.c      | 31 ------------------
 gdb/tui/tui-data.h      |  3 --
 gdb/tui/tui-layout.c    |  9 ------
 gdb/tui/tui-win.c       | 14 ++++-----
 gdb/tui/tui-winsource.c |  3 +-
 gdb/tui/tui-winsource.h | 70 +++++++++++++++++++++++++++++++++++++++++
 7 files changed, 92 insertions(+), 51 deletions(-)

diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index c308237d187..fe1f73f02e8 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -36,7 +36,6 @@ struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
 ** Private data
 ****************************/
 static int term_height, term_width;
-static std::vector<tui_source_window_base *> source_windows;
 static struct tui_win_info *win_with_focus = NULL;
 
 static int win_resized = FALSE;
@@ -88,26 +87,6 @@ tui_set_win_with_focus (struct tui_win_info *win_info)
 }
 
 
-/* Accessor for the current source window.  Usually there is only one
-   source window (either source or disassembly), but both can be
-   displayed at the same time.  */
-std::vector<tui_source_window_base *> &
-tui_source_windows ()
-{
-  return source_windows;
-}
-
-
-/* Clear the list of source windows.  Usually there is only one source
-   window (either source or disassembly), but both can be displayed at
-   the same time.  */
-void
-tui_clear_source_windows ()
-{
-  source_windows.clear ();
-}
-
-
 /* Clear the pertinent detail in the source windows.  */
 void
 tui_clear_source_windows_detail ()
@@ -117,16 +96,6 @@ tui_clear_source_windows_detail ()
 }
 
 
-/* Add a window to the list of source windows.  Usually there is only
-   one source window (either source or disassembly), but both can be
-   displayed at the same time.  */
-void
-tui_add_to_source_windows (struct tui_source_window_base *win_info)
-{
-  if (source_windows.size () < 2)
-    source_windows.push_back (win_info);
-}
-
 /* Accessor for the term_height.  */
 int
 tui_term_height (void)
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 329fafc2552..338867917ef 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -324,10 +324,7 @@ extern void tui_set_term_height_to (int);
 extern int tui_term_width (void);
 extern void tui_set_term_width_to (int);
 extern struct tui_locator_window *tui_locator_win_info_ptr (void);
-extern std::vector<tui_source_window_base *> &tui_source_windows ();
-extern void tui_clear_source_windows (void);
 extern void tui_clear_source_windows_detail (void);
-extern void tui_add_to_source_windows (struct tui_source_window_base *);
 extern struct tui_win_info *tui_win_with_focus (void);
 extern void tui_set_win_with_focus (struct tui_win_info *);
 extern int tui_win_resized (void);
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index c7facc98343..4ea604a1017 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -76,10 +76,6 @@ show_layout (enum tui_layout_type layout)
 
   if (layout != cur_layout)
     {
-      /* Since the new layout may cause changes in window size, we
-         should free the content and reallocate on next display of
-         source/asm.  */
-      tui_clear_source_windows ();
       /* First make the current layout be invisible.  */
       tui_make_all_invisible ();
       tui_locator_win_info_ptr ()->make_visible (false);
@@ -93,16 +89,12 @@ show_layout (enum tui_layout_type layout)
 	  /* Now show the new layout.  */
 	case SRC_COMMAND:
 	  show_source_command ();
-	  tui_add_to_source_windows (TUI_SRC_WIN);
 	  break;
 	case DISASSEM_COMMAND:
 	  show_disasm_command ();
-	  tui_add_to_source_windows (TUI_DISASM_WIN);
 	  break;
 	case SRC_DISASSEM_COMMAND:
 	  show_source_disasm_command ();
-	  tui_add_to_source_windows (TUI_SRC_WIN);
-	  tui_add_to_source_windows (TUI_DISASM_WIN);
 	  break;
 	default:
 	  break;
@@ -595,7 +587,6 @@ show_data (enum tui_layout_type new_layout)
   base->m_has_locator = true;
   locator->make_visible (true);
   tui_show_locator_content ();
-  tui_add_to_source_windows (base);
   TUI_CMD_WIN->make_visible (true);
   current_layout = new_layout;
 }
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 7210f6c4119..aa07dfc8225 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -571,7 +571,7 @@ tui_resize_all (void)
        {
 	case SRC_COMMAND:
 	case DISASSEM_COMMAND:
-	  src_win = tui_source_windows ()[0];
+	  src_win = *(tui_source_windows ().begin ());
 	  first_win = src_win;
 	  first_win->width += width_diff;
 	  locator->width += width_diff;
@@ -610,7 +610,7 @@ tui_resize_all (void)
 	    {
 	      first_win = TUI_DATA_WIN;
 	      first_win->width += width_diff;
-	      src_win = tui_source_windows ()[0];
+	      src_win = *(tui_source_windows ().begin ());
 	      second_win = src_win;
 	      second_win->width += width_diff;
 	    }
@@ -1046,7 +1046,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 	      primary_win_info->make_invisible_and_set_new_height (new_height);
 	      if (primary_win_info->type == CMD_WIN)
 		{
-		  win_info = tui_source_windows ()[0];
+		  win_info = *(tui_source_windows ().begin ());
 		  src_win_info = win_info;
 		}
 	      else
@@ -1084,7 +1084,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 		{
 		  src1 = nullptr;
 		  first_win = TUI_DATA_WIN;
-		  second_win = tui_source_windows ()[0];
+		  second_win = *(tui_source_windows ().begin ());
 		}
 	      if (primary_win_info == TUI_CMD_WIN)
 		{ /* Split the change in height accross the 1st & 2nd
@@ -1238,7 +1238,7 @@ new_height_ok (struct tui_win_info *primary_win_info,
 	      struct tui_win_info *win_info;
 
 	      if (primary_win_info == TUI_CMD_WIN)
-		win_info = tui_source_windows ()[0];
+		win_info = *(tui_source_windows ().begin ());
 	      else
 		win_info = TUI_CMD_WIN;
 	      ok = ((new_height +
@@ -1259,7 +1259,7 @@ new_height_ok (struct tui_win_info *primary_win_info,
 	  else
 	    {
 	      first_win = TUI_DATA_WIN;
-	      second_win = tui_source_windows ()[0];
+	      second_win = *(tui_source_windows ().begin ());
 	    }
 	  /* We could simply add all the heights to obtain the same
 	     result but below is more explicit since we subtract 1 for
@@ -1385,7 +1385,7 @@ parse_scrolling_args (const char *arg,
 	  if (!(*win_to_scroll)->is_visible)
 	    error (_("Window is not visible"));
 	  else if (*win_to_scroll == TUI_CMD_WIN)
-	    *win_to_scroll = tui_source_windows ()[0];
+	    *win_to_scroll = *(tui_source_windows ().begin ());
 	}
     }
 }
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index f62c79dc32a..613213fab5f 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -44,7 +44,8 @@
 void
 tui_display_main ()
 {
-  if (!tui_source_windows ().empty ())
+  auto adapter = tui_source_windows ();
+  if (adapter.begin () != adapter.end ())
     {
       struct gdbarch *gdbarch;
       CORE_ADDR addr;
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 6627e70bc98..a3208060080 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -154,6 +154,76 @@ public:
   std::vector<tui_source_element> content;
 };
 
+
+/* A wrapper for a TUI window iterator that only iterates over source
+   windows.  */
+
+struct tui_source_window_iterator
+{
+public:
+
+  typedef tui_source_window_iterator self_type;
+  typedef struct tui_source_window_base *value_type;
+  typedef struct tui_source_window_base *&reference;
+  typedef struct tui_source_window_base **pointer;
+  typedef std::forward_iterator_tag iterator_category;
+  typedef int difference_type;
+
+  explicit tui_source_window_iterator (bool dummy)
+    : m_iter (SRC_WIN)
+  {
+    advance ();
+  }
+
+  tui_source_window_iterator ()
+    : m_iter (tui_win_type (DISASSEM_WIN + 1))
+  {
+  }
+
+  bool operator!= (const self_type &other) const
+  {
+    return m_iter != other.m_iter;
+  }
+
+  value_type operator* () const
+  {
+    return (value_type) *m_iter;
+  }
+
+  self_type &operator++ ()
+  {
+    ++m_iter;
+    advance ();
+    return *this;
+  }
+
+private:
+
+  void advance ()
+  {
+    tui_window_iterator end;
+    while (m_iter != end && *m_iter == nullptr)
+      ++m_iter;
+  }
+
+  tui_window_iterator m_iter;
+};
+
+/* A range adapter for source windows.  */
+
+struct tui_source_windows
+{
+  tui_source_window_iterator begin () const
+  {
+    return tui_source_window_iterator (true);
+  }
+
+  tui_source_window_iterator end () const
+  {
+    return tui_source_window_iterator ();
+  }
+};
+
 /* Update the execution windows to show the active breakpoints.  This
    is called whenever a breakpoint is inserted, removed or has its
    state changed.  Normally BEING_DELETED is nullptr; if not nullptr,
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 13/15] Rename the "reset" method to "resize"
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (7 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 07/15] Change tui_line_is_displayed to be a method Tom Tromey
@ 2019-08-14 16:21 ` Tom Tromey
  2019-08-14 16:21 ` [PATCH 12/15] Remove tui_initialize_static_data Tom Tromey
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

tui_gen_win_info::reset really just resizes the window.  This patch
renames it to reflect this.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base) <resize>:
	Rename from reset.
	* tui/tui-winsource.c (tui_source_window_base::resize): Rename.
	* tui/tui-layout.c (show_source_disasm_command, show_data):
	Update.
	(tui_gen_win_info::resize): Rename.
	(show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <resize>: Rename from
	reset.
---
 gdb/ChangeLog           | 12 +++++++
 gdb/tui/tui-data.h      |  6 ++--
 gdb/tui/tui-layout.c    | 74 ++++++++++++++++++++---------------------
 gdb/tui/tui-winsource.c | 10 +++---
 gdb/tui/tui-winsource.h |  4 +--
 5 files changed, 59 insertions(+), 47 deletions(-)

diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index eaf3e061dcf..329fafc2552 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -62,10 +62,10 @@ public:
     return "";
   }
 
-  /* Reset this window.  The parameters are used to set the window's
+  /* Resize this window.  The parameters are used to set the window's
      size and position.  */
-  virtual void reset (int height, int width,
-		      int origin_x, int origin_y);
+  virtual void resize (int height, int width,
+		       int origin_x, int origin_y);
 
   /* Return true if this can be boxed.  */
   virtual bool can_box () const
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index d10c9a043d6..c7facc98343 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -510,10 +510,10 @@ show_source_disasm_command (void)
 
   if (TUI_SRC_WIN == NULL)
     tui_win_list[SRC_WIN] = new tui_source_window ();
-  TUI_SRC_WIN->reset (src_height,
-		      tui_term_width (),
-		      0,
-		      0);
+  TUI_SRC_WIN->resize (src_height,
+		       tui_term_width (),
+		       0,
+		       0);
   TUI_SRC_WIN->make_visible (true);
   TUI_SRC_WIN->m_has_locator = false;
 
@@ -523,15 +523,15 @@ show_source_disasm_command (void)
   TUI_SRC_WIN->show_source_content ();
   if (TUI_DISASM_WIN == NULL)
     tui_win_list[DISASSEM_WIN] = new tui_disasm_window ();
-  TUI_DISASM_WIN->reset (asm_height,
-			 tui_term_width (),
-			 0,
-			 src_height - 1);
+  TUI_DISASM_WIN->resize (asm_height,
+			  tui_term_width (),
+			  0,
+			  src_height - 1);
   TUI_DISASM_WIN->make_visible (true);
-  locator->reset (2 /* 1 */ ,
-		  tui_term_width (),
-		  0,
-		  (src_height + asm_height) - 1);
+  locator->resize (2 /* 1 */ ,
+		   tui_term_width (),
+		   0,
+		   (src_height + asm_height) - 1);
   TUI_SRC_WIN->m_has_locator = false;
   TUI_DISASM_WIN->m_has_locator = true;
   locator->make_visible (true);
@@ -540,10 +540,10 @@ show_source_disasm_command (void)
 
   if (TUI_CMD_WIN == NULL)
     tui_win_list[CMD_WIN] = new tui_cmd_window ();
-  TUI_CMD_WIN->reset (cmd_height,
-		      tui_term_width (),
-		      0,
-		      tui_term_height () - cmd_height);
+  TUI_CMD_WIN->resize (cmd_height,
+		       tui_term_width (),
+		       0,
+		       tui_term_height () - cmd_height);
   TUI_CMD_WIN->make_visible (true);
   current_layout = SRC_DISASSEM_COMMAND;
 }
@@ -565,7 +565,7 @@ show_data (enum tui_layout_type new_layout)
   src_height = total_height - data_height;
   if (tui_win_list[DATA_WIN] == nullptr)
     tui_win_list[DATA_WIN] = new tui_data_window ();
-  tui_win_list[DATA_WIN]->reset (data_height, tui_term_width (), 0, 0);
+  tui_win_list[DATA_WIN]->resize (data_height, tui_term_width (), 0, 0);
   tui_win_list[DATA_WIN]->make_visible (true);
 
   if (new_layout == SRC_DATA_COMMAND)
@@ -583,14 +583,14 @@ show_data (enum tui_layout_type new_layout)
 
   tui_source_window_base *base
     = (tui_source_window_base *) tui_win_list[win_type];
-  tui_win_list[win_type]->reset (src_height,
-				 tui_term_width (),
-				 0,
-				 data_height - 1);
-  locator->reset (2 /* 1 */ ,
-		  tui_term_width (),
-		  0,
-		  total_height - 1);
+  tui_win_list[win_type]->resize (src_height,
+				  tui_term_width (),
+				  0,
+				  data_height - 1);
+  locator->resize (2 /* 1 */ ,
+		   tui_term_width (),
+		   0,
+		   total_height - 1);
   base->make_visible (true);
   base->m_has_locator = true;
   locator->make_visible (true);
@@ -601,8 +601,8 @@ show_data (enum tui_layout_type new_layout)
 }
 
 void
-tui_gen_win_info::reset (int height_, int width_,
-			 int origin_x_, int origin_y_)
+tui_gen_win_info::resize (int height_, int width_,
+			  int origin_x_, int origin_y_)
 {
   int h = height_;
 
@@ -648,14 +648,14 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
       win_info = TUI_DISASM_WIN;
     }
 
-  locator->reset (2 /* 1 */ ,
-		  tui_term_width (),
-		  0,
-		  src_height - 1);
-  win_info->reset (src_height - 1,
+  locator->resize (2 /* 1 */ ,
 		   tui_term_width (),
 		   0,
-		   0);
+		   src_height - 1);
+  win_info->resize (src_height - 1,
+		    tui_term_width (),
+		    0,
+		    0);
   win_info->make_visible (true);
 
 
@@ -666,10 +666,10 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 
   if (TUI_CMD_WIN == NULL)
     tui_win_list[CMD_WIN] = new tui_cmd_window ();
-  TUI_CMD_WIN->reset (cmd_height,
-		      tui_term_width (),
-		      0,
-		      src_height);
+  TUI_CMD_WIN->resize (cmd_height,
+		       tui_term_width (),
+		       0,
+		       src_height);
   TUI_CMD_WIN->make_visible (true);
   current_layout = layout_type;
 }
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 95a2ac27094..f62c79dc32a 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -291,12 +291,12 @@ tui_source_window_base::~tui_source_window_base ()
 }  
 
 void
-tui_source_window_base::reset (int height, int width,
-			       int origin_x, int origin_y)
+tui_source_window_base::resize (int height, int width,
+				int origin_x, int origin_y)
 {
-  tui_gen_win_info::reset (height, width - 3,
-			   origin_x + 3, origin_y);
-  execution_info->reset (height, 3, origin_x, origin_y);
+  tui_gen_win_info::resize (height, width - 3,
+			    origin_x + 3, origin_y);
+  execution_info->resize (height, 3, origin_x, origin_y);
 }
 
 /* See tui-data.h.  */
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index b5528011f5a..6627e70bc98 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -124,8 +124,8 @@ public:
 
   virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
 
-  void reset (int height, int width,
-	      int origin_x, int origin_y) override;
+  void resize (int height, int width,
+	       int origin_x, int origin_y) override;
 
   void show_source_content ();
 
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 04/15] Avoid string_file in tui_make_status_line
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (13 preceding siblings ...)
  2019-08-14 16:21 ` [PATCH 10/15] Remove tui_clear_source_content Tom Tromey
@ 2019-08-14 16:23 ` Tom Tromey
  2019-08-15 16:29 ` [PATCH 00/15] Another round of TUI refactoring Pedro Alves
  15 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-14 16:23 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

tui_make_status_line uses string_file where a simple std::string
constructor would do.  This makes this change.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.c (tui_make_status_line): Use string constructor.
---
 gdb/ChangeLog       | 4 ++++
 gdb/tui/tui-stack.c | 8 +++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index c67ac1ba549..1d7491dff93 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -128,11 +128,9 @@ tui_make_status_line (struct tui_locator_window *loc)
     line_width = MIN_LINE_WIDTH;
 
   /* Translate PC address.  */
-  string_file pc_out;
-
-  fputs_filtered (loc->gdbarch? paddress (loc->gdbarch, loc->addr) : "??",
-		  &pc_out);
-
+  std::string pc_out (loc->gdbarch
+		      ? paddress (loc->gdbarch, loc->addr)
+		      : "??");
   const char *pc_buf = pc_out.c_str ();
   int pc_width = pc_out.size ();
 
-- 
2.17.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 06/15] Change tui_addr_is_displayed into a method
  2019-08-14 16:21 ` [PATCH 06/15] Change tui_addr_is_displayed into a method Tom Tromey
@ 2019-08-15 16:28   ` Pedro Alves
  0 siblings, 0 replies; 20+ messages in thread
From: Pedro Alves @ 2019-08-15 16:28 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 8/14/19 5:21 PM, Tom Tromey wrote:
> diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
> index 1b2b4393fd9..e8e7061d0f2 100644
> --- a/gdb/tui/tui-winsource.c
> +++ b/gdb/tui/tui-winsource.c
> @@ -668,31 +668,3 @@ tui_line_is_displayed (int line,
>  
>    return is_displayed;
>  }
> -
> -
> -/* Answer whether a particular line number or address is displayed
> -   in the current source window.  */
> -int
> -tui_addr_is_displayed (CORE_ADDR addr, 
> -		       struct tui_source_window_base *win_info,
> -		       int check_threshold)

That intro comment is lost.  Move it...

> --- a/gdb/tui/tui-disasm.h
> +++ b/gdb/tui/tui-disasm.h
> @@ -51,6 +51,10 @@ struct tui_disasm_window : public tui_source_window_base
>  protected:
>  
>    void do_scroll_vertical (int num_to_scroll) override;
> +
> +private:
> +  bool addr_is_displayed (CORE_ADDR addr) const;

here?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 05/15] Move contents of tui_show_frame_info to new method
  2019-08-14 16:21 ` [PATCH 05/15] Move contents of tui_show_frame_info to new method Tom Tromey
@ 2019-08-15 16:28   ` Pedro Alves
  0 siblings, 0 replies; 20+ messages in thread
From: Pedro Alves @ 2019-08-15 16:28 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 8/14/19 5:21 PM, Tom Tromey wrote:
> @@ -116,6 +117,9 @@ public:
>  
>    void update_exec_info ();
>  
> +  virtual void maybe_update (struct frame_info *fi, symtab_and_line sal,
> +			     int line_no, CORE_ADDR addr) = 0;
> +

Should this have an intro comment?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 00/15] Another round of TUI refactoring
  2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
                   ` (14 preceding siblings ...)
  2019-08-14 16:23 ` [PATCH 04/15] Avoid string_file in tui_make_status_line Tom Tromey
@ 2019-08-15 16:29 ` Pedro Alves
  2019-08-15 18:28   ` Tom Tromey
  15 siblings, 1 reply; 20+ messages in thread
From: Pedro Alves @ 2019-08-15 16:29 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 8/14/19 5:21 PM, Tom Tromey wrote:
> Here's another round of TUI refactoring.  This is extracted from a
> longer series that I'm submitting in pieces to make it simpler to
> read.
> 
> Most of these are straightforward.  Patch #8 fixes an existing bug,
> see the commentary there for a description.
> 
> I tested these on x86-64 Fedora 28, by building each one and running
> the gdb.tui tests.

I just sent a couple nanocomments, but it all looks good to me.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 00/15] Another round of TUI refactoring
  2019-08-15 16:29 ` [PATCH 00/15] Another round of TUI refactoring Pedro Alves
@ 2019-08-15 18:28   ` Tom Tromey
  0 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-08-15 18:28 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 8/14/19 5:21 PM, Tom Tromey wrote:
>> Here's another round of TUI refactoring.  This is extracted from a
>> longer series that I'm submitting in pieces to make it simpler to
>> read.
>> 
>> Most of these are straightforward.  Patch #8 fixes an existing bug,
>> see the commentary there for a description.
>> 
>> I tested these on x86-64 Fedora 28, by building each one and running
>> the gdb.tui tests.

Pedro> I just sent a couple nanocomments, but it all looks good to me.

Thanks.  I've fixed those and I'm checking this in now.

Tom

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-08-15 18:28 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14 16:21 [PATCH 00/15] Another round of TUI refactoring Tom Tromey
2019-08-14 16:21 ` [PATCH 11/15] Minor simplification in tui_default_win_viewport_height Tom Tromey
2019-08-14 16:21 ` [PATCH 05/15] Move contents of tui_show_frame_info to new method Tom Tromey
2019-08-15 16:28   ` Pedro Alves
2019-08-14 16:21 ` [PATCH 02/15] Remove FIXMEs from tui-layout.c Tom Tromey
2019-08-14 16:21 ` [PATCH 08/15] Remove tui_alloc_source_buffer Tom Tromey
2019-08-14 16:21 ` [PATCH 15/15] TUI window resize should not need invisibility Tom Tromey
2019-08-14 16:21 ` [PATCH 06/15] Change tui_addr_is_displayed into a method Tom Tromey
2019-08-15 16:28   ` Pedro Alves
2019-08-14 16:21 ` [PATCH 03/15] Move locator code to tui-stack.c Tom Tromey
2019-08-14 16:21 ` [PATCH 07/15] Change tui_line_is_displayed to be a method Tom Tromey
2019-08-14 16:21 ` [PATCH 13/15] Rename the "reset" method to "resize" Tom Tromey
2019-08-14 16:21 ` [PATCH 12/15] Remove tui_initialize_static_data Tom Tromey
2019-08-14 16:21 ` [PATCH 14/15] Change TUI source window iteration Tom Tromey
2019-08-14 16:21 ` [PATCH 09/15] Turn tui_erase_source_content into a method Tom Tromey
2019-08-14 16:21 ` [PATCH 01/15] Simplify TUI boxing Tom Tromey
2019-08-14 16:21 ` [PATCH 10/15] Remove tui_clear_source_content Tom Tromey
2019-08-14 16:23 ` [PATCH 04/15] Avoid string_file in tui_make_status_line Tom Tromey
2019-08-15 16:29 ` [PATCH 00/15] Another round of TUI refactoring Pedro Alves
2019-08-15 18:28   ` 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).