public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: Aaron Merey via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb/debuginfod: Prevent prompt for continue during downloading.
Date: Fri, 10 Feb 2023 21:02:19 -0500	[thread overview]
Message-ID: <CAJDtP-S30d5GV_nkk+hzOxrOU7xyvJJ3Dwzs7Nd=eTCFds+-+w@mail.gmail.com> (raw)
In-Reply-To: <87a61omd35.fsf@tromey.com>

On Wed, Feb 8, 2023 at 9:44 AM Tom Tromey <tom@tromey.com> wrote:
> It occurred to me last night that this could be a subtle change
> introduced by the pager rewrite.
>
> Before, disabling pagination also disabled line splitting, and took an
> earlier exit.
>
> But now, if pagination is disabled for some output, those lines still
> "count" towards the total.  So then when pagination is no longer
> disabled, a print might cause the pager to intervene.
>
> Is this what's happening in your case?  If so, I'm not totally sure it
> is a bug.  Normally disabling paging should be done because using the
> pager isn't safe or appropriate at some point in time.  But having those
> lines still "count" seems alright, maybe even useful.

Yes pagination_enabled=false prevents prompt_for_continue but lines_printed
still increments for each newline printed.

Like you said, this prompt shouldn't show up around debuginfod progress
output since most downloads happen under fetch_inferior_event which
disables pagination until it returns.

The reproducer I previously mentioned

On Mon, Jan 30, 2023 at 9:09 PM Aaron Merey <amerey@redhat.com> wrote:
>   gdb  -ex 'set height 25' -ex 'start' qemu-kvm

triggers the prompt during a download occurring right before 'start'
begins running the inferior and pagination isn't disabled by
fetch_inferior_event.

I don't think this particular case is too much of a problem because
there are only a few downloads that can happen before the rest occur
under fetch_inferior_event.  So the prompt will only show up at the
start if gdb's height is unusually small, in which case you can expect
regular prompts anyways.

However the on-demand downloading work creates new situations where
a large series of downloads might happen outside fetch_inferior_event.
For example, "break client.c:50" could download the .debug_line and
.debug_line_str of each shared library to search for the filename
"client.c". Then it downloads debuginfo for each match, all of which
happens outside of fetch_inferior_event.

Setting pagination_enabled=false in debuginfod_*_query prevents the
prompt durings the downloads but lines_printed keeps increasing.
If lines_allowed is exceeded then after the download you get an (IMO)
annoying prompt:

    (gdb) break client.c:50
    [...]
    Downloading separate debug info for /lib64/libabc.so
    Downloading separate debug info for /lib64/libxyz.so
    --Type <RET> for more, q to quit, c to continue without paging--
    Breakpoint 1 at 0xcf525d: client.c:50. (2 locations)
    (gdb)

Adding a count_lines_printed flag gives us another way to fine-tune
when the prompt shows up.  It keeps prompt behavior around debuginfod
output consistent whether or not the inferior is running.

Aaron


  reply	other threads:[~2023-02-11  2:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28  4:06 Aaron Merey
2023-01-28 15:01 ` Tom Tromey
2023-01-31  2:09   ` Aaron Merey
2023-01-31 14:22     ` Tom Tromey
2023-01-31 20:41       ` Aaron Merey
2023-02-08 14:44         ` Tom Tromey
2023-02-11  2:02           ` Aaron Merey [this message]
2023-02-13 14:17             ` Tom Tromey
2023-02-13 20:23               ` 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='CAJDtP-S30d5GV_nkk+hzOxrOU7xyvJJ3Dwzs7Nd=eTCFds+-+w@mail.gmail.com' \
    --to=amerey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).