aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.server
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-03-22 20:39:29 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-03-22 20:39:29 +0000
commit598d363666e7b84f3dd5bf0f4cca83e856d77b1b (patch)
treeb84520ff7a4a595be03345d69e882fc9504afceb /gdb/testsuite/gdb.server
parent82b821e99da6e5360fcb86adf8edf73fd463240c (diff)
downloadgdb-598d363666e7b84f3dd5bf0f4cca83e856d77b1b.zip
gdb-598d363666e7b84f3dd5bf0f4cca83e856d77b1b.tar.gz
gdb-598d363666e7b84f3dd5bf0f4cca83e856d77b1b.tar.bz2
gdb/
* exceptions.h (enum errors): New entry TARGET_CLOSE_ERROR. * remote.c (trace_error): Remove the special handling of '2'. (readchar) <SERIAL_EOF> (readchar) <SERIAL_ERROR> (getpkt_or_notif_sane_1): Use TARGET_CLOSE_ERROR for them. (remote_get_trace_status): Call throw_exception if EX is TARGET_CLOSE_ERROR. * utils.c (perror_with_name): Rename to ... (throw_perror_with_name): ... here. New parameter errcode, describe it in the function comment. (perror_with_name): New function wrapper. * utils.h (enum errors): New stub declaration. (throw_perror_with_name): New declaration. gdb/testsuite/ * gdb.server/server-kill.c: New file. * gdb.server/server-kill.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.server')
-rw-r--r--gdb/testsuite/gdb.server/server-kill.c24
-rw-r--r--gdb/testsuite/gdb.server/server-kill.exp43
2 files changed, 67 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.server/server-kill.c b/gdb/testsuite/gdb.server/server-kill.c
new file mode 100644
index 0000000..1949d64
--- /dev/null
+++ b/gdb/testsuite/gdb.server/server-kill.c
@@ -0,0 +1,24 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2013 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/>. */
+
+int
+main (void)
+{
+ int i = 0;
+
+ return i;
+}
diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp
new file mode 100644
index 0000000..45a2a89
--- /dev/null
+++ b/gdb/testsuite/gdb.server/server-kill.exp
@@ -0,0 +1,43 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 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/>.
+
+load_lib gdbserver-support.exp
+
+standard_testfile
+
+if {[skip_gdbserver_tests]} {
+ return 0
+}
+
+if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+ return -1
+}
+
+# Make sure we're disconnected, in case we're testing with an
+# extended-remote board, therefore already connected.
+gdb_test "disconnect" ".*"
+
+gdbserver_run ""
+
+# Otherwise the breakpoint at 'main' would not cause insert
+# breakpoints during first step.
+delete_breakpoints
+
+set server_pid [exp_pid -i [board_info target fileid]]
+remote_exec target "kill -9 $server_pid"
+
+gdb_test "step" "Remote connection closed"