From: Patrick Palka <patrick@parcs.ath.cx>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [RFC] Discard local stdin events while an attached inferior is running
Date: Tue, 02 Jun 2015 15:47:00 -0000 [thread overview]
Message-ID: <CA+C-WL_qZA+iZGCDFxMDViq0EWNyAPMJK+myKq2Dx0E_EqEL8Q@mail.gmail.com> (raw)
In-Reply-To: <83fv6arvrm.fsf@gnu.org>
On Tue, Jun 2, 2015 at 11:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Patrick Palka <patrick@parcs.ath.cx>
>> Cc: Patrick Palka <patrick@parcs.ath.cx>
>> Date: Tue, 2 Jun 2015 09:39:18 -0400
>>
>> This patch attempts to work around an annoying typo that I (and others,
>> I assume) commonly make while debugging an attached (not forked)
>> process. That is, I sometimes type "continue\n\n" instead of
>> "continue\n" when I want to resume the inferior. By doing so, the
>> inferior gets resumed and the extraneous "\n" gets buffered. But once
>> GDB regains control, the extraneous "\n" gets read and so an empty
>> command line is submitted to readline. This is shorthand for running
>> the previous command again. So effectively typing "continue\n\n" will
>> run "continue" twice. Running "continue" twice instead of once can have
>> irreversible consequences to the debugging session and thus is pretty
>> annoying to deal with.
>>
>> To work around this kind of typo, this patch installs a dummy event
>> handler that discards all local stdin events that occur when the
>> attached inferior is (synchronously) running.
>>
>> The obvious side-effect of this patch is that dexterous users can no
>> longer "queue" commands while an attached inferior is running, e.g.
>> type "continue\nprint foo" with the intention of "print foo" being run
>> as soon as GDB regains control. I personally don't make use of this
>> ability very much.
>
> IMO, this incompatible change of behavior should at least have an
> option to get the old behavior back, and that option should possibly
> be off by default.
>
> In any case, there should be a NEWS entry and a patch for the manual
> which describe this unusual feature.
Will do, if there is enough support for this change to go forward.
>
>> Is this typo a common occurrence for anyone else?
>
> Not common, but sometimes. However, I sometimes type ahead future
> commands without waiting for the prompt, for example, when I know I'll
> need a lot of CR presses.
Yeah, unfortunately it is impossible to determine whether a key press
was a typo or not :(
An alternative solution is to provide an option to disable the
repeat-command shorthand altogether. It is slightly unintuitive,
typo-prone, and hardly an improvement over the well-known ^P<Enter>
key combination.
next prev parent reply other threads:[~2015-06-02 15:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 13:39 Patrick Palka
2015-06-02 15:12 ` Eli Zaretskii
2015-06-02 15:47 ` Patrick Palka [this message]
2015-06-02 15:49 ` Andreas Schwab
2015-06-02 16:06 ` Patrick Palka
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=CA+C-WL_qZA+iZGCDFxMDViq0EWNyAPMJK+myKq2Dx0E_EqEL8Q@mail.gmail.com \
--to=patrick@parcs.ath.cx \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/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