aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-05-06 18:50:03 +0100
committerPedro Alves <palves@redhat.com>2015-05-06 18:50:03 +0100
commit80ad801e90b5bd389ec156d37e28228fcbca128c (patch)
tree757ef44720529e9646a9205fca92d93d07149280 /gdb/gdbserver
parentf218b647aa21168473b973e3459258ba21ba8fbc (diff)
downloadbinutils-80ad801e90b5bd389ec156d37e28228fcbca128c.zip
binutils-80ad801e90b5bd389ec156d37e28228fcbca128c.tar.gz
binutils-80ad801e90b5bd389ec156d37e28228fcbca128c.tar.bz2
PR server/18081: gdbserver crashes when providing an unexisting binary
$ ./gdbserver :1234 blah Process blah created; pid = 16471 Cannot exec blah: No such file or directory. Child exited with status 127 Killing process(es): 16471 ../../../../src/binutils-gdb/gdb/gdbserver/linux-low.c:920: A problem internal to GDBserver has been detected. kill_wait_lwp: Assertion `res > 0' failed. GDBserver shouldn't even be trying to kill that process. GDBserver kills or detaches from all processes on exit, and due to a missing mourn_inferior call, GDBserver tries to kill the process that it had already seen exit. Tested on x86_64 Fedora 20. New test included. I emulated what Windows outputs by hacking an error call in linux_create_inferior. gdb/gdbserver/ChangeLog: 2015-05-06 Pedro Alves <palves@redhat.com> PR server/18081 * server.c (start_inferior): If the process exits, mourn it. gdb/testsuite/ChangeLog: 2015-05-06 Pedro Alves <palves@redhat.com> PR server/18081 * gdb.server/non-existing-program.exp: New file.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/server.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 10d01c1..c5312d0 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-06 Pedro Alves <palves@redhat.com>
+
+ PR server/18081
+ * server.c (start_inferior): If the process exits, mourn it.
+
2015-04-21 Gary Benson <gbenson@redhat.com>
* hostio.c (fileio_open_flags_to_host): Factored out to
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index d2e20d9..62287d4 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -284,6 +284,8 @@ start_inferior (char **argv)
current_thread->last_resume_kind = resume_stop;
current_thread->last_status = last_status;
}
+ else
+ mourn_inferior (find_process_pid (ptid_get_pid (last_ptid)));
return signal_pid;
}