From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 2/3] Make "disassemble" always use TUI disassembly window
Date: Fri, 27 Dec 2019 23:50:00 -0000 [thread overview]
Message-ID: <20191227235034.5453-3-tom@tromey.com> (raw)
In-Reply-To: <20191227235034.5453-1-tom@tromey.com>
Currently the "disassemble" command will use the TUI disassembly
window if it is already showing. I think it makes more sense to
unconditionally switch to it. This patch implements this.
gdb/ChangeLog
2019-12-27 Tom Tromey <tom@tromey.com>
* cli/cli-cmds.c (print_disassembly): Just check tui_active.
gdb/testsuite/ChangeLog
2019-12-27 Tom Tromey <tom@tromey.com>
* gdb.tui/disasm.exp: New file.
Change-Id: I3bf3a93f618b2138c49c28156cf6c6f5ca0fa762
---
gdb/ChangeLog | 4 ++++
gdb/cli/cli-cmds.c | 2 +-
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.tui/disasm.exp | 36 ++++++++++++++++++++++++++++++++
4 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 gdb/testsuite/gdb.tui/disasm.exp
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index e1410690aaf..b2ef904ff60 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1338,7 +1338,7 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
gdb_disassembly_flags flags)
{
#if defined(TUI)
- if (tui_is_window_visible (DISASSEM_WIN))
+ if (tui_active)
tui_show_assembly (gdbarch, low);
else
#endif
diff --git a/gdb/testsuite/gdb.tui/disasm.exp b/gdb/testsuite/gdb.tui/disasm.exp
new file mode 100644
index 00000000000..362aa7087ec
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/disasm.exp
@@ -0,0 +1,36 @@
+# Copyright 2019 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 that "disassemble" shows the disassembly window.
+
+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
+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 "disassemble main"
+Term::check_contents "asm window is showing" "$hex <main>"
--
2.17.2
next prev parent reply other threads:[~2019-12-27 23:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-27 23:50 [PATCH 0/3] More TUI improvements Tom Tromey
2019-12-27 23:50 ` [PATCH 3/3] Remove flickering from the TUI Tom Tromey
2019-12-27 23:50 ` Tom Tromey [this message]
2020-01-19 20:08 ` [PATCH 2/3] Make "disassemble" always use TUI disassembly window Tom Tromey
2020-01-20 0:48 ` Andrew Burgess
2020-01-23 19:54 ` Tom Tromey
2019-12-27 23:50 ` [PATCH 1/3] Make "file" clear TUI source window Tom Tromey
2020-01-19 20:10 ` [PATCH 0/3] More TUI improvements Tom Tromey
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=20191227235034.5453-3-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@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).