GNU Binutils with patches for OS216
Revisão | 586b02a96f744497c8921a558f1c386287849ab0 (tree) |
---|---|
Hora | 2015-07-14 18:10:50 |
Autor | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
gdbserver/Linux: internal error when killing a process that is already gone
If the process disappears (e.g., killed with "kill -9" from the shell)
while it was stopped under GDBserver's control, and the GDBserver
tries to kill it, GDBserver asserts:
gdb/gdbserver/ChangeLog:
2015-07-14 Pedro Alves <palves@redhat.com>
* linux-low.c (kill_wait_lwp): Don't assert if waitpid fails.
Instead, ignore ECHILD, and throw an error for other errnos.
@@ -1,3 +1,8 @@ | ||
1 | +2015-07-14 Pedro Alves <palves@redhat.com> | |
2 | + | |
3 | + * linux-low.c (kill_wait_lwp): Don't assert if waitpid fails. | |
4 | + Instead, ignore ECHILD, and throw an error for other errnos. | |
5 | + | |
1 | 6 | 2015-07-10 Pedro Alves <palves@redhat.com> |
2 | 7 | |
3 | 8 | * event-loop.c (struct callback_event) <data>: Change type to |
@@ -1103,7 +1103,10 @@ kill_wait_lwp (struct lwp_info *lwp) | ||
1103 | 1103 | res = my_waitpid (lwpid, &wstat, __WCLONE); |
1104 | 1104 | } while (res > 0 && WIFSTOPPED (wstat)); |
1105 | 1105 | |
1106 | - gdb_assert (res > 0); | |
1106 | + /* Even if it was stopped, the child may have already disappeared. | |
1107 | + E.g., if it was killed by SIGKILL. */ | |
1108 | + if (res < 0 && errno != ECHILD) | |
1109 | + perror_with_name ("kill_wait_lwp"); | |
1107 | 1110 | } |
1108 | 1111 | |
1109 | 1112 | /* Callback for `find_inferior'. Kills an lwp of a given process, |