public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/30414] Random failure in gdb.fortran/lbound-ubound.exp
Date: Thu, 18 May 2023 17:22:57 +0000	[thread overview]
Message-ID: <bug-30414-4717-0lzgv4hDad@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30414-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30414

--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <simark@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2bf4cc2b92a45f9d857907aec3d14b5ffd9ebd2e

commit 2bf4cc2b92a45f9d857907aec3d14b5ffd9ebd2e
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Thu May 4 11:28:48 2023 -0400

    gdb.fortran/lbound-ubound.exp: read expected lbound and ubound from
function parameters (PR 30414)

    gdb.fortran/lbound-ubound.exp reads the expected lbound and ubound
    values by reading some output from the inferior.  This is racy when
    running on boards where the inferior I/O is on a separate TTY than
    GDB's, such as native-gdbserver.

    I sometimes see this behavior:

        (gdb) continue
        Continuing.

        Breakpoint 2, do_test (lb=..., ub=...) at
/home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/nati
       
ve-gdbserver/src/binutils-gdb/gdb/testsuite/gdb.fortran/lbound-ubound.F90:45
        45        print *, ""   ! Test Breakpoint
        (gdb) Remote debugging from host ::1, port 37496

         Expected GDB Output:

        LBOUND = (-8, -10)
        UBOUND = (-1, -2)
        APB: Run a test here
        APB: Expected lbound '(-8, -10)'
        APB: Expected ubound ''

    What happened is that expect read the output from GDB before the output
    from the inferior, triggering this gdb_test_multiple clause:

        -re "$gdb_prompt $" {
            set found_prompt true

            if {$found_dealloc_breakpoint
                || ($expected_lbound != "" && $expected_ubound != "")} {
                # We're done.
            } else {
                exp_continue
            }
        }

    So it set found_prompt, but the gdb_test_multiple kept going because
    found_dealloc_breakpoint is false (this is the flag indicating that the
    test is finished) and we still don't have expected_lbound and
    expected_ubound.  Then, expect reads in the inferior I/O, triggering
    this clause:

        -re ".*LBOUND = (\[^\r\n\]+)\r\n" {
            set expected_lbound $expect_out(1,string)
            if {!$found_prompt} {
                exp_continue
            }
        }

    This sets expected_lbound, but since found_prompt is true, we don't do
    exp_continue, and exit the gdb_test_multiple, without having an
    expected_ubound.

    Change the test to read the values from the lb and ub function
    parameters instead.  As far as I understand, this still exercises what
    we want to test.  These variables contain the return values of the
    lbound and ubound functions as computed by the program.  We'll use them
    to check the return values of the lbound and ubound functions as
    computed by GDB.

    Change-Id: I3c4d3d17d9291870a758a42301d15a007821ebb5
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30414

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-05-18 17:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03  1:53 [Bug gdb/30414] New: " simon.marchi at polymtl dot ca
2023-05-04  8:25 ` [Bug gdb/30414] " vries at gcc dot gnu.org
2023-05-04  8:25 ` [Bug testsuite/30414] " vries at gcc dot gnu.org
2023-05-04 11:50 ` simon.marchi at polymtl dot ca
2023-05-04 11:57 ` vries at gcc dot gnu.org
2023-05-04 12:05 ` simon.marchi at polymtl dot ca
2023-05-04 15:48 ` simon.marchi at polymtl dot ca
2023-05-18 17:22 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-18 17:23 ` simon.marchi at polymtl dot ca

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=bug-30414-4717-0lzgv4hDad@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).