aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2025-02-04 10:21:28 +0100
committerTom de Vries <tdevries@suse.de>2025-02-04 10:21:28 +0100
commit9cc62187b4bcc5ddac456043f55542484f6fada3 (patch)
tree5d71801f32deb36b41d59a41e083ec8e373d66eb
parentbc61d5916a04605079723f6674bd33d2a923af2e (diff)
downloadbinutils-9cc62187b4bcc5ddac456043f55542484f6fada3.zip
binutils-9cc62187b4bcc5ddac456043f55542484f6fada3.tar.gz
binutils-9cc62187b4bcc5ddac456043f55542484f6fada3.tar.bz2
[gdb/tui] Remove stale title when showing "No Source Available"
When running test-case gdb.tui/main.exp, the last command discards the executable file and symbol table: ... (gdb) file No executable file now. Discard symbol table from `main'? (y or n) [answered Y; input not from terminal] No symbol file now. (gdb) ... and we end up with this source window: ... +-tui-layout.c----------------------------------------------------------------+ | | | | | | | | | | | | | [ No Source Available ] | | | | | | | | | | | | | +-----------------------------------------------------------------------------+ ... The source window title shouldn't be showing tui-layout.c. It's the source file containing function main for the executable that was just discarded. Fix this by clearing the title in tui_source_window::erase_source_content. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/testsuite/gdb.tui/main.exp3
-rw-r--r--gdb/tui/tui-source.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.tui/main.exp b/gdb/testsuite/gdb.tui/main.exp
index bc93ecf..4213035 100644
--- a/gdb/testsuite/gdb.tui/main.exp
+++ b/gdb/testsuite/gdb.tui/main.exp
@@ -50,3 +50,6 @@ Term::check_contents "show main after file" \
# Ensure that "file" clears the source window.
Term::command "file"
Term::check_contents "file clears window" "No Source Available"
+
+Term::check_region_contents "empty title" \
+ 0 0 80 1 {^\+-*\+$}
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 24c1009..9cad4ff 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -51,6 +51,10 @@ struct tui_source_window : public tui_source_window_base
void erase_source_content () override
{
do_erase_source_content (_("[ No Source Available ]"));
+
+ /* The source window's title shows the filename, so no source available
+ means no title. */
+ set_title ("");
}
void display_start_addr (struct gdbarch **gdbarch_p,