From 0dbc2fc759fc8b5eaa69d7b3b7d0c4cf4afb19be Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 22 Feb 2020 11:48:26 -0700 Subject: [PATCH] Reimplement "tui reg" command This reimplements the low-level layout function that is used by the "tui reg" command. Now it simply calls into the existing "layout" command, though this will be changed again in a subsequent patch. The rationale for this patch is that it makes it simpler to remove "enum tui_layout_type". gdb/ChangeLog 2020-02-22 Tom Tromey * tui/tui-regs.c (tui_reg_layout): Remove. (tui_reg_command): Use tui_regs_layout. * tui/tui-layout.h (tui_reg_command): Declare. * tui/tui-layout.c (tui_reg_command): New function. Change-Id: I0ca6884e2967005e7d3fbf5f13a0ac8f9c3298cf --- gdb/ChangeLog | 7 +++++++ gdb/tui/tui-layout.c | 8 ++++++++ gdb/tui/tui-layout.h | 3 +++ gdb/tui/tui-regs.c | 17 +---------------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4579505c7d5..d044a559bc0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-02-22 Tom Tromey + + * tui/tui-regs.c (tui_reg_layout): Remove. + (tui_reg_command): Use tui_regs_layout. + * tui/tui-layout.h (tui_reg_command): Declare. + * tui/tui-layout.c (tui_reg_command): New function. + 2020-02-22 Tom Tromey * tui/tui.c (tui_rl_delete_other_windows): Call diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index e9642584fdd..74a5745aac9 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -288,6 +288,14 @@ tui_next_layout () /* See tui-layout.h. */ +void +tui_regs_layout () +{ + tui_layout_command ("regs", 0); +} + +/* See tui-layout.h. */ + void tui_remove_some_windows () { diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h index f711b004b84..05089ab8fff 100644 --- a/gdb/tui/tui-layout.h +++ b/gdb/tui/tui-layout.h @@ -194,6 +194,9 @@ extern void tui_set_layout (enum tui_layout_type); /* Switch to the next layout. */ extern void tui_next_layout (); +/* Show the register window. Like "layout regs". */ +extern void tui_regs_layout (); + /* Remove some windows from the layout, leaving only the focused window and the command window; if no window has the focus, then some other window is chosen to remain. */ diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index f0dfdefc80f..7858236ddcb 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -550,21 +550,6 @@ tui_reg_prev (struct reggroup *current_group, struct gdbarch *gdbarch) return group; } -/* A helper function to display the register window in the appropriate - way. */ - -static void -tui_reg_layout () -{ - enum tui_layout_type cur_layout = tui_current_layout (); - enum tui_layout_type new_layout; - if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND) - new_layout = SRC_DATA_COMMAND; - else - new_layout = DISASSEM_DATA_COMMAND; - tui_set_layout (new_layout); -} - /* Implement the 'tui reg' command. Changes the register group displayed in the tui register window. Displays the tui register window if it is not already on display. */ @@ -588,7 +573,7 @@ tui_reg_command (const char *args, int from_tty) appropriate layout. We need to do this before trying to run the 'next' or 'prev' commands. */ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible ()) - tui_reg_layout (); + tui_regs_layout (); struct reggroup *current_group = TUI_DATA_WIN->get_current_group (); if (strncmp (args, "next", len) == 0) -- 2.30.2