public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [RFC][gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp
Date: Tue, 31 Mar 2020 18:35:51 +0100	[thread overview]
Message-ID: <54017f47-6b30-cb69-49c1-2c2bfd15a5d8@redhat.com> (raw)
In-Reply-To: <20200316170131.GA20089@delia>

Hi,

Thanks for addressing this, and sorry for the delay.

On 3/16/20 5:01 PM, Tom de Vries wrote:
> Hi,
> 
> While running test-case gdb.multi/multi-target.exp, I observed a silent
> timeout related to "monitor exit".
> 
> By making the timeout explicit in an expect clause in gdbserver_gdb_exit:
> ...
> +  timeout {
> +    warning "Timed out waiting for EOF in server after $monitor_exit"
> +  }
> ...
> we get in the log:
> ...
> monitor exit^M
> "monitor" command not supported by this target.^M
> (gdb) WARNING: Timed out waiting for EOF in server after monitor exit
> ...
> 
> What happens is the following:
> - the inferior 5 is selected
> - a breakpoint is set in inferior 1
> - the breakpoint triggers and we switch to inferior 1
> - setup is called by test_continue, which calls clean_restarts, which calls

Typo: clean_restarts -> clean_restart

>   gdbserver_gdb_exit (due to load_lib gdbserver-support.exp)
> - gdbserver_gdb_exit issues "monitor exit"
> - gdb responds with "not supported by this target" because inferior 1 is
>   native
> 
> Fix this by keeping a list of server_spawn_id, and cleaning those up before
> calling gdbserver_gdb_exit.
> 
> This reduces testing time from 1m22s to 32s.
> 
> Any comments?

Looks mostly good to me, though I have a comment below.

> diff --git a/gdb/testsuite/gdb.multi/multi-target.exp b/gdb/testsuite/gdb.multi/multi-target.exp
> index 6c727b5e3b..2e66cb55fa 100644
> --- a/gdb/testsuite/gdb.multi/multi-target.exp
> +++ b/gdb/testsuite/gdb.multi/multi-target.exp
> @@ -33,8 +33,13 @@ if { [prepare_for_testing "failed to prepare" ${binfile} "${srcfile}" \
>      return
>  }
>  
> +# Keep list of server_spawn_id
> +set server_spawn_ids [list]

It'd not a huge deal, but how about making this a list of pairs
of (inferior ID, spawn ID)?  That would make cleanup_gdbservers not have
to hardcode the inferior numbers.  add_inferior, which is
connect_target_extended_remote's caller, has the inferior number
handy already in the NUM parameter, so it'd just need to pass it down
to connect_target_extended_remote.

Thanks,
Pedro Alves


      parent reply	other threads:[~2020-03-31 17:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 17:01 Tom de Vries
2020-03-30 14:30 ` [PING][RFC][gdb/testsuite] " Tom de Vries
2020-04-01 16:34   ` Tom Tromey
2020-03-31 17:35 ` Pedro Alves [this message]

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=54017f47-6b30-cb69-49c1-2c2bfd15a5d8@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).