Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] infun debug: Use correct target pid
@ 2019-03-25 16:18 Alan Hayward
  2019-03-25 16:22 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Hayward @ 2019-03-25 16:18 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd, Alan Hayward

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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] infun debug: Use correct target pid
  2019-03-25 16:18 [PATCH] infun debug: Use correct target pid Alan Hayward
@ 2019-03-25 16:22 ` Tom Tromey
  2019-03-25 16:58   ` Alan Hayward
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2019-03-25 16:22 UTC (permalink / raw)
  To: Alan Hayward; +Cc: gdb-patches, nd

>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:

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

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

FWIW this is already being discussed in another thread:

https://sourceware.org/ml/gdb-patches/2019-03/msg00516.html

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] infun debug: Use correct target pid
  2019-03-25 16:22 ` Tom Tromey
@ 2019-03-25 16:58   ` Alan Hayward
  2019-03-30 10:05     ` Philippe Waroquiers
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Hayward @ 2019-03-25 16:58 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, nd



> On 25 Mar 2019, at 16:21, Tom Tromey <tom@tromey.com> wrote:
> 
>>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
> 
> Alan> The infrun debug reads the id for the exited thread from the ws value.
> Alan> However, this is always 0, causing an assert in find_inferior_pid.
> 
> Alan> Instead, the id should be read from the wait return value.
> 
> FWIW this is already being discussed in another thread:
> 
> https://sourceware.org/ml/gdb-patches/2019-03/msg00516.html
> 
> Tom

!!!  Yes, I totally missed that! Complete coincidence too.
I’ll drop my patch.


Alan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] infun debug: Use correct target pid
  2019-03-25 16:58   ` Alan Hayward
@ 2019-03-30 10:05     ` Philippe Waroquiers
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Waroquiers @ 2019-03-30 10:05 UTC (permalink / raw)
  To: Alan Hayward, Tom Tromey; +Cc: gdb-patches, nd

On Mon, 2019-03-25 at 16:58 +0000, Alan Hayward wrote:
> > On 25 Mar 2019, at 16:21, Tom Tromey <tom@tromey.com> wrote:
> > 
> > > > > > > "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
> > 
> > Alan> The infrun debug reads the id for the exited thread from the ws value.
> > Alan> However, this is always 0, causing an assert in find_inferior_pid.
> > 
> > Alan> Instead, the id should be read from the wait return value.
> > 
> > FWIW this is already being discussed in another thread:
> > 
> > https://sourceware.org/ml/gdb-patches/2019-03/msg00516.html
> > 
> > Tom
> 
> !!!  Yes, I totally missed that! Complete coincidence too.
> I’ll drop my patch.
I have just sent an RFAv2 
  https://sourceware.org/ml/gdb-patches/2019-03/msg00758.html
that fixes the above and improves some other related tracing.

Philippe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-30 10:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 16:18 [PATCH] infun debug: Use correct target pid Alan Hayward
2019-03-25 16:22 ` Tom Tromey
2019-03-25 16:58   ` Alan Hayward
2019-03-30 10:05     ` Philippe Waroquiers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox