aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-disasm.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-10-01 17:03:54 -0600
committerTom Tromey <tom@tromey.com>2019-10-09 16:50:33 -0600
commit6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10 (patch)
treef5bf4062127409a843119d1983703d26a792ea72 /gdb/tui/tui-disasm.c
parentd2dd1084c10839efb916a0bfe57ca7a056d08b47 (diff)
downloadgdb-6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10.zip
gdb-6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10.tar.gz
gdb-6d7fd9aa4768c3fad5b5354c87eefb8026a0ba10.tar.bz2
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.
Diffstat (limited to 'gdb/tui/tui-disasm.c')
-rw-r--r--gdb/tui/tui-disasm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 51616bc..33a3ba1 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)