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]

Correct tagging stopped threads as stopped in multi-process


In multi-process + all-stop, when a process exits,
all threads of other processes are stopped.

In multi-process + non-stop, when a process exits,
don't marks all threads of other processes stopped.

Tested on x86-64-unknown-linux-gnu, and checked in.

-- 
Pedro Alves
2008-12-12  Pedro Alves  <pedro@codesourcery.com>

	* infrun.c (handle_inferior_event): Correctly tag non-executing
	threads in multi-process.
	(normal_stop): Correctly tag stopped threads in multi-process.

---
 gdb/infrun.c |   44 ++++++++++++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 16 deletions(-)

Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c	2008-12-07 19:39:05.000000000 +0000
+++ src/gdb/infrun.c	2008-12-07 20:25:10.000000000 +0000
@@ -2141,13 +2141,17 @@ handle_inferior_event (struct execution_
     {
       breakpoint_retire_moribund ();
 
-      /* Mark the non-executing threads accordingly.  */
-      if (!non_stop
- 	  || ecs->ws.kind == TARGET_WAITKIND_EXITED
- 	  || ecs->ws.kind == TARGET_WAITKIND_SIGNALLED)
- 	set_executing (pid_to_ptid (-1), 0);
-      else
- 	set_executing (ecs->ptid, 0);
+      /* Mark the non-executing threads accordingly.  In all-stop, all
+	 threads of all processes are stopped when we get any event
+	 reported.  In non-stop mode, only the event thread stops.  If
+	 we're handling a process exit in non-stop mode, there's
+	 nothing to do, as threads of the dead process are gone, and
+	 threads of any other process were left running.  */
+      if (!non_stop)
+	set_executing (minus_one_ptid, 0);
+      else if (ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+	       && ecs->ws.kind != TARGET_WAITKIND_EXITED)
+	set_executing (inferior_ptid, 0);
     }
 
   switch (infwait_state)
@@ -4372,17 +4376,25 @@ done:
       else
 	observer_notify_normal_stop (NULL);
     }
-  if (target_has_execution
-      && last.kind != TARGET_WAITKIND_SIGNALLED
-      && last.kind != TARGET_WAITKIND_EXITED)
-    {
-      /* Delete the breakpoint we stopped at, if it wants to be deleted.
-	 Delete any breakpoint that is to be deleted at the next stop.  */
-      breakpoint_auto_delete (inferior_thread ()->stop_bpstat);
 
+  if (target_has_execution)
+    {
+      if (last.kind != TARGET_WAITKIND_SIGNALLED
+	  && last.kind != TARGET_WAITKIND_EXITED)
+	/* Delete the breakpoint we stopped at, if it wants to be deleted.
+	   Delete any breakpoint that is to be deleted at the next stop.  */
+	breakpoint_auto_delete (inferior_thread ()->stop_bpstat);
+
+      /* Mark the stopped threads accordingly.  In all-stop, all
+	 threads of all processes are stopped when we get any event
+	 reported.  In non-stop mode, only the event thread stops.  If
+	 we're handling a process exit in non-stop mode, there's
+	 nothing to do, as threads of the dead process are gone, and
+	 threads of any other process were left running.  */
       if (!non_stop)
-	set_running (pid_to_ptid (-1), 0);
-      else
+	set_running (minus_one_ptid, 0);
+      else if (last.kind != TARGET_WAITKIND_SIGNALLED
+	       && last.kind != TARGET_WAITKIND_EXITED)
 	set_running (inferior_ptid, 0);
     }
 

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