aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-02-22 11:48:26 -0700
committerTom Tromey <tom@tromey.com>2020-02-22 11:48:27 -0700
commit59b8b5d2477440a21b580dbf59281a9e2795e1dc (patch)
tree1d10d25c10cbbe886117b3c7421ed48ad1db145e
parent2a3d458be380d4940fc528dca63ded4c2bab6c12 (diff)
downloadbinutils-59b8b5d2477440a21b580dbf59281a9e2795e1dc.zip
binutils-59b8b5d2477440a21b580dbf59281a9e2795e1dc.tar.gz
binutils-59b8b5d2477440a21b580dbf59281a9e2795e1dc.tar.bz2
Simplify tui_add_win_to_layout
tui_add_win_to_layout is only ever called for the source or assembly windows. This simplifies the function by removing the DATA_WIN case. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (tui_add_win_to_layout): Add comment. * tui/tui-layout.c (tui_add_win_to_layout): Add assert. Remove DATA_WIN case. Change-Id: Idfca902c6c90153acc5d19af4c33aa74bc3caf31
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/tui/tui-layout.c19
-rw-r--r--gdb/tui/tui-layout.h5
3 files changed, 15 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 532ab92..10a07df 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2020-02-22 Tom Tromey <tom@tromey.com>
+ * tui/tui-layout.h (tui_add_win_to_layout): Add comment.
+ * tui/tui-layout.c (tui_add_win_to_layout): Add assert. Remove
+ DATA_WIN case.
+
+2020-02-22 Tom Tromey <tom@tromey.com>
+
* tui/tui-disasm.c (tui_get_low_disassembly_address): Use
TUI_DISASM_WIN, not tui_win_list.
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 3d1e349..ce1f6a7 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -187,12 +187,13 @@ tui_set_layout (enum tui_layout_type layout_type)
}
}
-/* Add the specified window to the layout in a logical way. This
- means setting up the most logical layout given the window to be
- added. */
+/* See tui-layout.h. */
+
void
tui_add_win_to_layout (enum tui_win_type type)
{
+ gdb_assert (type == SRC_WIN || type == DISASSEM_WIN);
+
enum tui_layout_type cur_layout = tui_current_layout ();
switch (type)
@@ -219,18 +220,6 @@ tui_add_win_to_layout (enum tui_win_type type)
tui_set_layout (DISASSEM_COMMAND);
}
break;
- case DATA_WIN:
- if (cur_layout != SRC_DATA_COMMAND
- && cur_layout != DISASSEM_DATA_COMMAND)
- {
- if (cur_layout == DISASSEM_COMMAND)
- tui_set_layout (DISASSEM_DATA_COMMAND);
- else
- tui_set_layout (SRC_DATA_COMMAND);
- }
- break;
- default:
- break;
}
}
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index c2380b3..37f07c2 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -173,7 +173,12 @@ private:
bool m_applied = false;
};
+/* Add the specified window to the layout in a logical way. This
+ means setting up the most logical layout given the window to be
+ added. Only the source or disassembly window can be added this
+ way. */
extern void tui_add_win_to_layout (enum tui_win_type);
+
extern void tui_set_layout (enum tui_layout_type);
/* Apply the current layout. */