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]

[PATCH] infun debug: Use correct target pid


The infrun debug reads the id for the exited thread from the ws value.
However, this is always 0, causing an assert in find_inferior_pid.

Instead, the id should be read from the wait return value.

This fixes a racy FAIL in gdb.threads/watchthreads-reorder.exp

gdb/ChangeLog:

2019-03-25  Alan Hayward  <alan.hayward@arm.com>

	* infrun.c (stop_all_threads): Fix debug print.
---
 gdb/infrun.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index ad7892105a..5350ab73a1 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4364,14 +4364,10 @@ stop_all_threads (void)
 		   || ws.kind == TARGET_WAITKIND_SIGNALLED)
 	    {
 	      if (debug_infrun)
-		{
-		  ptid_t ptid = ptid_t (ws.value.integer);
-
-		  fprintf_unfiltered (gdb_stdlog,
-				      "infrun: %s exited while "
-				      "stopping threads\n",
-				      target_pid_to_str (ptid).c_str ());
-		}
+		fprintf_unfiltered (gdb_stdlog,
+				    "infrun: %s exited while "
+				    "stopping threads\n",
+				    target_pid_to_str (event_ptid).c_str ());
 	    }
 	  else
 	    {
-- 
2.17.2 (Apple Git-113)


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