From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1735 invoked by alias); 7 Apr 2017 02:53:30 -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 1713 invoked by uid 89); 7 Apr 2017 02:53:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=ooc, Either X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Apr 2017 02:53:27 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3790380484 for ; Fri, 7 Apr 2017 02:53:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3790380484 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=sergiodj@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3790380484 Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DD7D8440B; Fri, 7 Apr 2017 02:53:26 +0000 (UTC) From: Sergio Durigan Junior To: Pedro Alves Cc: GDB Patches Subject: Re: [PATCH v5 2/5] Share parts of gdb/gdbthread.h with gdbserver References: <1482464361-4068-1-git-send-email-sergiodj@redhat.com> <20170330014915.4894-1-sergiodj@redhat.com> <20170330014915.4894-3-sergiodj@redhat.com> Date: Fri, 07 Apr 2017 02:53:00 -0000 In-Reply-To: (Pedro Alves's message of "Fri, 31 Mar 2017 18:15:34 +0100") Message-ID: <87fuhl3p3t.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00154.txt.bz2 On Friday, March 31 2017, Pedro Alves wrote: > On 03/30/2017 02:49 AM, Sergio Durigan Junior wrote: >> +struct thread_info * >> +add_thread_silent (ptid_t ptid) >> +{ >> + pid_t pid = ptid_get_pid (ptid); >> + >> + /* Check if there is a process already. */ >> + if (find_process_pid (pid) == NULL) >> + add_process (pid, 0); >> + >> + return add_thread (ptid_build (pid, pid, 0), NULL); > > This ptid_build here is always using the "pid" as > lwpid. This suggests to me that "add_thread_silent" was not the > right function entry point to share, since we're adding a hack > to one of the implementations. Either we need a new function, > like "add_initial_thread (pid_t pid)", or maybe we could move the > add_thread_silent call in fork_inferior to the gdb-side, only? OOC, could you expand on why using pid as the lwpid means that this is a hack? On a side note, it seems from your comment that the best alternative would be to move the add_thread_silent call to the GDB-specific postfork_hook, and undo the changes on gdbserver/{linux,lynx}-low.c that add the "*_update_process" functions. This would mean that, on GDB, the prefork_hook would always call add_thread_silent, but on gdbserver each target would be responsible for adding the process/thread after calling fork_inferior. -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/