From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Simon Marchi <simon.marchi@polymtl.ca>,
Andrew Burgess <andrew.burgess@embecosm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix the crash at the end of the runtest
Date: Thu, 22 Jul 2021 17:16:27 +0200 [thread overview]
Message-ID: <AM8PR10MB47084C6959E62D5B5D97D367E4E49@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <c1a9968c-9583-1212-3dea-5affc0db5bb3@polymtl.ca>
On 7/22/21 5:14 PM, Simon Marchi wrote:
> On 2021-07-22 9:20 a.m., Andrew Burgess wrote:
>> Here's my proposed fix, along with an explanation of what's going on.
>>
>> Thanks,
>> Andrew
>>
>> ---
>>
>> commit c6d3cd6e265dd39a27d13428eba48df8c1d50c95
>> Author: Andrew Burgess <andrew.burgess@embecosm.com>
>> Date: Thu Jul 22 14:07:15 2021 +0100
>>
>> gdb/testsuite: don't error when trying to unset last_spawn_tty_name
>>
>> In spawn_capture_tty_name (lib/gdb.exp) we either set or unset
>> last_spawn_tty_name depending on whether spawn_out exists or not.
>>
>> One situation that might cause spawn_out to not exists is if the spawn
>> function is called with the argument -leaveopen, which is how it is
>> called when processes are created as part of a pipeline, the created
>> process has no tty, instead its output is written to a file
>> descriptor.
>>
>> If a pipe line is created consisting of multiple processes then there
>> will be multiple sequential calls to spawn, all using -leaveopen. The
>> first of these calls is fine, no spawn_out is set, and so in
>> spawn_capture_tty_name we unset last_spawn_tty_name. However, on the
>> second call to spawn there is still no spawn_out and so in
>> spawn_capture_tty_name we again try to unset last_spawn_tty_name, this
>> now throws an error.
>>
>> Fix this issue by using -nocomplain with the call to unset in
>> spawn_capture_tty_name.
>>
>> Before this commit I was seeing gdb.base/gnu-debugdata.exp report 1
>> pass, and 1 unsupported test. After this commit I now see 16 passes
>> from this test script.
>>
this looks quite good,
but should we mention the fixed crash here?
Thanks
Bernd.
>> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
>> index e79e0622f9d..8712669bdce 100644
>> --- a/gdb/testsuite/lib/gdb.exp
>> +++ b/gdb/testsuite/lib/gdb.exp
>> @@ -2032,7 +2032,7 @@ proc spawn_capture_tty_name { args } {
>> if { [info exists spawn_out] } {
>> set ::last_spawn_tty_name $spawn_out(slave,name)
>
> Not caused by your patch, but: pedantically, the "if" should perhaps
> verify that "spawn_out(slave,name)" specifically exists, not just
> "spawn_out". Currently (according to "man expect"),
> "spawn_out(slave,name)" is the only possible "spawn_out" contents. But
> let's say that the next Expect version sets "spawn_out(foo)", then that
> code will break (we will enter the "if" and try to read
> "spawn_out(slave,name)", which may not exist).
>
>> } else {
>> - unset ::last_spawn_tty_name
>> + unset -nocomplain ::last_spawn_tty_name
>
> Perhaps a small comment above this line would be nice.
>
> Otherwise, LGTM with or without changes, thanks for looking into it.
>
> Simon
>
next prev parent reply other threads:[~2021-07-22 15:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 11:10 Bernd Edlinger
2021-07-22 12:44 ` Andrew Burgess
2021-07-22 12:59 ` Bernd Edlinger
2021-07-22 13:20 ` Andrew Burgess
2021-07-22 15:14 ` Simon Marchi via Gdb-patches
2021-07-22 15:16 ` Bernd Edlinger [this message]
2021-07-22 16:53 ` [PATCHv2] " Andrew Burgess
2021-07-22 19:24 ` Simon Marchi via Gdb-patches
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=AM8PR10MB47084C6959E62D5B5D97D367E4E49@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM \
--to=bernd.edlinger@hotmail.de \
--cc=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.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