[15/66] Remove struct tui_source_info

Message ID 20190623224329.16060-16-tom@tromey.com
State New
Headers show
Series
  • Clean up the TUI
Related show

Commit Message

Tom Tromey June 23, 2019, 10:42 p.m.
The tui_source_info struct is used as a member of the "detail" union
in tui_win_info, and this member of the union is only used by source
and disassembly windows.  This patch removes tui_source_info and moves
its members directly to tui_source_window_base.  This simplifies the
code by removing a layer of references from many places.  In a few
spots, a new cast was needed, but most of these will be removed by the
end of the series.

gdb/ChangeLog
2019-06-23  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_window)
	(tui_refill_source_window)
	(tui_source_window_base::do_scroll_horizontal)
	(tui_update_breakpoint_info, tui_set_exec_info_content)
	(tui_show_exec_info_content, tui_erase_exec_info_content)
	(tui_clear_exec_info_content): Update.
	* tui/tui-wingeneral.c (make_all_visible, tui_refresh_all):
	Update.
	* tui/tui-win.c (make_invisible_and_set_new_height)
	(make_visible_with_new_height): Update.
	* tui/tui-source.c (tui_set_source_content)
	(tui_show_symtab_source): Update.
	* tui/tui-layout.c (extract_display_start_addr)
	(show_source_disasm_command, show_data)
	(make_source_or_disasm_window)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Simplify.
	(tui_disasm_window::do_scroll_vertical): Remove shadowing
	"gdbarch".
	* tui/tui-data.h (struct tui_source_info): Remove.  Move contents
	to tui_source_window_base.
	(struct tui_win_info) <detail>: Remove source_info member.
	(struct tui_source_window_base) <has_locator>: Inline.
	Move contents from tui_source_info; rename has_locator member to
	m_has_locator.
	(TUI_SRC_WIN, TUI_DISASM_WIN): Add casts.
	* tui/tui-data.c (tui_source_window_base::has_locator): Move to
	header file.
	(tui_source_window_base::clear_detail, ~tui_source_window_base):
	Simplify.
	(tui_free_all_source_wins_content): Cast to
	tui_source_window_base.
---
 gdb/ChangeLog            | 35 ++++++++++++++++++++
 gdb/tui/tui-data.c       | 36 ++++++---------------
 gdb/tui/tui-data.h       | 40 +++++++++++------------
 gdb/tui/tui-disasm.c     | 10 +++---
 gdb/tui/tui-layout.c     | 70 ++++++++++++++++++++++------------------
 gdb/tui/tui-source.c     |  6 ++--
 gdb/tui/tui-win.c        | 14 +++++---
 gdb/tui/tui-wingeneral.c | 13 +++++---
 gdb/tui/tui-winsource.c  | 33 ++++++++++---------
 9 files changed, 147 insertions(+), 110 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 6690db351ea..ef9c9998930 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -75,14 +75,6 @@  tui_win_is_auxillary (enum tui_win_type win_type)
   return (win_type > MAX_MAJOR_WINDOWS);
 }
 
-/* See tui-data.h.  */
-
-bool
-tui_source_window_base::has_locator () const
-{
-  return detail.source_info.has_locator;
-}
-
 void
 tui_set_win_highlight (struct tui_win_info *win_info, 
 		       int highlight)
@@ -179,10 +171,10 @@  tui_add_to_source_windows (struct tui_win_info *win_info)
 void
 tui_source_window_base::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;
+  gdbarch = NULL;
+  start_line_or_addr.loa = LOA_ADDRESS;
+  start_line_or_addr.u.addr = 0;
+  horizontal_offset = 0;
 }
 
 /* See tui-data.h.  */
