This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 18/19] Don't track the contents of the execution info window


The curses library keeps track of the contents of each window, and can
redraw the screen as needed.  This means that in most cases is no need
for the TUI windows to also keep track of their contents.  This patch
removes content tracking from the execution window, leaving that to
curses.

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

	* tui/tui-winsource.h (struct tui_exec_info_window)
	<~tui_exec_info_window, maybe_allocate_content, get_content,
	m_content>: Remove.
	(struct tui_source_window_base) <set_exec_info_content,
	show_exec_info_content>: Don't declare.
	* tui/tui-winsource.c
	(tui_exec_info_window::maybe_allocate_content): Remove.
	(tui_source_window_base::update_exec_info): Rename from
	set_exec_info_content.
	(tui_source_window_base::show_exec_info_content)
	(tui_source_window_base::update_exec_info): Remove.
---
 gdb/ChangeLog           | 14 +++++++++++
 gdb/tui/tui-winsource.c | 56 ++++++-----------------------------------
 gdb/tui/tui-winsource.h | 22 ----------------
 3 files changed, 22 insertions(+), 70 deletions(-)

diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 2f02c6a0120..1b2b4393fd9 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -587,41 +587,22 @@ tui_update_breakpoint_info (struct tui_source_window_base *win,
   return need_refresh;
 }
 
-/* See tui-data.h.  */
-
-tui_exec_info_content *
-tui_exec_info_window::maybe_allocate_content (int n_elements)
-{
-  if (m_content == nullptr)
-    m_content = XNEWVEC (tui_exec_info_content, n_elements);
-  return m_content;
-}
-
-
 /* Function to initialize the content of the execution info window,
    based upon the input window which is either the source or
    disassembly window.  */
 void
-tui_source_window_base::set_exec_info_content ()
+tui_source_window_base::update_exec_info ()
 {
-  tui_exec_info_content *exec_content
-    = execution_info->maybe_allocate_content (height);
-
+  werase (execution_info->handle);
   tui_update_breakpoint_info (this, nullptr, true);
   for (int i = 0; i < content.size (); i++)
     {
-      tui_exec_info_content &element = exec_content[i];
-      struct tui_source_element *src_element;
-      tui_bp_flags mode;
-
-      src_element = &content[i];
-
-      memset (element, ' ', sizeof (tui_exec_info_content));
-      element[TUI_EXECINFO_SIZE - 1] = 0;
+      struct tui_source_element *src_element = &content[i];
+      char element[TUI_EXECINFO_SIZE] = "   ";
 
       /* Now update the exec info content based upon the state
 	 of each line as indicated by the source content.  */
-      mode = src_element->break_mode;
+      tui_bp_flags mode = src_element->break_mode;
       if (mode & TUI_BP_HIT)
 	element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
       else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
@@ -634,34 +615,13 @@ tui_source_window_base::set_exec_info_content ()
 
       if (src_element->is_exec_point)
 	element[TUI_EXEC_POS] = '>';
-    }
-}
-
 
-void
-tui_source_window_base::show_exec_info_content ()
-{
-  struct tui_exec_info_window *exec_info = execution_info;
-  const tui_exec_info_content *exec_content = exec_info->get_content ();
-
-  werase (exec_info->handle);
-  for (int cur_line = 1; cur_line <= content.size (); cur_line++)
-    mvwaddstr (exec_info->handle,
-	       cur_line,
-	       0,
-	       exec_content[cur_line - 1]);
-  exec_info->refresh_window ();
+      mvwaddstr (execution_info->handle, i + 1, 0, element);
+    }
+  execution_info->refresh_window ();
 }
 
 
-/* Function to update the execution info window.  */
-void
-tui_source_window_base::update_exec_info ()
-{
-  set_exec_info_content ();
-  show_exec_info_content ();
-}
-
 void
 tui_alloc_source_buffer (struct tui_source_window_base *win_info)
 {
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index e0a96c14dcc..abb7ea34816 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -52,24 +52,6 @@ struct tui_exec_info_window : public tui_gen_win_info
     : tui_gen_win_info (EXEC_INFO_WIN)
   {
   }
-
-  ~tui_exec_info_window () override
-  {
-    xfree (m_content);
-  }
-
-  /* Get or allocate contents.  */
-  tui_exec_info_content *maybe_allocate_content (int n_elements);
-
-  /* Return the contents.  */
-  const tui_exec_info_content *get_content () const
-  {
-    return m_content;
-  }
-
-private:
-
-  tui_exec_info_content *m_content = nullptr;
 };
 
 /* Elements in the Source/Disassembly Window.  */
@@ -132,7 +114,6 @@ public:
 
   void show_source_content ();
 
-  void set_exec_info_content ();
   void update_exec_info ();
 
   /* Does the locator belong to this window?  */
@@ -150,9 +131,6 @@ public:
   struct gdbarch *gdbarch = nullptr;
 
   std::vector<tui_source_element> content;
-
-private:
-  void show_exec_info_content ();
 };
 
 /* Update the execution windows to show the active breakpoints.  This
-- 
2.17.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]