#endif
thread_info *thread_pending_parent (thread_info *thread) override;
- thread_info *thread_pending_child (thread_info *thread) override;
+ thread_info *thread_pending_child (thread_info *thread,
+ target_waitkind *kind) override;
bool supports_catch_syscall () override;
struct lwp_info
{
- /* If this LWP is a fork child that wasn't reported to GDB yet, return
- its parent, else nullptr. */
+ /* If this LWP is a fork/vfork/clone child that wasn't reported to
+ GDB yet, return its parent, else nullptr. */
lwp_info *pending_parent () const
{
if (this->fork_relative == nullptr)
gdb_assert (this->fork_relative->fork_relative == this);
- /* In a fork parent/child relationship, the parent has a status pending and
- the child does not, and a thread can only be in one such relationship
- at most. So we can recognize who is the parent based on which one has
- a pending status. */
+ /* In a parent/child relationship, the parent has a status pending
+ and the child does not, and a thread can only be in one such
+ relationship at most. So we can recognize who is the parent
+ based on which one has a pending status. */
gdb_assert (!!this->status_pending_p
!= !!this->fork_relative->status_pending_p);
const target_waitstatus &ws
= this->fork_relative->waitstatus;
gdb_assert (ws.kind () == TARGET_WAITKIND_FORKED
- || ws.kind () == TARGET_WAITKIND_VFORKED);
+ || ws.kind () == TARGET_WAITKIND_VFORKED
+ || ws.kind () == TARGET_WAITKIND_THREAD_CLONED);
return this->fork_relative;
}
- /* If this LWP is the parent of a fork child we haven't reported to GDB yet,
- return that child, else nullptr. */
- lwp_info *pending_child () const
+ /* If this LWP is the parent of a fork/vfork/clone child we haven't
+ reported to GDB yet, return that child, else nullptr. */
+ lwp_info *pending_child (target_waitkind *kind) const
{
if (this->fork_relative == nullptr)
return nullptr;
gdb_assert (this->fork_relative->fork_relative == this);
- /* In a fork parent/child relationship, the parent has a status pending and
- the child does not, and a thread can only be in one such relationship
- at most. So we can recognize who is the parent based on which one has
- a pending status. */
+ /* In a parent/child relationship, the parent has a status pending
+ and the child does not, and a thread can only be in one such
+ relationship at most. So we can recognize who is the parent
+ based on which one has a pending status. */
gdb_assert (!!this->status_pending_p
!= !!this->fork_relative->status_pending_p);
const target_waitstatus &ws = this->waitstatus;
gdb_assert (ws.kind () == TARGET_WAITKIND_FORKED
- || ws.kind () == TARGET_WAITKIND_VFORKED);
+ || ws.kind () == TARGET_WAITKIND_VFORKED
+ || ws.kind () == TARGET_WAITKIND_THREAD_CLONED);
+ *kind = ws.kind ();
return this->fork_relative;
}
continue;
/* Only threads that have a pending fork event. */
- thread_info *child = target_thread_pending_child (thread);
- if (child == nullptr)
+ target_waitkind kind;
+ thread_info *child = target_thread_pending_child (thread, &kind);
+ if (child == nullptr || kind == TARGET_WAITKIND_THREAD_CLONED)
continue;
process_info *fork_child_process = get_thread_process (child);
gdb_byte *handle;
bool handle_status = target_thread_handle (ptid, &handle, &handle_len);
- /* If this is a fork or vfork child (has a fork parent), GDB does not yet
- know about this process, and must not know about it until it gets the
- corresponding (v)fork event. Exclude this thread from the list. */
+ /* If this is a (v)fork/clone child (has a (v)fork/clone parent),
+ GDB does not yet know about this thread, and must not know about
+ it until it gets the corresponding (v)fork/clone event. Exclude
+ this thread from the list. */
if (target_thread_pending_parent (thread) != nullptr)
return;
virtual bool thread_handle (ptid_t ptid, gdb_byte **handle,
int *handle_len);
- /* If THREAD is a fork child that was not reported to GDB, return its parent
- else nullptr. */
+ /* If THREAD is a fork/vfork/clone child that was not reported to
+ GDB, return its parent else nullptr. */
virtual thread_info *thread_pending_parent (thread_info *thread);
- /* If THREAD is the parent of a fork child that was not reported to GDB,
- return this child, else nullptr. */
- virtual thread_info *thread_pending_child (thread_info *thread);
+ /* If THREAD is the parent of a fork/vfork/clone child that was not
+ reported to GDB, return this child, else nullptr. */
+ virtual thread_info *thread_pending_child (thread_info *thread,
+ target_waitkind *kind);
/* Returns true if the target can software single step. */
virtual bool supports_software_single_step ();
}
static inline thread_info *
-target_thread_pending_child (thread_info *thread)
+target_thread_pending_child (thread_info *thread, target_waitkind *kind)
{
- return the_target->thread_pending_child (thread);
+ return the_target->thread_pending_child (thread, kind);
}
int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len);