This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix testsuite hangs when gdb_test_multiple body errors out (Re: GDB 8.2.90 available for testing)


Pedro Alves <palves@redhat.com> writes:

> On 03/22/2019 08:44 PM, Pedro Franco de Carvalho wrote:
>> Pedro Alves <palves@redhat.com> writes:
>> 
>> Hello,
>> 
>>> I spent a while trying to fix this, and I came up with the patch below.
>>>
>>> WDYT?
>> 
>> Makes sense to me.
>> 
>>> So this commit solves this by appending an "eof" with an empty
>>> spawn_id list, so that it won't ever match.
>> 
>> This is a clever solution, but just to be sure, can we actually rely on
>> this behavior when the list is empty?  This did work when I tested it,
>> but could some Expect version conceivably do something else like
>> returning an error when parsing a body with a "-i" that uses an empty
>> list?
>
> I'd think not, but I can't predict the future so I can't be sure,
> of course.
>
> I looked at expect's source code a little and (in my untrained eyes)
> it didn't seem like there would be a reason for it not to work,
> since -i's argument is just read as a list.  I think a reasonable use
> case would be to allow an empty variable as spawn id, so that
> some patterns would be disabled depending on the variable being
> empty or not (e.g., "-i $my_spawn_id_if_any").
>
> When I thought of this trick, I was going to use an indirect
> spawn id:
>
>  The -i flag may also name a global variable in which case the variable
>  is read for a list of spawn ids. The variable is reread whenever it changes.
>  This provides a way of changing the I/O source while the command is in
>  execution. Spawn ids provided this way are called "indirect" spawn ids. 
>
> and having that global variable be an empty list.  That came to mind
> since I had experience with using indirect spawn ids in another case
> when I needed an empty spawn id list:
>
>     # Use an indirect spawn id list, and remove the inferior spawn id
>     # from the expected output as soon as it matches, in case
>     # $inferior_pattern happens to be a prefix of the resulting full
>     # gdb pattern below (e.g., "\r\n").
>     global gdb_test_stdio_spawn_id_list
>     set gdb_test_stdio_spawn_id_list "$inferior_spawn_id"
>
> And then I realized the to-the-point '-i ""' would work just as well.
>
> I think that if this stops working, likely either empty variable or
> indirect spawn id pointing at an empty list would still keep working,
> so we would likely be able to switch to one of those.

Ok! Makes sense to me, thanks for the explanation.

> Maybe meanwhile, we could ask on the dejagnu list what's the purpose
> of this picking one of eof/timeout/default as an error block, see if
> that could be removed.  I'd guess that dejagnu would change faster
> than expect here, or maybe I should say, less slowly.  :-)

I can do that if you want, and let them know about the comment tokens
affecting the error block selection too.

>
> Thanks,
> Pedro Alves

Thanks for fixing this!

--
Pedro Franco de Carvalho


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]