Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: clear quit_flag in quit, not throw_exception
Date: Thu, 02 Aug 2012 17:09:00 -0000	[thread overview]
Message-ID: <501AB42C.4000701@redhat.com> (raw)
In-Reply-To: <87mx2dqnk8.fsf@fleche.redhat.com>

On 08/02/2012 05:13 PM, Tom Tromey wrote:
> I noticed that throw_exception clears quit_flag and immediate_quit.
> 
> This seems like it could cause gdb to miss C-c sometimes.
> In particular, if a SIGINT arrives and then, before QUIT is called, some
> code in gdb throws an unrelated exception, then the SIGINT will
> effectively be ignored.
> 
> It seems to me that it is just as safe, and more correct, to clear these
> flags in the quit function.

If the unrelated exception/error unwinds things all the way up to the
top prompt, managing to bypass all QUIT calls, then we'll end up with
a dangling quit until the next command it entered (resulting in a spurious,
delayed "Quit"), it seems to me.  If that analysis is correct, maybe we should
also clear or handle these somehow somewhere near the top loop?

> 
> Tom
> 
> 	* exceptions.c (throw_exception): Don't clear quit_flag or
> 	immediate_quit.
> 	* utils.c (quit): Clear quit_flag and immediate_quit.
> ---
>  gdb/exceptions.c |    3 ---
>  gdb/utils.c      |    3 +++
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/exceptions.c b/gdb/exceptions.c
> index 7db9df9..84c21a2 100644
> --- a/gdb/exceptions.c
> +++ b/gdb/exceptions.c
> @@ -221,9 +221,6 @@ exceptions_state_mc_action_iter_1 (void)
>  void
>  throw_exception (struct gdb_exception exception)
>  {
> -  quit_flag = 0;
> -  immediate_quit = 0;
> -
>    do_cleanups (all_cleanups ());
>  
>    /* Jump to the containing catch_errors() call, communicating REASON
> diff --git a/gdb/utils.c b/gdb/utils.c
> index c69c3e0..6ba8c62 100644
> --- a/gdb/utils.c
> +++ b/gdb/utils.c
> @@ -1055,6 +1055,9 @@ print_sys_errmsg (const char *string, int errcode)
>  void
>  quit (void)
>  {
> +  quit_flag = 0;
> +  immediate_quit = 0;
> +
>  #ifdef __MSDOS__
>    /* No steenking SIGINT will ever be coming our way when the
>       program is resumed.  Don't lie.  */
> 


-- 
Pedro Alves


  reply	other threads:[~2012-08-02 17:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02 16:13 Tom Tromey
2012-08-02 17:09 ` Pedro Alves [this message]
2012-08-09 20:20   ` Tom Tromey

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=501AB42C.4000701@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.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