From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11349 invoked by alias); 22 Aug 2018 18:14:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 11294 invoked by uid 89); 22 Aug 2018 18:14:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Aug 2018 18:14:44 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w7MIEb6r006795 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 22 Aug 2018 14:14:42 -0400 Received: by simark.ca (Postfix, from userid 112) id C69B51EB3B; Wed, 22 Aug 2018 14:14:37 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id BA6761E76F; Wed, 22 Aug 2018 14:14:36 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 22 Aug 2018 18:14:00 -0000 From: Simon Marchi To: Pedro Alves Cc: Xavier Roirand , gdb-patches@sourceware.org, brobecker@adacore.com Subject: Re: [RFA 4/5] Darwin: fix thread ptid started by fork_inferior In-Reply-To: <151c55c9-a622-d01e-7431-8e49c5193751@redhat.com> References: <1534932677-9496-1-git-send-email-roirand@adacore.com> <1534932677-9496-5-git-send-email-roirand@adacore.com> <151c55c9-a622-d01e-7431-8e49c5193751@redhat.com> Message-ID: <5cc8574bfb55b328ea4e1e8712050f3c@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00556.txt.bz2 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 > AuthorDate: Tue Jun 27 10:55:36 2017 +0200 > Commit: Simon Marchi > 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