Don't call clear_quit_flag in prepare_to_throw_exception
authorPedro Alves <palves@redhat.com>
Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 12 Apr 2016 15:55:35 +0000 (16:55 +0100)
I think this is reminiscent of the time when a longjmp would always
jump to the top level.  Nowaways code that throw exceptions other than
a quit, which may even be caught and handled without reaching the top
level.  Certainly such exceptions shouldn't clear an interrupt
request...

(We also need to get rid of prepare_to_throw_exception in order to be
able to just do "throw ex;" in C++.)

One could argue that we should clear the quit flag when we throw a
quit from the SIGINT handler, when immediate_quit is in effect, to
handle a race, here:

 immediate_quit++;
 QUIT;

... that's the usual pattern code must use when enabling
immediate_quit.  The QUIT is there to catch the case of Ctrl-C having
already been pressed before immediate_quit was enabled.  However, this
can happen:

 immediate_quit++;
<< Ctrl-C pressed here too.
 QUIT;

And in that case, if the quit flag was already set, it'll stay set
even after throwing a quit from the SIGINT handler.  The end result is
a double quit.  But OTOH, the user did press Ctrl-C two times.  Since
I'm getting rid of immediate_quit, I'm not bothering with this.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* exceptions.c (prepare_to_throw_exception): Don't clear the quit
flag.

gdb/ChangeLog
gdb/exceptions.c

index f01183e851ae0c9159724dd58334e04b5b13965e..6b4518c7281217d5467623e9b0ab80c27b5e14cc 100644 (file)
@@ -1,3 +1,8 @@
+2016-04-12  Pedro Alves  <palves@redhat.com>
+
+       * exceptions.c (prepare_to_throw_exception): Don't clear the quit
+       flag.
+
 2016-04-12  Pedro Alves  <palves@redhat.com>
 
        * event-top.c (command_handler): Don't call clear_quit_flag.
index 8ba86fc62fd51c538d2c08179073bed5c5f27d5d..b457838d93a193f0e1b6d71aa2b79e44199055d5 100644 (file)
@@ -30,7 +30,6 @@
 void
 prepare_to_throw_exception (void)
 {
-  clear_quit_flag ();
   immediate_quit = 0;
 }
 
This page took 0.026123 seconds and 4 git commands to generate.