Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: linux native, switch forks, always have a thread
Date: Wed, 30 Apr 2008 16:42:00 -0000	[thread overview]
Message-ID: <200804301536.30066.pedro@codesourcery.com> (raw)

[-- 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;
 }
 

             reply	other threads:[~2008-04-30 14:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30 16:42 Pedro Alves [this message]
2008-04-30 21:26 ` Michael Snyder
2008-05-01 20:36 ` Daniel Jacobowitz
2008-05-01 22:52   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200804301536.30066.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox