This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Multi-target change in gdb/inf-child.c
- From: "Aktemur, Tankut Baris" <tankut dot baris dot aktemur at intel dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 4 Feb 2020 19:35:08 +0000
- Subject: Multi-target change in gdb/inf-child.c
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UAFBjYxYWK4ky9cLWu8oKRkqgIM0VrAx4+qbFkzD2hY=; b=Kn8I+D/+IDrd2Y++Al8xXmUDJd4FgDPveUKlR8qhrYs5CvDDs6EUmtOaT1AZo+lINTAkerBpJ3Nr3nn3aDxmWgWAZWYXhOTODIDYRaWCVAhF5CiRVnjaEwwvAKY4aPmhNVFlL7Y3oiOrqfMJ3VSKQCk2QnH4jBNpvkUm9Ibv91X429x4F9JaGNgIjs/rgVGnVxAK81vRingXqsaKnUJERnGZF5/4fyUDGXR9bJeN74HWudRW2NNdblDZLn7ZIg8J0K1SGAmA4/PjTgnZ9N+SGKn4G4tnkTKbMukU0R8Bjzw+0fVNB82xoNB/DeT1s87vCYG2u1H3whGKfslYwl/4/A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bZDVv41OtIXGRzAW+aSKkU6Mc3WZTd3vkBdanp1xoJXXIfTRbJcFl3oa6tL+BXpx4JOdec9MieBEXIDWIkYPQp1ZVzRW+vTl7DUqJPsk1H9eZILPwSLmPrxapCQKva0/Xox0pKls1jmhT/IbvGZ/EgZgVmqkil+WdnbzhQSfYotRT97UO/9HiMAesc0k/roO+SbvVjMk+SKCC852AS+cLY5KuDj5qeh+k+O5MPDSEGsPUmzQ6yXydqGzj+ufUP6TDH5ZP1j/8DMl658JOY2QrUPAlOIyg327/uWQwJdXy1UHZpJIkUPWyaw2IgoZA0X909jomefaPPmN7Tmtrp+kvw==
Hi Pedro,
The multi-target patch made the following change to gdb/inf-child.c:
void
inf_child_target::maybe_unpush_target ()
{
- if (!inf_child_explicitly_opened && !have_inferiors ())
+ if (!inf_child_explicitly_opened)
unpush_target (this);
}
What was the motivation behind this?
The thing is, if we're in all-stop mode with multiple inferiors, and an exit
event is received from an inferior, target_mourn_inferior() gets to this point
and without the have_inferiors() check, the target is unpushed. This leads
to having exec_ops as the top target.
Here is a test scenario. Two executables, ./a.out returns immediately; ./sleepy
just sleeps.
$ gdb ./sleepy
(gdb) start
...
(gdb) add-inferior -exec ./a.out
...
(gdb) inferior 2
[Switching to inferior 2..
(gdb) start
...
(gdb) set schedule-multiple on
(gdb) set debug infrun 1
(gdb) continue
At this point, the exit event is received from ./a.out. Normally, this would lead
to stop_all_threads to also stop ./sleepy, but this doesn't happen, because
target_is_non_stop_p() returns false. And it returns false because the top target
is no longer the process target; it is the exec_ops.
Thanks
-Baris
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928