public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Introduce tui_data_window::display_reg_element_at_line method
Date: Wed, 17 Jul 2019 18:37:00 -0000	[thread overview]
Message-ID: <20190717183748.65193.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aca2dd16474ec88b3969436044801f58f9163c5c

commit aca2dd16474ec88b3969436044801f58f9163c5c
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Jun 26 16:15:46 2019 -0600

    Introduce tui_data_window::display_reg_element_at_line method
    
    This changes tui_display_reg_element_at_line to be a method on
    tui_data_window, allowing for the removal of some uses of the
    TUI_DATA_WIN global.
    
    gdb/ChangeLog
    2019-07-17  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui-regs.c (tui_data_window::display_reg_element_at_line):
    	Rename from tui_display_reg_element_at_line.
    	(tui_data_window::display_registers_from_line): Update.
    	* tui/tui-data.h (struct tui_data_window)
    	<display_reg_element_at_line>: New method.

Diff:
---
 gdb/ChangeLog      |  8 ++++++++
 gdb/tui/tui-data.h |  6 ++++++
 gdb/tui/tui-regs.c | 26 ++++++++++----------------
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f98fa42..f4e9e5e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-regs.c (tui_data_window::display_reg_element_at_line):
+	Rename from tui_display_reg_element_at_line.
+	(tui_data_window::display_registers_from_line): Update.
+	* tui/tui-data.h (struct tui_data_window)
+	<display_reg_element_at_line>: New method.
+
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-regs.h (tui_display_registers_from)
 	(tui_display_registers_from_line): Don't declare.
 	* tui/tui-windata.c (tui_data_window::display_all_data)
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 5220c4b..ecf23a2 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -535,6 +535,12 @@ protected:
   /* Return the index of the first element displayed.  If none are
      displayed, then return -1.  */
   int first_data_item_displayed ();
+
+  /* Display the registers in the content from 'start_element_no' on
+     'start_line_no' until the end of the register content or the end
+     of the display height.  This function checks that we won't
+     display off the end of the register display.  */
+  void display_reg_element_at_line (int start_element_no, int start_line_no);
 };
 
 struct tui_cmd_window : public tui_win_info
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 05b4b55..56441bc 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -326,16 +326,13 @@ tui_data_window::display_registers_from (int start_element_no)
     }
 }
 
+/* See tui-data.h.  */
 
-/* Function to display the registers in the content from
-   'start_element_no' on 'start_line_no' until the end of the register
-   content or the end of the display height.  This function checks
-   that we won't display off the end of the register display.  */
-static void
-tui_display_reg_element_at_line (int start_element_no,
-				 int start_line_no)
+void
+tui_data_window::display_reg_element_at_line (int start_element_no,
+					      int start_line_no)
 {
-  if (!TUI_DATA_WIN->regs_content.empty ())
+  if (!regs_content.empty ())
     {
       int element_no = start_element_no;
 
@@ -343,9 +340,8 @@ tui_display_reg_element_at_line (int start_element_no,
 	{
 	  int last_line_no, first_line_on_last_page;
 
-	  last_line_no = TUI_DATA_WIN->last_regs_line_no ();
-	  first_line_on_last_page
-	    = last_line_no - (TUI_DATA_WIN->height - 2);
+	  last_line_no = last_regs_line_no ();
+	  first_line_on_last_page = last_line_no - (height - 2);
 	  if (first_line_on_last_page < 0)
 	    first_line_on_last_page = 0;
 
@@ -353,11 +349,9 @@ tui_display_reg_element_at_line (int start_element_no,
 	     registers, adjust what element to really start the
 	     display at.  */
 	  if (start_line_no > first_line_on_last_page)
-	    element_no
-	      = (TUI_DATA_WIN->first_reg_element_no_inline
-		 (first_line_on_last_page));
+	    element_no = first_reg_element_no_inline (first_line_on_last_page);
 	}
-      TUI_DATA_WIN->display_registers_from (element_no);
+      display_registers_from (element_no);
     }
 }
 
@@ -387,7 +381,7 @@ tui_data_window::display_registers_from_line (int line_no)
 
       element_no = first_reg_element_no_inline (line_no);
       if (element_no < regs_content.size ())
-	tui_display_reg_element_at_line (element_no, line_no);
+	display_reg_element_at_line (element_no, line_no);
       else
 	line_no = (-1);


                 reply	other threads:[~2019-07-17 18:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190717183748.65193.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).