public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Remove tui_default_win_viewport_height
Date: Wed, 16 Oct 2019 05:51:00 -0000	[thread overview]
Message-ID: <6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10 ***

commit 6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Tue Oct 1 17:03:54 2019 -0600
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Wed Oct 9 16:50:33 2019 -0600

    Remove tui_default_win_viewport_height
    
    tui_default_win_viewport_height was only called from a single spot,
    for a single type of window.  This patch removes the function and
    moves the logic into the sole caller.
    
    gdb/ChangeLog
    2019-10-09  Tom Tromey  <tom@tromey.com>
    
            * tui/tui-disasm.c (tui_get_low_disassembly_address): Compute
            window height directly.
            * tui/tui-layout.h (tui_default_win_viewport_height): Don't
            declare.
            * tui/tui-layout.c (tui_default_win_height): Remove.
            (tui_default_win_viewport_height): Remove.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f6c800da77..7fb3394c0c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2019-10-09  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-disasm.c (tui_get_low_disassembly_address): Compute
+	window height directly.
+	* tui/tui-layout.h (tui_default_win_viewport_height): Don't
+	declare.
+	* tui/tui-layout.c (tui_default_win_height): Remove.
+	(tui_default_win_viewport_height): Remove.
+
 2019-10-09  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui.h: Remove comments.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 51616bcf87..33a3ba12d4 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -28,6 +28,7 @@
 #include "source.h"
 #include "disasm.h"
 #include "tui/tui.h"
+#include "tui/tui-command.h"
 #include "tui/tui-data.h"
 #include "tui/tui-win.h"
 #include "tui/tui-layout.h"
@@ -325,7 +326,14 @@ tui_get_low_disassembly_address (struct gdbarch *gdbarch,
 
   /* Determine where to start the disassembly so that the pc is about
      in the middle of the viewport.  */
-  pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2;
+  if (tui_win_list[DISASSEM_WIN] != NULL)
+    pos = tui_win_list[DISASSEM_WIN]->height;
+  else if (TUI_CMD_WIN == NULL)
+    pos = tui_term_height () / 2 - 2;
+  else
+    pos = tui_term_height () - TUI_CMD_WIN->height - 2;
+  pos = (pos - 2) / 2;
+
   pc = tui_find_disassembly_address (gdbarch, pc, -pos);
 
   if (pc < low)
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 7aa670ec69..ccc750e1db 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -233,66 +233,6 @@ tui_add_win_to_layout (enum tui_win_type type)
     }
 }
 
-
-/* Answer the height of a window.  If it hasn't been created yet,
-   answer what the height of a window would be based upon its type and
-   the layout.  */
-static int
-tui_default_win_height (enum tui_win_type type, 
-			enum tui_layout_type layout)
-{
-  int h;
-
-  if (tui_win_list[type] != NULL)
-    h = tui_win_list[type]->height;
-  else
-    {
-      switch (layout)
-	{
-	case SRC_COMMAND:
-	case DISASSEM_COMMAND:
-	  if (TUI_CMD_WIN == NULL)
-	    h = tui_term_height () / 2;
-	  else
-	    h = tui_term_height () - TUI_CMD_WIN->height;
-	  break;
-	case SRC_DISASSEM_COMMAND:
-	case SRC_DATA_COMMAND:
-	case DISASSEM_DATA_COMMAND:
-	  if (TUI_CMD_WIN == NULL)
-	    h = tui_term_height () / 3;
-	  else
-	    h = (tui_term_height () - TUI_CMD_WIN->height) / 2;
-	  break;
-	default:
-	  h = 0;
-	  break;
-	}
-    }
-
-  return h;
-}
-
-
-/* Answer the height of a window.  If it hasn't been created yet,
-   answer what the height of a window would be based upon its type and
-   the layout.  */
-int
-tui_default_win_viewport_height (enum tui_win_type type,
-				 enum tui_layout_type layout)
-{
-  int h;
-
-  h = tui_default_win_height (type, layout);
-
-  if (type == CMD_WIN)
-    h -= 1;
-  else
-    h -= 2;
-
-  return h;
-}
-
 /* Complete possible layout names.  TEXT is the complete text entered so
    far, WORD is the word currently being completed.  */
 
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index a7e1e90898..23f05f34aa 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -26,8 +26,6 @@
 #include "tui/tui-data.h"
 
 extern void tui_add_win_to_layout (enum tui_win_type);
-extern int tui_default_win_viewport_height (enum tui_win_type,
-					    enum tui_layout_type);
 extern void tui_set_layout (enum tui_layout_type);
 
 #endif /* TUI_TUI_LAYOUT_H */


             reply	other threads:[~2019-10-16  5:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16  5:51 gdb-buildbot [this message]
2019-10-16  5:51 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-10-16  7:26 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2019-10-16  8:04 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-10-22 14:50 ` Failures on Fedora-i686, " gdb-buildbot
2019-10-22 16:25 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-10-22 17:19 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-10-22 17:22 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot

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=6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@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).