This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Multi-target change in gdb/inf-child.c


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]