Multi-target change in gdb/inf-child.c
Aktemur, Tankut Baris
tankut.baris.aktemur@intel.com
Tue Feb 4 19:35:00 GMT 2020
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
More information about the Gdb-patches
mailing list