Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Multithreaded debugging: strange thread switches
@ 2006-01-23 15:46 Vladimir Prus
  2006-01-23 16:02 ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Prus @ 2006-01-23 15:46 UTC (permalink / raw)
  To: gdb


Hello,
I'm observing strange behaviour when debugging with gdb using a custom stub.
I have two threads. After connecting, I say "next" several times and that 
steps in thread 1. Then I say "thread 2" and "next". Gdb then stops again in 
thread 1, not in thread 2 as I'd expected.

In the remote protocol I see "Hc1" packet after last "next" though I'd expect 
"Hc2", and in infrun.c, function prepare_to_proceed, I see this:


 if (!ptid_equal (wait_ptid, minus_one_ptid)
      && !ptid_equal (inferior_ptid, wait_ptid))
    {
      /* Switched over from WAIT_PID.  */
      CORE_ADDR wait_pc = read_pc_pid (wait_ptid);

      if (wait_pc != read_pc ())
	{
	  /* Switch back to WAIT_PID thread.  */
	  inferior_ptid = wait_ptid;

	  /* FIXME: This stuff came from switch_to_thread() in
	     thread.c (which should probably be a public function).  */
	  flush_cached_frames ();
	  registers_changed ();
	  stop_pc = wait_pc;
	  select_frame (get_current_frame ());
	}

Can somebody explain the reason for this explicit switch back to "wait_ptid"?

Thanks,
Volodya


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

end of thread, other threads:[~2006-01-25  0:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-23 15:46 Multithreaded debugging: strange thread switches Vladimir Prus
2006-01-23 16:02 ` Daniel Jacobowitz
2006-01-24 14:28   ` Vladimir Prus
2006-01-24 14:41     ` Daniel Jacobowitz
2006-01-24 14:44       ` Vladimir Prus
2006-01-24 16:16         ` Daniel Jacobowitz
2006-01-24 21:21         ` Eli Zaretskii
2006-01-25  0:04   ` vCont [was Re: Multithreaded debugging: strange thread switches] Nathan J. Williams
2006-01-25 11:20     ` Daniel Jacobowitz

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