public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Aaron Merey <amerey@redhat.com>, Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/debuginfod] Ask to cancel further downloads
Date: Fri, 30 Sep 2022 17:15:04 +0100	[thread overview]
Message-ID: <697074fa-9813-70b9-6bd7-f1796428f1e7@palves.net> (raw)
In-Reply-To: <CAJDtP-Rwa2LUXYfUO0-4rSGZDGgK9GGcpdVZNbzgNhG43i=Tyw@mail.gmail.com>

On 2022-09-29 8:29 p.m., Aaron Merey via Gdb-patches wrote:
> On Thu, Sep 29, 2022 at 4:34 AM Tom de Vries <tdevries@suse.de> wrote:
>> Add a new command "set debuginfod cancel one/all/ask", where:
>> - "one" means ^C cancels one download,
>> - "all" means ^C cancels all further downloads, and
>> - "ask" means ^C asks whether to cancel all further downloads.  A "yes" implies
>>   "set debuginfod cancel all", and a "no" implies "set debuginfod cancel one", so
>>   the question is only asked once.
>>
>> Note that the behaviour as it was before this patch is equivalent to
>> "set debuginfod cancel one".
>>
>> Instead, the new default is "set debuginfod cancel ask".
>>
>> Note that cancelling all further downloads implies "set debuginfod enabled off".
> 
> LGTM. It's a usability improvement and it worked as intended during testing.

Cool.  I think the thing missing (not in this patch, but in gdb) is handling
^C pressed while the inferior is running and GDB decides to download from debuginfod.

I mean, something like:

(gdb) c
...
# inferior is running, dlopens a library, and gdb downloads debug info from debuginfod

# just while gdb starts downloading one of the libraries, the user presses ^C, intending
# to pause the inferior.

I think gdb always switches to terminal-ours before downloading with debuginfod, and
assumes the ^C indicates the user wanted to cancel the download?

I think in this scenario, we should do something similar to target remote's "pressed twice"
handling.

- user presses once ctrl-c while download is happening _and_ inferior has terminal
    => Do nothing, set quit flag again, so ctrl-c isn't lost.  Set a global flag indicating
       ctrl-c was already pressed once.  The idea is that maybe the download finishes quickly,
       and then gdb soon elsewhere notices the quit_flag and stops the inferior.
       Everything Just Works.

- user is impacient and presses ctrl-c a second time while download is happening _and_
  inferior has terminal
    => gdb asks user what to do: 

       - interrupt program?
       - cancel download?

Pedro Alves

  reply	other threads:[~2022-09-30 16:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  8:25 Tom de Vries
2022-09-29 19:29 ` Aaron Merey
2022-09-30 16:15   ` Pedro Alves [this message]
2022-10-05  1:44     ` Aaron Merey

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=697074fa-9813-70b9-6bd7-f1796428f1e7@palves.net \
    --to=pedro@palves.net \
    --cc=amerey@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).