aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
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:31 -0700
commitee325b61cd4389506d2dd63294c1ce1c64cb9d9f (patch)
tree1040c49dcd59346665afe89f07cfc62d2d0317ad /gdb/testsuite
parent416eb92d84ac0bc4b8aba137789f52d1f987cd54 (diff)
downloadgdb-ee325b61cd4389506d2dd63294c1ce1c64cb9d9f.zip
gdb-ee325b61cd4389506d2dd63294c1ce1c64cb9d9f.tar.gz
gdb-ee325b61cd4389506d2dd63294c1ce1c64cb9d9f.tar.bz2
Add the "tui new-layout" command
This adds a new command, "tui new-layout". This command can be used to define a new TUI window layout. The command is used like: (gdb) tui new-layout name src 1 regs 1 status 0 cmd 1 The first argument is the name of the layout. In this example, it is "name", so the new layout could be seen by "layout name". Subsequent arguments come in pairs, where the first item in a pair is the name of a window, and the second item in a pair is the window's weight. A weight is just an integer -- a window's allocated size is proportional to the total of the weights given. So, in the above example, all windows will have the same size (the status windows's weight does not matter, because it has fixed height). gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * NEWS: Add "tui new-layout" item. * tui/tui-layout.c (add_layout_command): Return cmd_list_element. Add new-layout command to help text. (validate_window_name): New function. (tui_new_layout_command): New function. (_initialize_tui_layout): Register "new-layout". (tui_layout_window::specification): New method. (tui_layout_window::specification): New method. * tui/tui-layout.h (class tui_layout_base) <specification>: New method. (class tui_layout_window) <specification>: New method. (class tui_layout_split) <specification>: New method. gdb/doc/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Overview): Mention user layouts. (TUI Commands): Document "tui new-layout". gdb/testsuite/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.tui/new-layout.exp: New file. Change-Id: Id7c3ace20ab1e8924f8f4ad788f40210f58a5c05
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.tui/new-layout.exp54
2 files changed, 58 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d3f555e..c7270b9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2020-02-22 Tom Tromey <tom@tromey.com>
+ * gdb.tui/new-layout.exp: New file.
+
+2020-02-22 Tom Tromey <tom@tromey.com>
+
* gdb.rust/rust-style.rs: New file.
* gdb.rust/rust-style.exp: New file.
* gdb.base/style.exp: Test structure printing.
diff --git a/gdb/testsuite/gdb.tui/new-layout.exp b/gdb/testsuite/gdb.tui/new-layout.exp
new file mode 100644
index 0000000..2efc172
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/new-layout.exp
@@ -0,0 +1,54 @@
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test "tui new-layout".
+
+load_lib "tuiterm.exp"
+
+standard_testfile tui-layout.c
+
+if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
+ return -1
+}
+
+Term::clean_restart 24 80 $testfile
+
+gdb_test "tui new-layout" \
+ "No layout name specified"
+gdb_test "tui new-layout example" \
+ "New layout does not contain any windows"
+gdb_test "tui new-layout example zzq" \
+ "Unknown window \"zzq\""
+gdb_test "tui new-layout example src 1 src 1" \
+ "Window \"src\" seen twice in layout"
+gdb_test "tui new-layout example src 1" \
+ "New layout does not contain the \"cmd\" window"
+
+gdb_test_no_output "tui new-layout example asm 1 status 0 cmd 1"
+
+gdb_test "help layout example" \
+ "Apply the \"example\" layout.*tui new-layout example asm 1 status 0 cmd 1"
+
+if {![Term::enter_tui]} {
+ unsupported "TUI not supported"
+}
+
+set text [Term::get_all_lines]
+gdb_assert {![string match "No Source Available" $text]} \
+ "initial source listing"
+
+Term::command "layout example"
+Term::check_contents "example layout shows assembly" \
+ "No Assembly Available"