From: Pedro Alves <palves@redhat.com>
To: Stephen Cross <scross@undo-software.com>, gdb-patches@sourceware.org
Cc: gdb@sourceware.org
Subject: Re: Always run GDB command post-hook after pre-hook has been run
Date: Thu, 03 Dec 2015 11:54:00 -0000 [thread overview]
Message-ID: <56602D7B.2010404@redhat.com> (raw)
In-Reply-To: <CA+gYvwfEjruJeyMWmyUFmKNH=FwwgPJeDfrf1FNtYJ+wWhkvAg@mail.gmail.com>
On 12/02/2015 06:24 PM, Stephen Cross wrote:
> I was wondering if anyone has had a chance to look at this patch?
> (I've also CC'ed the gdb list since I'm looking for input on the
> approach.)
Implementation approach, or on the idea in the first place?
I think it'd help if you told us the motivation. What's the intent
of running the hookpost even on error? What are you trying to use the
hooks for?
>> As you can see the post-hook is now always being called, even if the
>> command fails.
At first blush, it looks reasonable. But as always, the devil's in the
details. I think only defining what happens around the corner cases
can we be sure.
Playing devil's advocate, isn't it reasonable to say that existing
hookpost scripts out there may be assuming that they only run if
the hooked command finished successfully?
Curiously, the existing documentation actually has a related comment:
> @cindex hooks, post-command
> @kindex hookpost
> A hook may also be defined which is run after the command you executed.
> Whenever you run the command @samp{foo}, if the user-defined command
> @samp{hookpost-foo} exists, it is executed (with no arguments) after
> that command. Post-execution hooks may exist simultaneously with
> pre-execution hooks, for the same command.
>
> It is valid for a hook to call the command which it hooks. If this
> occurs, the hook is not re-executed, thereby avoiding infinite recursion.
>
> @c It would be nice if hookpost could be passed a parameter indicating
> @c if the command it hooks executed properly or not. FIXME!
Wonder whether we should have that. Alternatively, guess we could have
a new hookerror hook, that would run on error instead of hookpost.
What happens / should happen if the hookpost itself throws an error? Do
we lose the original hooked-command's error? Is that OK?
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-12-03 11:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-30 18:17 Stephen Cross
2015-12-02 18:24 ` Stephen Cross
2015-12-03 11:54 ` Pedro Alves [this message]
2015-12-03 16:11 ` Stephen Cross
2015-12-09 17:03 ` Pedro Alves
2016-01-13 15:21 ` Stephen Cross
2016-02-24 14:46 ` Stephen Cross
2016-02-24 18:01 ` Eli Zaretskii
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=56602D7B.2010404@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=gdb@sourceware.org \
--cc=scross@undo-software.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