aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/darwin-nat.c18
2 files changed, 24 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e0ea622..661ad16 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-02 Xavier Roirand <roirand@adacore.com>
+
+ PR gdb/22629:
+ * darwin-nat.c (darwin_kill_inferior): Fix handling of
+ kill inferior.
+
2018-08-02 Tom Tromey <tom@tromey.com>
* darwin-nat.c (find_inferior_task_it, darwin_find_thread)
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 6d7b80d..be80163 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1549,6 +1549,24 @@ darwin_nat_target::kill ()
if (res == 0)
{
+ /* On MacOS version Sierra, the darwin_restore_exception_ports call
+ does not work as expected.
+ When the kill function is called, the SIGKILL signal is received
+ by gdb whereas it should have been received by the kernel since
+ the exception ports have been restored.
+ This behavior is not the expected one thus gdb does not reply to
+ the received SIGKILL message. This situation leads to a "busy"
+ resource from the kernel point of view and the inferior is never
+ released, causing it to remain as a zombie process, even after
+ GDB exits.
+ To work around this, we mark all the threads of the inferior as
+ signaled thus darwin_decode_message function knows that the kill
+ signal was sent by gdb and will take the appropriate action
+ (cancel signal and reply to the signal message). */
+ darwin_inferior *priv = get_darwin_inferior (inf);
+ for (darwin_thread_t *thread : priv->threads)
+ thread->signaled = 1;
+
darwin_resume_inferior (inf);
ptid = darwin_wait (inferior_ptid, &wstatus);