]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: fix gdb.base/basic-edit-cmd.exp test
authorAndrew Burgess <aburgess@redhat.com>
Fri, 8 Nov 2024 11:19:33 +0000 (11:19 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 8 Nov 2024 11:19:33 +0000 (11:19 +0000)
In the recent commit:

  commit 31ada87f91b4c5306d81c8a896df9764c32941f3
  Date:   Wed Nov 6 22:18:55 2024 +0000

      gdb: fixes and tests for the 'edit' command

the new gdb.base/basic-edit-cmd.exp was added.  The Linaro CI
highlighted an issue with the test which I failed to address before
pushing the above commit.

Part of the test loads a file into GDB and then uses the 'edit'
command with no arguments to edit the default location.  This default
location is expected to be the 'main' function.

On my local machine the line reported is the opening '{' of main, and
that is what the test checks for.

The Linaro CI though appears to see the first code line of main.

I think either result is fine as far as this test is concerned, so
I've expanded the test regexp to check for either line number.  This
should make the CI testing happy again.

gdb/testsuite/gdb.base/basic-edit-cmd.exp

index 116daf9e3b79a0bd79e5821d3a252dcadfe6ffd9..aa0efb5459757a2e87ae3984b7561779bc7108f9 100644 (file)
@@ -76,8 +76,11 @@ save_vars { env(EDITOR) } {
        # even for non-dwarf debug formats, but this currently fails
        # with the stabs board.
        if { $non_dwarf } { setup_xfail *-*-* }
+       # Additionally, some targets will report the default location
+       # as the opening brace of main, while others report the first
+       # line of code inside main.  For this test either will do.
        gdb_test "edit" \
-           "\r\n\\+$line_0 $srcfile_re" \
+           "\r\n\\+(?:$line_0|$line_1) $srcfile_re" \
            "check edit of default location"
 
        gdb_test "list $line_4" \