Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* linux native, switch forks, always have a thread
@ 2008-04-30 16:42 Pedro Alves
  2008-04-30 21:26 ` Michael Snyder
  2008-05-01 20:36 ` Daniel Jacobowitz
  0 siblings, 2 replies; 4+ messages in thread
From: Pedro Alves @ 2008-04-30 16:42 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

I'd missed this case when I made linux native always have a thread.

It's not perfect in the sense that switching forks ("restart"/"fork",
not follow-fork-mode) in multi-threaded apps doesn't handle
multi-threading correctly yet, but that is an already existing
problem.  We shall be getting back to that in a few weeks
for multi-process support.

-- 
Pedro Alves

[-- Attachment #2: fork_have_a_thread.diff --]
[-- Type: text/x-diff, Size: 666 bytes --]

2008-04-30  Pedro Alves  <pedro@codesourcery.com>

	* linux-nat.c (linux_nat_switch_fork): Reinit GDB's thread list
	and register the fork's PTID as a thread.

---
 gdb/linux-nat.c |    2 ++
 1 file changed, 2 insertions(+)

Index: src/gdb/linux-nat.c
===================================================================
--- src.orig/gdb/linux-nat.c	2008-04-28 11:54:27.000000000 +0100
+++ src/gdb/linux-nat.c	2008-04-28 11:53:38.000000000 +0100
@@ -948,8 +948,10 @@ linux_nat_switch_fork (ptid_t new_ptid)
 {
   struct lwp_info *lp;
 
+  init_thread_list ();
   init_lwp_list ();
   lp = add_lwp (new_ptid);
+  add_thread_silent (new_ptid);
   lp->stopped = 1;
 }
 

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

* Re: linux native, switch forks, always have a thread
  2008-04-30 16:42 linux native, switch forks, always have a thread Pedro Alves
@ 2008-04-30 21:26 ` Michael Snyder
  2008-05-01 20:36 ` Daniel Jacobowitz
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2008-04-30 21:26 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Wed, 2008-04-30 at 15:36 +0100, Pedro Alves wrote:
> I'd missed this case when I made linux native always have a thread.
> 
> It's not perfect in the sense that switching forks ("restart"/"fork",
> not follow-fork-mode) in multi-threaded apps doesn't handle
> multi-threading correctly yet, but that is an already existing
> problem.  We shall be getting back to that in a few weeks
> for multi-process support.

I think you'll find that fork is more-or-less undefined
in the context of a multi-threaded program, meaning that
it's not terribly urgent that we try to handle this case.




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

* Re: linux native, switch forks, always have a thread
  2008-04-30 16:42 linux native, switch forks, always have a thread Pedro Alves
  2008-04-30 21:26 ` Michael Snyder
@ 2008-05-01 20:36 ` Daniel Jacobowitz
  2008-05-01 22:52   ` Pedro Alves
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-05-01 20:36 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Wed, Apr 30, 2008 at 03:36:30PM +0100, Pedro Alves wrote:
> 2008-04-30  Pedro Alves  <pedro@codesourcery.com>
> 
> 	* linux-nat.c (linux_nat_switch_fork): Reinit GDB's thread list
> 	and register the fork's PTID as a thread.

OK.  I wonder what this does to those thread creation notifications
though... someone gets to sort that out during multi-process.  :-)

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: linux native, switch forks, always have a thread
  2008-05-01 20:36 ` Daniel Jacobowitz
@ 2008-05-01 22:52   ` Pedro Alves
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2008-05-01 22:52 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

A Thursday 01 May 2008 21:35:40, Daniel Jacobowitz wrote:
> On Wed, Apr 30, 2008 at 03:36:30PM +0100, Pedro Alves wrote:
> > 2008-04-30  Pedro Alves  <pedro@codesourcery.com>
> >
> > 	* linux-nat.c (linux_nat_switch_fork): Reinit GDB's thread list
> > 	and register the fork's PTID as a thread.
>
> OK.  I wonder what this does to those thread creation notifications
> though... someone gets to sort that out during multi-process.  :-)

It's in.  Thanks.  Yeah, the frontend gets no clue the process
changed, so this is undefined-land (yet) :-)

-- 
Pedro Alves


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

end of thread, other threads:[~2008-05-01 22:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-30 16:42 linux native, switch forks, always have a thread Pedro Alves
2008-04-30 21:26 ` Michael Snyder
2008-05-01 20:36 ` Daniel Jacobowitz
2008-05-01 22:52   ` Pedro Alves

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