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

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.

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.  */
-- 
1.7.7.6


             reply	other threads:[~2012-08-02 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02 16:13 Tom Tromey [this message]
2012-08-02 17:09 ` Pedro Alves
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=87mx2dqnk8.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --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