]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/tui] Remove stale title when showing "No Source Available"
authorTom de Vries <tdevries@suse.de>
Tue, 4 Feb 2025 09:21:28 +0000 (10:21 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 4 Feb 2025 09:21:28 +0000 (10:21 +0100)
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>
gdb/testsuite/gdb.tui/main.exp
gdb/tui/tui-source.h

index bc93ecfdb25240a8a86fed3e0d53b9855943833a..4213035fc468e0a9a99a9700bbc5cf0960c89452 100644 (file)
@@ -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 {^\+-*\+$}
index 24c1009fc7cd5b66ae05ff20c3afe6f2a504e9f2..9cad4ff91b4d57e60301bee02871c93967f4b8f3 100644 (file)
@@ -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,