Remove struct tui_source_info
authorTom Tromey <tom@tromey.com>
Sun, 16 Jun 2019 19:46:18 +0000 (13:46 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 25 Jun 2019 13:48:30 +0000 (07:48 -0600)
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-25  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
gdb/tui/tui-data.c
gdb/tui/tui-data.h
gdb/tui/tui-disasm.c
gdb/tui/tui-layout.c
gdb/tui/tui-source.c
gdb/tui/tui-win.c
gdb/tui/tui-wingeneral.c
gdb/tui/tui-winsource.c

index 5bee65ae156f2fc997cfc96a4f5402e31e5b6a1a..3fd6bc73dbd416406bdbe6b651c5bc0ee2c3a0f3 100644 (file)
@@ -1,3 +1,38 @@
+2019-06-25  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.
+
 2019-06-25  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-win.c (make_invisible_and_set_new_height)
index be170612263cef9f320c3a964d9922410e7438ec..f15cf314f019a80fdd013ebea31656b33a1b688c 100644 (file)
@@ -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);
     }
 }
 
index 9b7364b1e85c4319e9334004bb6eb71cf67efc74..4aef2f58ae093aee810eb4eeb01d58242fc0a7fd 100644 (file)
@@ -238,23 +238,6 @@ struct tui_data_info
 };
 
 
-struct tui_source_info
-{
-  /* Does the locator belong to this window?  */
-  bool has_locator;
-  /* 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;
@@ -303,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;
   }
@@ -334,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 the locator belong 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.  */
@@ -418,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]
 
index efb9d1cb628f6a38b4643f85c1e32a63626ad48a..8dd156d09079094e50b5e9ccf6c579bb8d17a752 100644 (file)
@@ -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;
index f4df49253afc7c7f19e7ca9049bb77de346b5ccf..55d737ab315b0cb461a19c03a33ec7a78a16c92d 100644 (file)
@@ -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);
index 5c50d2fb794792ed575a9070fd750f3805888908..ac3f225e1b1e0be6c6e9f7b28afb42ef80ebd821 100644 (file)
@@ -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);
 }
 
index 5c807ad0324653e2de7acf906d8e118970bfb74c..9c4f9ad57790a9db80651b95b8751724274e6423 100644 (file)
@@ -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);
index cacc0b844540316e6e8003cc7ca19532a54d90cd..542881779fa5c3c459962dda05d654aacf4dd019 100644 (file)
@@ -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);
index 8c269e2ec4ac8279137dd3212712fa37eefc5db1..fa9e544f206c299c90a2f1e8ed69dcea68b8d4eb 100644 (file)
@@ -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;