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 3D63438A2414 for ; Wed, 18 Mar 2020 21:22:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3D63438A2414 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca 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 C329C1E5F8; Wed, 18 Mar 2020 17:22:18 -0400 (EDT) Subject: Re: [PATCH] Disable get_ptrace_pid for NetBSD To: Tom Tromey Cc: Kamil Rytarowski , gdb-patches@sourceware.org References: <20200318162915.15043-1-n54@gmx.com> <875zf1v17x.fsf@tromey.com> <87wo7htmd8.fsf@tromey.com> From: Simon Marchi Message-ID: <86f53c7d-80a9-f3da-6c0d-91c76c23f71d@simark.ca> Date: Wed, 18 Mar 2020 17:22:17 -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: <87wo7htmd8.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=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: Wed, 18 Mar 2020 21:22:20 -0000 On 2020-03-18 4:54 p.m., Tom Tromey wrote: >>>>>> "Tom" == Tom Tromey writes: > > Tom> Why not make just the body of this function > > Tom> #ifdef __NetBSD__ > Tom> return ptid.pid () > Tom> #else > Tom> ... old code > > Tom> That would mean fewer #ifs. > > I see that's what you did originally and Simon requested this version. > > Personally I think the new patch is uglier than the original, on the > basis that use of "#if" generally makes the code harder to understand. > > Tom > Indeed, I suggested that. I am hoping that we can isolate the ifdefs in these "gdb_ptrace" functions (we should probably find a better name for those...), to which you pass a "ptid" and do the right thing according to the current OS. I agree that adding ifdefs in the more complex code is ugly and less readable. If my suggestion doesn't work well in practice, then feel free to revert to your original solution, I certainly don't want to impose it if it turns out not to be a good idea. Simon