From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 81BEE3861C56 for ; Tue, 17 Mar 2020 16:51:54 +0000 (GMT) Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id E1B6C1E5FD; Tue, 17 Mar 2020 12:51:53 -0400 (EDT) Subject: Re: [PATCH v4] Add support for NetBSD threads in sparc-nat.c To: Kamil Rytarowski , gdb-patches@sourceware.org References: <20200317164603.10840-1-n54@gmx.com> From: Simon Marchi Message-ID: Date: Tue, 17 Mar 2020 12:51:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200317164603.10840-1-n54@gmx.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-25.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 16:51:55 -0000 On 2020-03-17 12:46 p.m., Kamil Rytarowski wrote: > NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads. > > This file is still shared with other targets that use different 4th argument > type, that is always unused. > --- > gdb/sparc-nat.c | 50 ++++++++++++++++++++++--------------------------- > 1 file changed, 22 insertions(+), 28 deletions(-) > > diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c > index dff0f521565..10cc01375ed 100644 > --- a/gdb/sparc-nat.c > +++ b/gdb/sparc-nat.c > @@ -78,6 +78,19 @@ typedef struct fp_status fpregset_t; > #define PTRACE_SETFPREGS PT_SETFPREGS > #endif > > +static int > +gdb_ptrace (int request, ptid_t pid, void *addr) > +{ > +#ifdef __NetBSD__ > + /* Support for NetBSD threads: unlike other ptrace implementations in this > + file, NetBSD requires that we pass both the pid and lwp. */ > + return ptrace (request, ptid (). pid (), addr, ptid ().lwp ()); Does that even build? ptid isn't the name of a parameter, and the parenthesis after "ptid" should not be there. Rename the pid parameter to ptid, and replace the above with "ptid.pid ()" and "ptid.lwp ()". Simon