summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/quit-live.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-10-17 14:58:54 +0100
committerPedro Alves <palves@redhat.com>2017-10-17 14:58:54 +0100
commit8484c9554519c25c73a349d0581cc269f102c5d2 (patch)
tree35ae4780ec8c4f27a67ea46cf73026102a017275 /gdb/testsuite/gdb.base/quit-live.c
parent30f0b1015897466fb88ed26c56a0b4f42808edbc (diff)
Add several "quit with live inferior" tests
In my multi-target branch, I had managed to break GDB exiting successfuly in response to "quit" or SIGHUP/SIGTERM when: - you're debugging with "target extended-remote", - have more than one inferior loaded in gdb, some running, and at least one not running, and, - quit gdb with the inferior that is not running yet selected. The testsuite still passed cleanly anyway. I only noticed because I was left with a bunch of core dumps in the gdb/testsuite/ directory -- the testsuite infrastructure closes GDB's pty after running each testcase, which results in GDB getting a SIGHUP and should make GDB exit gracefully. If GDB crashes at that point though, there's no indication about it in gdb.sum/gdb.log. This commit adds a multitude of tests exercising quitting GDB with live inferiors, some of which would have caught the problem. gdb/testsuite/ChangeLog: 2017-10-17 Pedro Alves <palves@redhat.com> * gdb.base/quit-live.c: New file. * gdb.base/quit-live.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.base/quit-live.c')
-rw-r--r--gdb/testsuite/gdb.base/quit-live.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/quit-live.c b/gdb/testsuite/gdb.base/quit-live.c
new file mode 100644
index 0000000000..d29fd25bd0
--- /dev/null
+++ b/gdb/testsuite/gdb.base/quit-live.c
@@ -0,0 +1,27 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2017 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+int
+main ()
+{
+ int secs = 30;
+
+ while (secs--)
+ sleep (1);
+}