public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] [gdb/testsuite] Disable inferior output in gdb.base/foll-vfork.exp
Date: Tue, 16 Nov 2021 16:46:04 +0100	[thread overview]
Message-ID: <414372b0-565f-8150-4f8f-602afd7cbfc9@suse.de> (raw)
In-Reply-To: <46eb8898-38d7-48c1-a0e9-2603aa9b279f@simark.ca>

On 11/16/21 4:01 PM, Simon Marchi wrote:
> On 2021-11-15 5:11 p.m., Tom de Vries via Gdb-patches wrote:
>> On 11/15/21 5:39 PM, Simon Marchi wrote:
>>> On 2021-11-15 6:21 a.m., Tom de Vries via Gdb-patches wrote:
>>>> Test-case gdb.base/foll-vfork.exp has inferior output that is not needed, but
>>>> which makes the regexp matching more difficult (see commit 1f28b70def1
>>>> "[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp").
>>>>
>>>> Disable the inferior output using '#if DEBUG'.
>>>>
>>>> Tested on x86_64-linux.
>>>> ---
>>>>  gdb/testsuite/gdb.base/foll-vfork-exit.c | 14 ++++++++++++--
>>>>  gdb/testsuite/gdb.base/foll-vfork.c      |  9 ++++++++-
>>>>  gdb/testsuite/gdb.base/foll-vfork.exp    | 17 +++++++++++------
>>>>  gdb/testsuite/gdb.base/vforked-prog.c    |  7 ++++++-
>>>>  4 files changed, 37 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c
>>>> index 6c263cdc057..15e272afe82 100644
>>>> --- a/gdb/testsuite/gdb.base/foll-vfork-exit.c
>>>> +++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c
>>>> @@ -29,12 +29,22 @@ main ()
>>>>    pid = vfork (); /* VFORK */
>>>>    if (pid == 0)
>>>>      {
>>>> -      printf ("I'm the child!\n");
>>>> +      const char *s = "I'm the child!";
>>>> +#if DEBUG
>>>> +      printf ("%s\n", s);
>>>> +#else
>>>> +    const char *volatile v = s;
>>>> +#endif
>>>
>>> In my original comment, I meant that we could have simply deleted the
>>> printfs, instead of deleting the regexp $ anchor, as done in
>>> 1f28b70def1.  I don't think these printfs provide any value to debug the
>>> test case at all.
>>>
>>> Since 1f28b70def1 is already merged, the printfs can just stay as-is
>>> (since the regexp accepts them).  Or we can remove them and put back the
>>> anchor.  I slightly prefer the latter, because it makes the test case
>>> check slightly more restrictive (if there is some spurious output after
>>> the prompt, the test will fail).  But it won't make a big difference in
>>> the grand scheme of things.
>>
>> So, is this what you meant?
> 
> Yeah, pretty much.  Could the -re entries use -wrap?
> 

Sure.

> You still assign the strings to volatile variables to make the
> gdb_get_line_number calls work, I suppose?
> 

Indeed.

I'll commit this variant, updated to use -wrap.

Thanks,
- Tom

      reply	other threads:[~2021-11-16 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 11:21 Tom de Vries
2021-11-15 11:21 ` [PATCH 2/2] [gdb] Don't use gdb_stdlog for inferior-events Tom de Vries
2021-11-15 16:42   ` Simon Marchi
2021-11-15 16:39 ` [PATCH 1/2] [gdb/testsuite] Disable inferior output in gdb.base/foll-vfork.exp Simon Marchi
2021-11-15 22:11   ` Tom de Vries
2021-11-16 15:01     ` Simon Marchi
2021-11-16 15:46       ` Tom de Vries [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=414372b0-565f-8150-4f8f-602afd7cbfc9@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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).