[PATCH v7 3/5] gdb/remote: do not delete a thread if it has a pending exit event

Tankut Baris Aktemur tankut.baris.aktemur@intel.com
Wed Apr 22 15:00:55 GMT 2020


gdb/ChangeLog:
2020-04-06  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* remote.c (remote_target::update_thread_list): Do not delete
	a thread if it has a pending exit event.
---
 gdb/remote.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/remote.c b/gdb/remote.c
index 5db406e045c..a1fbaa02fb1 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3822,6 +3822,14 @@ remote_target::update_thread_list ()
 	  if (tp->inf->process_target () != this)
 	    continue;
 
+	  /* Do not remove the thread if it has a pending exit event.
+	     Otherwise we may end up with a seemingly live inferior
+	     (i.e.  pid != 0) that has no threads.  */
+	  if (tp->suspend.waitstatus_pending_p
+	      && (tp->suspend.waitstatus.kind == TARGET_WAITKIND_SIGNALLED
+		  || tp->suspend.waitstatus.kind == TARGET_WAITKIND_EXITED))
+	    continue;
+
 	  if (!context.contains_thread (tp->ptid))
 	    {
 	      /* Not found.  */
-- 
2.17.1



More information about the Gdb-patches mailing list