gdbserver: hide fork child threads from GDB
[deliverable/binutils-gdb.git] / gdbserver / server.cc
index 32dcc05924e147b652f33ee1a1b4b5cc9952aa14..0f9fa9ddbb5a7351772f3122207cf1017194b3e8 100644 (file)
@@ -1657,6 +1657,12 @@ handle_qxfer_threads_worker (thread_info *thread, struct buffer *buffer)
   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 (thread->fork_parent != nullptr)
+    return;
+
   write_ptid (ptid_s, ptid);
 
   buffer_xml_printf (buffer, "<thread id=\"%s\"", ptid_s);
This page took 0.023003 seconds and 4 git commands to generate.