public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Pedro Alves <palves@redhat.com>
Cc: Xavier Roirand <roirand@adacore.com>,
	gdb-patches@sourceware.org,        brobecker@adacore.com
Subject: Re: [RFA 4/5] Darwin: fix thread ptid started by fork_inferior
Date: Wed, 22 Aug 2018 18:14:00 -0000	[thread overview]
Message-ID: <5cc8574bfb55b328ea4e1e8712050f3c@polymtl.ca> (raw)
In-Reply-To: <151c55c9-a622-d01e-7431-8e49c5193751@redhat.com>

On 2018-08-22 12:10, Pedro Alves wrote:
> On 08/22/2018 11:11 AM, Xavier Roirand wrote:
> 
>> 
>> diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
>> index 96f70cf..9ad4a87 100644
>> --- a/gdb/darwin-nat.c
>> +++ b/gdb/darwin-nat.c
>> @@ -344,8 +344,22 @@ darwin_check_new_threads (struct inferior *inf)
>>  	  pti->gdb_port = new_id;
>>  	  pti->msg_state = DARWIN_RUNNING;
>> 
>> -	  /* Add the new thread.  */
>> -	  add_thread_with_info (ptid_t (inf->pid, 0, new_id), pti);
>> +	  if (old_nbr == 0 && new_ix == 0)
>> +            {
>> +	      /* A ptid is created when the inferior is started (see
>> +                 fork-child.c) with lwp=tid=0.
> 
> It looks like this patch was written against an older gdb,
> because fork-child.c doesn't add a thread nowadays.  For GNU/Linux, 
> it's
> inf-ptrace.c that adds the initial thread, but only after
> fork_inferior returns (inf_ptrace_target::create_inferior).
> 
> But were is that equivalent code in darwin-nat.c?
> 
> /me looks.
> 
> Answer: it's nowhere.  It does not exist.
> 
> So, when then shared fork-child.c was created a while ago,
> the add_thread call was moved to darwin-nat.c's target_create_inferior
> implementation.  But, later on, Simon removed that add_thread call 
> with:
> 
>  commit db665f427ca781d631d9e29b1bb744fb11ffcbba
>  Author:     Simon Marchi <simon.marchi@ericsson.com>
>  AuthorDate: Tue Jun 27 10:55:36 2017 +0200
>  Commit:     Simon Marchi <simon.marchi@ericsson.com>
>  CommitDate: Tue Jun 27 10:56:53 2017 +0200
> 
>     darwin: Do not add a dummy thread
> 
> (Weird, I can't find that patch on the list's archives, even
> though I received a local copy.)
> 
> It sounds to me like you need to reevaluate the patch from
> scratch, because its premise is invalid.

Hmm I had not considered that, I did that a while ago and had completely 
forgotten about it.  I'll try to take a look tomorrow, when I have 
access to the Mac machine.  Maybe the spurious SIGTRAP I saw when 
running was caused by the bug fixed by patch 5/5.

Simon

  reply	other threads:[~2018-08-22 18:14 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 10:11 [RFA 0/5] Fix some bugs on macOS Xavier Roirand
2018-08-22 10:11 ` [RFA 2/5] Darwin: Handle unrelocated dyld Xavier Roirand
2018-08-22 13:55   ` Simon Marchi
2018-09-18 21:22     ` Tom Tromey
2018-09-19 13:41       ` Joel Brobecker
2018-09-19 14:16         ` Simon Marchi
2018-09-19 14:28           ` Joel Brobecker
2018-09-19 14:36         ` Tom Tromey
2018-09-19 14:44           ` Simon Marchi
2018-09-19 15:32             ` Joel Brobecker
2018-09-19 19:15             ` Tom Tromey
2018-09-19 19:50               ` Simon Marchi
2018-09-28 13:31               ` Xavier Roirand
2018-09-28 17:22                 ` Tom Tromey
2018-08-22 13:59   ` Simon Marchi
2018-09-18 21:23     ` Tom Tromey
2018-08-22 10:11 ` [RFA 4/5] Darwin: fix thread ptid started by fork_inferior Xavier Roirand
2018-08-22 14:30   ` Simon Marchi
2018-08-22 16:10   ` Pedro Alves
2018-08-22 18:14     ` Simon Marchi [this message]
2018-09-18 21:01   ` Tom Tromey
2018-08-22 10:11 ` [RFA 1/5] Darwin: fix bad loop incrementation Xavier Roirand
2018-08-22 13:14   ` Simon Marchi
2018-08-23 15:21     ` Simon Marchi
2018-08-22 10:11 ` [RFA 3/5] Darwin: set startup-with-shell to off on Sierra and later Xavier Roirand
2018-08-22 14:20   ` Simon Marchi
2018-08-22 14:37     ` Pedro Alves
2018-09-03 13:23     ` Xavier Roirand
2018-09-17 19:31   ` Tom Tromey
2018-08-22 10:11 ` [RFA 5/5] Darwin: fix SIGTRAP when debugging Xavier Roirand
2018-08-22 14:34   ` Simon Marchi
2018-09-17 20:57 ` [RFA 0/5] Fix some bugs on macOS Tom Tromey
2018-09-17 21:25   ` Joel Brobecker
2018-09-17 23:03     ` Tom Tromey

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=5cc8574bfb55b328ea4e1e8712050f3c@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=roirand@adacore.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).