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 5/9] Change tui_update_source_window to be a method


This changes tui_update_source_window to be a method on
tui_source_window_base.

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

	* tui/tui-winsource.h (struct tui_source_window_base)
	<update_source_window>: Declare.
	(tui_update_source_window): Don't declare.
	* tui/tui-winsource.c
	(tui_source_window_base::update_source_window): Rename from
	tui_update_source_window.
	(tui_source_window_base::rerender): Update.
	* tui/tui-source.c (tui_source_window::maybe_update): Update.
	* tui/tui-disasm.c (tui_show_disassem)
	(tui_show_disassem_and_update_source)
	(tui_disasm_window::maybe_update): Update.
---
 gdb/ChangeLog           | 14 ++++++++++++++
 gdb/tui/tui-disasm.c    |  7 +++----
 gdb/tui/tui-source.c    |  3 +--
 gdb/tui/tui-winsource.c | 17 ++++++++---------
 gdb/tui/tui-winsource.h |  6 +++---
 5 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index d47639c4c77..221e48e661a 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -257,7 +257,7 @@ tui_show_disassem (struct gdbarch *gdbarch, CORE_ADDR start_addr)
 
   val.loa = LOA_ADDRESS;
   val.u.addr = start_addr;
-  tui_update_source_window (TUI_DISASM_WIN, gdbarch, s, val);
+  TUI_DISASM_WIN->update_source_window (gdbarch, s, val);
 
   /* If the focus was in the src win, put it in the asm win, if the
      source view isn't split.  */
@@ -285,7 +285,7 @@ tui_show_disassem_and_update_source (struct gdbarch *gdbarch,
       sal = find_pc_line (start_addr, 0);
       val.loa = LOA_LINE;
       val.u.line_no = sal.line;
-      tui_update_source_window (TUI_SRC_WIN, gdbarch, sal.symtab, val);
+      TUI_SRC_WIN->update_source_window (gdbarch, sal.symtab, val);
       if (sal.symtab)
 	{
 	  set_current_source_symtab_and_line (sal);
@@ -418,8 +418,7 @@ tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
   a.loa = LOA_ADDRESS;
   a.u.addr = low;
   if (!addr_is_displayed (addr))
-    tui_update_source_window (this, get_frame_arch (fi),
-			      sal.symtab, a);
+    update_source_window (get_frame_arch (fi), sal.symtab, a);
   else
     {
       a.u.addr = addr;
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index e62d999fe3e..f08bd88aeff 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -317,8 +317,7 @@ tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
   l.u.line_no = start_line;
   if (!(source_already_displayed
 	&& line_is_displayed (line_no)))
-    tui_update_source_window (this, get_frame_arch (fi),
-			      sal.symtab, l);
+    update_source_window (get_frame_arch (fi), sal.symtab, l);
   else
     {
       l.u.line_no = line_no;
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 2c747eb42a9..3d1d6c4a97e 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -70,13 +70,13 @@ tui_display_main ()
 /* Function to display source in the source window.  This function
    initializes the horizontal scroll to 0.  */
 void
-tui_update_source_window (struct tui_source_window_base *win_info,
-			  struct gdbarch *gdbarch,
-			  struct symtab *s,
-			  struct tui_line_or_address line_or_addr)
+tui_source_window_base::update_source_window
+  (struct gdbarch *gdbarch,
+   struct symtab *s,
+   struct tui_line_or_address line_or_addr)
 {
-  win_info->horizontal_offset = 0;
-  win_info->update_source_window_as_is (gdbarch, s, line_or_addr);
+  horizontal_offset = 0;
+  update_source_window_as_is (gdbarch, s, line_or_addr);
 }
 
 
@@ -325,8 +325,7 @@ tui_source_window_base::rerender ()
 	= get_current_source_symtab_and_line ();
 
       line_or_addr = start_line_or_addr;
-      tui_update_source_window (this, gdbarch,
-				cursal.symtab, line_or_addr);
+      update_source_window (gdbarch, cursal.symtab, line_or_addr);
     }
   else if (deprecated_safe_get_selected_frame () != NULL)
     {
@@ -347,7 +346,7 @@ tui_source_window_base::rerender ()
 	  line.loa = LOA_ADDRESS;
 	  find_line_pc (s, cursal.line, &line.u.addr);
 	}
-      tui_update_source_window (this, gdbarch, s, line);
+      update_source_window (gdbarch, s, line);
     }
   else
     erase_source_content ();
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index ebc50e71e03..80608b5d733 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -138,6 +138,9 @@ public:
   void update_source_window_as_is  (struct gdbarch *gdbarch,
 				    struct symtab *s,
 				    struct tui_line_or_address line_or_addr);
+  void update_source_window (struct gdbarch *gdbarch,
+			     struct symtab *s,
+			     struct tui_line_or_address line_or_addr);
 
   /* Erase the source content.  */
   virtual void erase_source_content () = 0;
@@ -247,9 +250,6 @@ extern bool tui_update_breakpoint_info (struct tui_source_window_base *win,
 
 /* Function to display the "main" routine.  */
 extern void tui_display_main (void);
-extern void tui_update_source_window (struct tui_source_window_base *, 
-				      struct gdbarch *, struct symtab *,
-				      struct tui_line_or_address);
 extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
 extern void tui_update_source_windows_with_line (struct symtab *, 
 						 int);
-- 
2.17.2


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