Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Add a timeout parameter to gdb_do_one_event
Date: Fri, 19 Aug 2022 13:29:30 +0200	[thread overview]
Message-ID: <d8ed88f4-35c8-12ca-ab24-46e1eceb2b6f@monnerat.net> (raw)
In-Reply-To: <87tu69ajj0.fsf@redhat.com>


On 8/18/22 13:16, Andrew Burgess wrote:
> Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> @@ -229,17 +236,35 @@ gdb_do_one_event (void)
>>   	return 1;
>>       }
>>   
>> +  if (!mstimeout)
>> +    return 0;	/* Null timeout: do not wait for an event. */
>> +
> This should be:
>
>    if (mstimeout == 0)
>
> As mstimeout is an int, not a bool.

This patch has been pushed now (bac814a), but I will change that.

> More just a warning really, but this isn't going to work in all cases.
> If a target doesn't support async-mode then GDB will block waiting for
> events in the check_async_event_handlers call above, and never gets down
> this far.

Thanks for your remark.

 From what I can see in check_async_event_handlers, there is no direct 
waiting. The only delay/suspension can only come from an invoked handler 
while serving an event that is already active.

The timeout introduced here targets event waiting only and not things 
that may be consuming time in event handlers themselves.

Even with a timer controlled by the gdb_do_one_event caller, the current 
code can suspend a longer time.

But maybe I missed something?

>
> I'm interested in this because I also want to have the event loop run
> under a timeout for a patch I'm working on, and everything works fine
> except for the case when I run with async support disabled.
> I'm currently investigating having non-async targets ask the event loop
> for a maximum wait time before they block, then return to the event loop
> in order to check timers.
Obviously your needs are not exactly the same as mine: from what I can 
understand you want to "limit" the handler running time.
>
> If I can get this working, I'll want to move your create_timer call to
> the start of gdb_do_one_event, so that the timer is in place before the
> call to check_async_event_handlers - though I'm not quite sure how this
> would be expected to interact with the case where 'mstimeout == 0'.
Please don't! this proposal can be implemented with an "external" (i.e.: 
under caller's control) timer and I rejected this solution because using 
mstimeout=0 would cause legitimate pending event misses, the timer 
becoming an event source by itself! In other words, it should not exist 
when calling poll_timers.


Thanks for your comments,

Patrick


  reply	other threads:[~2022-08-19 11:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 13:08 Patrick Monnerat via Gdb-patches
2022-04-15 16:21 ` Tom Tromey
2022-04-16  0:38   ` Patrick Monnerat via Gdb-patches
2022-07-22 13:41 ` Simon Marchi via Gdb-patches
2022-07-22 22:45   ` Patrick Monnerat via Gdb-patches
2022-07-25  1:07     ` Simon Marchi via Gdb-patches
2022-08-18 11:16 ` Andrew Burgess via Gdb-patches
2022-08-19 11:29   ` Patrick Monnerat via Gdb-patches [this message]
2022-08-23 18:38     ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2022-03-14 14:49 Patrick Monnerat via Gdb-patches
2022-03-14 16:17 ` Pedro Alves
2021-08-26 18:30 Patrick Monnerat via Gdb-patches
2021-08-23 18:23 Patrick Monnerat via Gdb-patches
2021-08-26  3:24 ` Simon Marchi via Gdb-patches
2021-08-26 11:36   ` Patrick Monnerat via Gdb-patches
2021-08-26 13:47     ` Simon Marchi via Gdb-patches
2021-08-26 15:14       ` Patrick Monnerat via Gdb-patches
2021-08-27 18:08     ` Tom Tromey
2021-08-28  0:07       ` Patrick Monnerat 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=d8ed88f4-35c8-12ca-ab24-46e1eceb2b6f@monnerat.net \
    --to=gdb-patches@sourceware.org \
    --cc=aburgess@redhat.com \
    --cc=patrick@monnerat.net \
    /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