]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: fix invalid assumption about TUI src window
authorAndrew Burgess <aburgess@redhat.com>
Tue, 19 Aug 2025 08:32:13 +0000 (08:32 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 19 Aug 2025 13:33:39 +0000 (14:33 +0100)
Fix a failing test introduced by this commit:

  commit e53b88b40ed38651b50f954dfe76066822094c15
  Date:   Wed Aug 13 15:29:38 2025 +0100

      gdb: fix forward/reverse search, when no lines are printed

The TUI test added in this commit assumed that the opening '{' of main
would be the first statement line (in DWARF terms), and so, would be
the initial focus of the TUI src window.

This is true for some targets (e.g. x86), but not
others (e.g. AArch64), and so gdb.tui/source-search.exp was seen
failing on at least some AArch64 targets.

Fix this by adding a 'list' command to the test, which forces the
initial window contents to be as needed for the rest of the test.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33290
Approved-By: Tom de Vries <tdevries@suse.de>
gdb/testsuite/gdb.tui/source-search.exp

index 6865db490f38fa8becfb808e596088b0bad8359d..41bf1214b783d06b5cb83e4e18c2314eca991e1c 100644 (file)
@@ -36,9 +36,10 @@ proc check_src_window { testname first_line } {
 
 }
 
+# Initialise the src window so that it is displaying known contents.
+# Check that the expected contents are displayed.
+Term::command "list 20"
 set first_line 15
-
-# Check that the window contents are as expected.
 check_src_window "initial src contents" $first_line
 
 # Search forward.  Searches are from the last line displayed, so this