Fix PR remote/20398: File-IO write always outputs "Quit"
authorPedro Alves <palves@redhat.com>
Fri, 5 Aug 2016 18:54:11 +0000 (19:54 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 5 Aug 2016 18:54:11 +0000 (19:54 +0100)
Commit bb7c96deb1a1 ("gdb/remote-fileio.c: Eliminate custom SIGINT
signal handler") regressed the File-IO support.

Failed output:

  (gdb) target remote :8888
  Remote debugging using :8888
  0x00008098 in _start ()
  (gdb) c
  Continuing.
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  Quit
  [Inferior 1 (Remote target) exited normally]

Expected output:

  (gdb) target remote :8888
  Remote debugging using :8888
  0x00008098 in _start ()
  (gdb) c
  Continuing.
  i: 0
  i: 1
  i: 2
  i: 3
  i: 4
  i: 5
  i: 6
  i: 7
  i: 8
  i: 9
  [Inferior 1 (Remote target) exited normally]

The problem that the new File-IO quit handler forgets to check the
quit flag before calling throwing a quit.

gdb/ChangeLog:
2016-08-05  Pedro Alves  <palves@redhat.com>

PR remote/20398
* remote-fileio.c (remote_fileio_quit_handler): Check the quit
flag before calling quit.

gdb/ChangeLog
gdb/remote-fileio.c

index 92a664dc9a5503092d691d7e0174c2d844e61fa2..e532a12b4c7841c9515c39ed529fd4cd32497562 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-05  Pedro Alves  <palves@redhat.com>
+
+       PR remote/20398
+       * remote-fileio.c (remote_fileio_quit_handler): Check the quit
+       flag before calling quit.
+
 2016-08-05  Pedro Alves  <palves@redhat.com>
 
        * NEWS: Mention that GDB and GDBserver build with a C++ compiler
index 93121aaa42be769f64f7953ee9b9f6dea4578b7d..e35bd5b66afe2902edaf46de394144f6e9872fef 100644 (file)
@@ -308,7 +308,8 @@ static quit_handler_ftype *remote_fileio_o_quit_handler;
 static void
 remote_fileio_quit_handler (void)
 {
-  quit ();
+  if (check_quit_flag ())
+    quit ();
 }
 
 static void