From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 1/3] Make "file" clear TUI source window
Date: Fri, 27 Dec 2019 23:50:00 -0000 [thread overview]
Message-ID: <20191227235034.5453-2-tom@tromey.com> (raw)
In-Reply-To: <20191227235034.5453-1-tom@tromey.com>
I noticed that a plain "file" will leave the current source file in
the TUI source window. Instead, I think, it should clear the source
window. This patch implements this.
2019-12-21 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_line):
Handle case where symtab is null.
gdb/testsuite/ChangeLog
2019-12-22 Tom Tromey <tom@tromey.com>
* gdb.tui/main.exp: Add check for plain "file".
Change-Id: I8424acf837f1a47f75bc6a833d1e917d4c10b51e
---
gdb/ChangeLog | 5 +++++
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.tui/main.exp | 7 +++++++
gdb/tui/tui-winsource.c | 11 ++++++-----
4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/gdb/testsuite/gdb.tui/main.exp b/gdb/testsuite/gdb.tui/main.exp
index 57ddb52bf36..b62e0f420d9 100644
--- a/gdb/testsuite/gdb.tui/main.exp
+++ b/gdb/testsuite/gdb.tui/main.exp
@@ -26,9 +26,16 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
# Note: don't pass the executable here
Term::clean_restart 24 80
+# Later on we'd like to avoid having to answer a question.
+gdb_test_no_output "set interactive-mode off"
+
if {![Term::enter_tui]} {
unsupported "TUI not supported"
}
Term::command "file [standard_output_file $testfile]"
Term::check_contents "show main after file" "\\|.*21 *return 0"
+
+# Ensure that "file" clears the source window.
+Term::command "file"
+Term::check_contents "file clears window" "No Source Available"
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 1ac650b6987..d720e99c6ab 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -212,11 +212,12 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
void
tui_update_source_windows_with_line (struct symtab_and_line sal)
{
- if (!sal.symtab)
- return;
-
- find_line_pc (sal.symtab, sal.line, &sal.pc);
- struct gdbarch *gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
+ struct gdbarch *gdbarch = nullptr;
+ if (sal.symtab != nullptr)
+ {
+ find_line_pc (sal.symtab, sal.line, &sal.pc);
+ gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
+ }
for (struct tui_source_window_base *win_info : tui_source_windows ())
win_info->update_source_window (gdbarch, sal);
--
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 2/3] Make "disassemble" always use TUI disassembly window Tom Tromey
2020-01-19 20:08 ` Tom Tromey
2020-01-20 0:48 ` Andrew Burgess
2020-01-23 19:54 ` 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: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-2-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