@@ -499,13 +491,8 @@  tui_source_window_base::tui_source_window_base (enum tui_win_type type)
   : tui_win_info (type)
 {
   gdb_assert (type == SRC_WIN || type == DISASSEM_WIN);
-  detail.source_info.execution_info = NULL;
-  detail.source_info.has_locator = false;
-  detail.source_info.horizontal_offset = 0;
-  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.fullname = NULL;
+  start_line_or_addr.loa = LOA_ADDRESS;
+  start_line_or_addr.u.addr = 0;
 }
 
 tui_data_window::tui_data_window ()
@@ -613,12 +600,8 @@  tui_add_content_elements (struct tui_gen_win_info *win_info,
 
 tui_source_window_base::~tui_source_window_base ()
 {
-  if (detail.source_info.fullname)
-    {
-      xfree (detail.source_info.fullname);
-      detail.source_info.fullname = NULL;
-    }
-  struct tui_gen_win_info *generic_win = detail.source_info.execution_info;
+  xfree (fullname);
+  struct tui_gen_win_info *generic_win = execution_info;
   if (generic_win != NULL)
     {
       tui_delete_win (generic_win->handle);
@@ -665,7 +648,8 @@  tui_free_all_source_wins_content ()
   for (tui_win_info *win_info : tui_source_windows ())
     {
       tui_free_win_content (&(win_info->generic));
-      tui_free_win_content (win_info->detail.source_info.execution_info);
+      tui_source_window_base *base = (tui_source_window_base *) win_info;
+      tui_free_win_content (base->execution_info);
     }
 }
 
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index facd3142503..081022a2495 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -238,22 +238,6 @@  struct tui_data_info
 };
 
 
-struct tui_source_info
-{
-  bool has_locator;		/* Does locator belongs to this window?  */
-  /* Execution information window.  */
-  struct tui_gen_win_info *execution_info;
-  int horizontal_offset;	/* Used for horizontal scroll.  */
-  struct tui_line_or_address start_line_or_addr;
-
-  /* It is the resolved form as returned by symtab_to_fullname.  */
-  char *fullname;
-
-  /* Architecture associated with code at this location.  */
-  struct gdbarch *gdbarch;
-};
-
-
 struct tui_command_info
 {
   int start_line;
@@ -302,7 +286,6 @@  public:
   struct tui_gen_win_info generic;	/* General window information.  */
   union
   {
-    struct tui_source_info source_info;
     struct tui_data_info data_display_info;
     struct tui_command_info command_info;
   }
@@ -333,7 +316,24 @@  public:
   void clear_detail () override;
 
   /* Return true if this window has the locator.  */
-  bool has_locator () const override;
+  bool has_locator () const override
+  {
+    return m_has_locator;
+  }
+
+  /* Does locator belongs to this window?  */
+  bool m_has_locator = false;
+  /* Execution information window.  */
+  struct tui_gen_win_info *execution_info = nullptr;
+  /* Used for horizontal scroll.  */
+  int horizontal_offset = 0;
+  struct tui_line_or_address start_line_or_addr;
+
+  /* It is the resolved form as returned by symtab_to_fullname.  */
+  char *fullname = nullptr;
+
+  /* Architecture associated with code at this location.  */
+  struct gdbarch *gdbarch = nullptr;
 };
 
 /* A TUI source window.  */
@@ -417,8 +417,8 @@  extern void tui_set_win_highlight (struct tui_win_info *win_info,
 /* Global Data.  */
 extern struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
 
-#define TUI_SRC_WIN     tui_win_list[SRC_WIN]
-#define TUI_DISASM_WIN	tui_win_list[DISASSEM_WIN]
+#define TUI_SRC_WIN     ((tui_source_window_base *) tui_win_list[SRC_WIN])
+#define TUI_DISASM_WIN	((tui_source_window_base *) tui_win_list[DISASSEM_WIN])
 #define TUI_DATA_WIN    tui_win_list[DATA_WIN]
 #define TUI_CMD_WIN     tui_win_list[CMD_WIN]
 
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index efb9d1cb628..8dd156d0907 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -167,7 +167,7 @@  tui_set_disassem_content (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   enum tui_status ret = TUI_FAILURE;
   int i;
-  int offset = TUI_DISASM_WIN->detail.source_info.horizontal_offset;
+  int offset = TUI_DISASM_WIN->horizontal_offset;
   int max_lines, line_width;
   CORE_ADDR cur_pc;
   struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
@@ -184,9 +184,10 @@  tui_set_disassem_content (struct gdbarch *gdbarch, CORE_ADDR pc)
   if (ret != TUI_SUCCESS)
     return ret;
 
-  TUI_DISASM_WIN->detail.source_info.gdbarch = gdbarch;
-  TUI_DISASM_WIN->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
-  TUI_DISASM_WIN->detail.source_info.start_line_or_addr.u.addr = pc;
+  tui_source_window_base *base = TUI_DISASM_WIN;
+  base->gdbarch = gdbarch;
+  base->start_line_or_addr.loa = LOA_ADDRESS;
+  base->start_line_or_addr.u.addr = pc;
   cur_pc = locator->content[0]->which_element.locator.addr;
 
   /* Window size, excluding highlight box.  */
@@ -378,7 +379,6 @@  tui_disasm_window::do_scroll_vertical
 {
   if (generic.content != NULL)
     {
-      struct gdbarch *gdbarch = detail.source_info.gdbarch;
       CORE_ADDR pc;
       tui_win_content content;
       struct tui_line_or_address val;
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index f4df49253af..55d737ab315 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -468,17 +468,17 @@  extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
     {
     case SRC_COMMAND:
     case SRC_DATA_COMMAND:
-      gdbarch = TUI_SRC_WIN->detail.source_info.gdbarch;
+      gdbarch = TUI_SRC_WIN->gdbarch;
       find_line_pc (cursal.symtab,
-		    TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no,
+		    TUI_SRC_WIN->start_line_or_addr.u.line_no,
 		    &pc);
       addr = pc;
       break;
     case DISASSEM_COMMAND:
     case SRC_DISASSEM_COMMAND:
     case DISASSEM_DATA_COMMAND:
-      gdbarch = TUI_DISASM_WIN->detail.source_info.gdbarch;
-      addr = TUI_DISASM_WIN->detail.source_info.start_line_or_addr.u.addr;
+      gdbarch = TUI_DISASM_WIN->gdbarch;
+      addr = TUI_DISASM_WIN->start_line_or_addr.u.addr;
       break;
     default:
       addr = 0;
@@ -622,25 +622,25 @@  show_source_disasm_command (void)
       asm_height = tui_term_height () - (src_height + cmd_height);
 
       if (TUI_SRC_WIN == NULL)
-	TUI_SRC_WIN = make_source_window (src_height, 0);
+	tui_win_list[SRC_WIN] = make_source_window (src_height, 0);
       else
 	{
 	  init_gen_win_info (&TUI_SRC_WIN->generic,
 			     TUI_SRC_WIN->generic.type,
 			     src_height,
 			     TUI_SRC_WIN->generic.width,
-			     TUI_SRC_WIN->detail.source_info.execution_info->width,
+			     TUI_SRC_WIN->execution_info->width,
 			     0);
 	  TUI_SRC_WIN->can_highlight = TRUE;
-	  init_gen_win_info (TUI_SRC_WIN->detail.source_info.execution_info,
+	  init_gen_win_info (TUI_SRC_WIN->execution_info,
 			     EXEC_INFO_WIN,
 			     src_height,
 			     3,
 			     0,
 			     0);
 	  tui_make_visible (&TUI_SRC_WIN->generic);
-	  tui_make_visible (TUI_SRC_WIN->detail.source_info.execution_info);
-	  TUI_SRC_WIN->detail.source_info.has_locator = false;
+	  tui_make_visible (TUI_SRC_WIN->execution_info);
+	  TUI_SRC_WIN->m_has_locator = false;
 	}
 
       struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
@@ -648,7 +648,8 @@  show_source_disasm_command (void)
       tui_show_source_content (TUI_SRC_WIN);
       if (TUI_DISASM_WIN == NULL)
 	{
-	  TUI_DISASM_WIN = make_disasm_window (asm_height, src_height - 1);
+	  tui_win_list[DISASSEM_WIN]
+	    = make_disasm_window (asm_height, src_height - 1);
 	  locator
 	    = ((struct tui_gen_win_info *)
 	       init_and_make_win (locator,
@@ -667,14 +668,14 @@  show_source_disasm_command (void)
 			     tui_term_width (),
 			     0,
 			     (src_height + asm_height) - 1);
-	  TUI_DISASM_WIN->detail.source_info.has_locator = true;
+	  TUI_DISASM_WIN->m_has_locator = true;
 	  init_gen_win_info (&TUI_DISASM_WIN->generic,
 			     TUI_DISASM_WIN->generic.type,
 			     asm_height,
 			     TUI_DISASM_WIN->generic.width,
-			     TUI_DISASM_WIN->detail.source_info.execution_info->width,
+			     TUI_DISASM_WIN->execution_info->width,
 			     src_height - 1);
-	  init_gen_win_info (TUI_DISASM_WIN->detail.source_info.execution_info,
+	  init_gen_win_info (TUI_DISASM_WIN->execution_info,
 			     EXEC_INFO_WIN,
 			     asm_height,
 			     3,
@@ -682,10 +683,10 @@  show_source_disasm_command (void)
 			     src_height - 1);
 	  TUI_DISASM_WIN->can_highlight = TRUE;
 	  tui_make_visible (&TUI_DISASM_WIN->generic);
-	  tui_make_visible (TUI_DISASM_WIN->detail.source_info.execution_info);
+	  tui_make_visible (TUI_DISASM_WIN->execution_info);
 	}
-      TUI_SRC_WIN->detail.source_info.has_locator = false;
-      TUI_DISASM_WIN->detail.source_info.has_locator = true;
+      TUI_SRC_WIN->m_has_locator = false;
+      TUI_DISASM_WIN->m_has_locator = true;
       tui_make_visible (locator);
       tui_show_locator_content ();
       tui_show_source_content (TUI_DISASM_WIN);
@@ -731,6 +732,8 @@  show_data (enum tui_layout_type new_layout)
     win_type = SRC_WIN;
   else
     win_type = DISASSEM_WIN;
+
+  tui_source_window_base *base;
   if (tui_win_list[win_type] == NULL)
     {
       if (win_type == SRC_WIN)
@@ -748,23 +751,25 @@  show_data (enum tui_layout_type new_layout)
 			      0,
 			      total_height - 1,
 			      DONT_BOX_WINDOW));
+      base = (tui_source_window_base *) tui_win_list[win_type];
     }
   else
     {
+      base = (tui_source_window_base *) tui_win_list[win_type];
       init_gen_win_info (&tui_win_list[win_type]->generic,
 			 tui_win_list[win_type]->generic.type,
 			 src_height,
 			 tui_win_list[win_type]->generic.width,
-			 tui_win_list[win_type]->detail.source_info.execution_info->width,
+			 base->execution_info->width,
 			 data_height - 1);
-      init_gen_win_info (tui_win_list[win_type]->detail.source_info.execution_info,
+      init_gen_win_info (base->execution_info,
 			 EXEC_INFO_WIN,
 			 src_height,
 			 3,
 			 0,
 			 data_height - 1);
       tui_make_visible (&tui_win_list[win_type]->generic);
-      tui_make_visible (tui_win_list[win_type]->detail.source_info.execution_info);
+      tui_make_visible (base->execution_info);
       init_gen_win_info (locator,
 			 LOCATOR_WIN,
 			 2 /* 1 */ ,
@@ -772,7 +777,7 @@  show_data (enum tui_layout_type new_layout)
 			 0,
 			 total_height - 1);
     }
-  tui_win_list[win_type]->detail.source_info.has_locator = true;
+  base->m_has_locator = true;
   tui_make_visible (locator);
   tui_show_locator_content ();
   tui_add_to_source_windows (tui_win_list[win_type]);
@@ -865,8 +870,8 @@  make_source_or_disasm_window (enum tui_win_type type,
 			  DONT_BOX_WINDOW));
 
   /* Now create the source window.  */
-  struct tui_win_info *result
-    = ((struct tui_win_info *)
+  struct tui_source_window_base *result
+    = ((struct tui_source_window_base *)
        init_and_make_win (NULL,
 			  type,
 			  height,
@@ -874,7 +879,7 @@  make_source_or_disasm_window (enum tui_win_type type,
 			  execution_info->width,
 			  origin_y,
 			  BOX_WINDOW));
-  result->detail.source_info.execution_info = execution_info;
+  result->execution_info = execution_info;
   return result;
 }
 
@@ -896,10 +901,11 @@  show_source_or_disasm_and_command (enum tui_layout_type layout_type)
       src_height = tui_term_height () - cmd_height;
 
       if (layout_type == SRC_COMMAND)
-	win_info_ptr = &TUI_SRC_WIN;
+	win_info_ptr = &tui_win_list[SRC_WIN];
       else
-	win_info_ptr = &TUI_DISASM_WIN;
+	win_info_ptr = &tui_win_list[DISASSEM_WIN];
 
+      tui_source_window_base *base;
       if ((*win_info_ptr) == NULL)
 	{
 	  if (layout_type == SRC_COMMAND)
@@ -915,35 +921,37 @@  show_source_or_disasm_and_command (enum tui_layout_type layout_type)
 				  0,
 				  src_height - 1,
 				  DONT_BOX_WINDOW));
+	  base = (tui_source_window_base *) *win_info_ptr;
 	}
       else
 	{
+	  base = (tui_source_window_base *) *win_info_ptr;
 	  init_gen_win_info (locator,
 			     LOCATOR_WIN,
 			     2 /* 1 */ ,
 			     tui_term_width (),
 			     0,
 			     src_height - 1);
-	  (*win_info_ptr)->detail.source_info.has_locator = true;
+	  base->m_has_locator = true;
 	  init_gen_win_info (&(*win_info_ptr)->generic,
 			     (*win_info_ptr)->generic.type,
 			     src_height - 1,
 			     (*win_info_ptr)->generic.width,
-			     (*win_info_ptr)->detail.source_info.execution_info->width,
+			     base->execution_info->width,
 			     0);
-	  init_gen_win_info ((*win_info_ptr)->detail.source_info.execution_info,
+	  init_gen_win_info (base->execution_info,
 			     EXEC_INFO_WIN,
 			     src_height - 1,
 			     3,
 			     0,
 			     0);
-	  (*win_info_ptr)->can_highlight = TRUE;
+	  base->can_highlight = TRUE;
 	  tui_make_visible (&(*win_info_ptr)->generic);
-	  tui_make_visible ((*win_info_ptr)->detail.source_info.execution_info);
+	  tui_make_visible (base->execution_info);
 	}
       if ((*win_info_ptr) != NULL)
 	{
-	  (*win_info_ptr)->detail.source_info.has_locator = true;
+	  base->m_has_locator = true;
 	  tui_make_visible (locator);
 	  tui_show_locator_content ();
 	  tui_show_source_content (*win_info_ptr);
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 5c50d2fb794..ac3f225e1b1 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -159,8 +159,8 @@  tui_set_source_content (struct symtab *s,
 	      int cur_line_no, cur_line;
 	      struct tui_gen_win_info *locator
 		= tui_locator_win_info_ptr ();
-	      struct tui_source_info *src
-		= &TUI_SRC_WIN->detail.source_info;
+	      struct tui_source_window_base *src
+		= (struct tui_source_window_base *) TUI_SRC_WIN;
 	      const char *s_filename = symtab_to_filename_for_display (s);
 
 	      if (TUI_SRC_WIN->generic.title)
@@ -289,7 +289,7 @@  tui_show_symtab_source (struct gdbarch *gdbarch, struct symtab *s,
 			struct tui_line_or_address line, 
 			int noerror)
 {
-  TUI_SRC_WIN->detail.source_info.horizontal_offset = 0;
+  TUI_SRC_WIN->horizontal_offset = 0;
   tui_update_source_window_as_is (TUI_SRC_WIN, gdbarch, s, line, noerror);
 }
 
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 5c807ad0324..9c4f9ad5779 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1268,11 +1268,13 @@  make_invisible_and_set_new_height (struct tui_win_info *win_info,
     win_info->generic.viewport_height--;
 
   /* Now deal with the auxillary windows associated with win_info.  */
+  tui_source_window_base *base;
   switch (win_info->generic.type)
     {
     case SRC_WIN:
     case DISASSEM_WIN:
-      gen_win_info = win_info->detail.source_info.execution_info;
+      base = (tui_source_window_base *) win_info;
+      gen_win_info = base->execution_info;
       tui_make_invisible (gen_win_info);
       gen_win_info->height = height;
       gen_win_info->origin.y = win_info->generic.origin.y;
@@ -1316,20 +1318,22 @@  make_visible_with_new_height (struct tui_win_info *win_info)
 
   tui_make_visible (&win_info->generic);
   tui_check_and_display_highlight_if_needed (win_info);
+  tui_source_window_base *base;
   switch (win_info->generic.type)
     {
     case SRC_WIN:
     case DISASSEM_WIN:
-      tui_free_win_content (win_info->detail.source_info.execution_info);
-      tui_make_visible (win_info->detail.source_info.execution_info);
+      base = (tui_source_window_base *) win_info;
+      tui_free_win_content (base->execution_info);
+      tui_make_visible (base->execution_info);
       if (win_info->generic.content != NULL)
 	{
-	  struct gdbarch *gdbarch = win_info->detail.source_info.gdbarch;
+	  struct gdbarch *gdbarch = base->gdbarch;
 	  struct tui_line_or_address line_or_addr;
 	  struct symtab_and_line cursal
 	    = get_current_source_symtab_and_line ();
 
-	  line_or_addr = win_info->detail.source_info.start_line_or_addr;
+	  line_or_addr = base->start_line_or_addr;
 	  tui_free_win_content (&win_info->generic);
 	  tui_update_source_window (win_info, gdbarch,
 				    cursal.symtab, line_or_addr, TRUE);
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index cacc0b84454..542881779fa 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -225,8 +225,11 @@  make_all_visible (int visible)
 	  && ((tui_win_list[i])->generic.type) != CMD_WIN)
 	{
 	  if (tui_win_is_source_type ((tui_win_list[i])->generic.type))
-	    make_visible ((tui_win_list[i])->detail.source_info.execution_info,
-			  visible);
+	    {
+	      tui_source_window_base *base
+		= (tui_source_window_base *) tui_win_list[i];
+	      make_visible (base->execution_info, visible);
+	    }
 	  make_visible (&tui_win_list[i]->generic, visible);
 	}
     }
@@ -260,8 +263,10 @@  tui_refresh_all (struct tui_win_info **list)
 	{
 	  if (type == SRC_WIN || type == DISASSEM_WIN)
 	    {
-	      touchwin (list[type]->detail.source_info.execution_info->handle);
-	      tui_refresh_win (list[type]->detail.source_info.execution_info);
+	      tui_source_window_base *base
+		= (tui_source_window_base *) list[type];
+	      touchwin (base->execution_info->handle);
+	      tui_refresh_win (base->execution_info);
 	    }
 	  touchwin (list[type]->generic.handle);
 	  tui_refresh_win (&list[type]->generic);
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 8c269e2ec4a..fa9e544f206 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -75,7 +75,8 @@  tui_update_source_window (struct tui_win_info *win_info,
 			  struct tui_line_or_address line_or_addr,
 			  int noerror)
 {
-  win_info->detail.source_info.horizontal_offset = 0;
+  tui_source_window_base *base = (tui_source_window_base *) win_info;
+  base->horizontal_offset = 0;
   tui_update_source_window_as_is (win_info, gdbarch, s, line_or_addr, noerror);
 
   return;
@@ -324,8 +325,9 @@  tui_refill_source_window (struct tui_win_info *win_info)
 	   : cursal.symtab);
     }
 
+  tui_source_window_base *base = (tui_source_window_base *) win_info;
   tui_update_source_window_as_is (win_info,
-				  win_info->detail.source_info.gdbarch,
+				  base->gdbarch,
 				  s,
 				  win_info->generic.content[0]
 				    ->which_element.source.line_or_addr,
@@ -343,16 +345,14 @@  tui_source_window_base::do_scroll_horizontal
       int offset;
 
       if (direction == LEFT_SCROLL)
-	offset = detail.source_info.horizontal_offset
-	  + num_to_scroll;
+	offset = horizontal_offset + num_to_scroll;
       else
 	{
-	  offset = detail.source_info.horizontal_offset
-	    - num_to_scroll;
+	  offset = horizontal_offset - num_to_scroll;
 	  if (offset < 0)
 	    offset = 0;
 	}
-      detail.source_info.horizontal_offset = offset;
+      horizontal_offset = offset;
       tui_refill_source_window (this);
     }
 }
@@ -425,7 +425,7 @@  tui_update_breakpoint_info (struct tui_win_info *win,
 {
   int i;
   int need_refresh = 0;
-  struct tui_source_info *src = &win->detail.source_info;
+  tui_source_window_base *src = (tui_source_window_base *) win;
 
   for (i = 0; i < win->generic.content_size; i++)
     {
@@ -494,10 +494,10 @@  tui_set_exec_info_content (struct tui_win_info *win_info)
 {
   enum tui_status ret = TUI_SUCCESS;
 
-  if (win_info->detail.source_info.execution_info != NULL)
+  tui_source_window_base *base = (tui_source_window_base *) win_info;
+  if (base->execution_info != NULL)
     {
-      struct tui_gen_win_info *exec_info_ptr
-	= win_info->detail.source_info.execution_info;
+      struct tui_gen_win_info *exec_info_ptr = base->execution_info;
 
       if (exec_info_ptr->content == NULL)
 	exec_info_ptr->content =
@@ -551,8 +551,8 @@  tui_set_exec_info_content (struct tui_win_info *win_info)
 void
 tui_show_exec_info_content (struct tui_win_info *win_info)
 {
-  struct tui_gen_win_info *exec_info
-    = win_info->detail.source_info.execution_info;
+  tui_source_window_base *base = (tui_source_window_base *) win_info;
+  struct tui_gen_win_info *exec_info = base->execution_info;
   int cur_line;
 
   werase (exec_info->handle);
@@ -571,8 +571,8 @@  tui_show_exec_info_content (struct tui_win_info *win_info)
 void
 tui_erase_exec_info_content (struct tui_win_info *win_info)
 {
-  struct tui_gen_win_info *exec_info
-    = win_info->detail.source_info.execution_info;
+  tui_source_window_base *base = (tui_source_window_base *) win_info;
+  struct tui_gen_win_info *exec_info = base->execution_info;
 
   werase (exec_info->handle);
   tui_refresh_win (exec_info);
@@ -581,7 +581,8 @@  tui_erase_exec_info_content (struct tui_win_info *win_info)
 void
 tui_clear_exec_info_content (struct tui_win_info *win_info)
 {
-  win_info->detail.source_info.execution_info->content_in_use = FALSE;
+  tui_source_window_base *base = (tui_source_window_base *) win_info;
+  base->execution_info->content_in_use = FALSE;
   tui_erase_exec_info_content (win_info);
 
   return;