From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sMy9BtWUTWe1pQEAWB0awg (envelope-from ) for ; Mon, 02 Dec 2024 06:07:01 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=n4RY1knh; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MzAyjsVV; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=n4RY1knh; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MzAyjsVV; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 17B651E0BB; Mon, 2 Dec 2024 06:07:01 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9D81F1E092 for ; Mon, 2 Dec 2024 06:07:00 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 408533858C52 for ; Mon, 2 Dec 2024 11:07:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 408533858C52 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=n4RY1knh; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MzAyjsVV; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=n4RY1knh; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MzAyjsVV Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id A8F993858D26 for ; Mon, 2 Dec 2024 11:06:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A8F993858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A8F993858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733137577; cv=none; b=kAuHdUl+UOodZk2fOj5Grq7gw1HByl2PuX7clOUxnoXOy+pX1wMejD/ly6dYv7tGa255tK7wRICHpPfkKCMYlp4y3I3I3lnQTxPAf4p5daE1wyhuPPqtMLtOt6a0ZK8W2HEfxUjSzeymkBfr52DTspRhjFxshhfDM84yOD6JeGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733137577; c=relaxed/simple; bh=jMW1IBk5n6Fw4sHO3LRswjlshk5PYKlsvkr1amot8k4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=jjtc1Dyq3ctsxIDO249TMUpjZPePllJqPenVStTL9Hly+1mXlOf3z1+Lbi9527OKDKzXNvZVY1S4lq5iJZqjNq9D7v25Mt8PV1saCCP5W4dR+K/xCrmSVcyNwxwx4G5S4RM+Fyg0VSMR12Ji+lbR9pfqfVYlXUbw9NsB8TPQuRU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8F993858D26 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 63CC51F452; Mon, 2 Dec 2024 11:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1733137576; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0F97C2eB0WHkJwsLBWQaB3pn5pSiVNaTYgskLtrXOoE=; b=n4RY1knhaEi1W3RTwsaZZfPPqj+6YXfQAUsr85py61SYvToFRsQntj3bufFiGuc1E+/0p1 tx/ynyHbhji3fcKnJzt+uBBzxZBWhZfhCD+s07zKcCds1pPS6hI+0lShsPhQk1eT5FZvKw lFFcu7uzIvR6eLgChfh5/ZNVaTwlg4U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1733137576; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0F97C2eB0WHkJwsLBWQaB3pn5pSiVNaTYgskLtrXOoE=; b=MzAyjsVV34lL+tBLGWKn41FChZUJmILQQRb3koy1HLDrNmBtSMv74sNzYPx65+Q7MdZ2Eh cjDx07RYfRJh2XCg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1733137576; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0F97C2eB0WHkJwsLBWQaB3pn5pSiVNaTYgskLtrXOoE=; b=n4RY1knhaEi1W3RTwsaZZfPPqj+6YXfQAUsr85py61SYvToFRsQntj3bufFiGuc1E+/0p1 tx/ynyHbhji3fcKnJzt+uBBzxZBWhZfhCD+s07zKcCds1pPS6hI+0lShsPhQk1eT5FZvKw lFFcu7uzIvR6eLgChfh5/ZNVaTwlg4U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1733137576; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0F97C2eB0WHkJwsLBWQaB3pn5pSiVNaTYgskLtrXOoE=; b=MzAyjsVV34lL+tBLGWKn41FChZUJmILQQRb3koy1HLDrNmBtSMv74sNzYPx65+Q7MdZ2Eh cjDx07RYfRJh2XCg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3BC1E139C2; Mon, 2 Dec 2024 11:06:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id xl6KDKiUTWfoWwAAD6G6ig (envelope-from ); Mon, 02 Dec 2024 11:06:16 +0000 Message-ID: <45fdfd89-66c8-426a-98d7-5b79a59f1bca@suse.de> Date: Mon, 2 Dec 2024 12:07:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] [gdbsupport] Add gdb::{waitpid,read,write,close} To: =?UTF-8?Q?K=C3=A9vin_Le_Gouguec?= Cc: Simon Marchi , Tom Tromey , gdb-patches@sourceware.org References: <20241028174913.27056-1-tdevries@suse.de> <87y122501s.fsf@tromey.com> <9b20eea0-0f14-47d9-ad7f-39e197d2e521@suse.de> <70b41955-4a06-47db-a467-ef8f24ca030a@suse.de> <2a0ca637-82c7-4194-9b5e-6ce6802e3415@suse.de> <87ser6v2za.fsf@adacore.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <87ser6v2za.fsf@adacore.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.de:email, suse.de:mid] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 12/2/24 10:38, Kévin Le Gouguec wrote: > Tom de Vries writes: > >>> When building for mingw-w64, I see this, which seems related: >>> CXX cli/cli-cmds.o >>> In file included from /home/simark/src/binutils-gdb/gdb/cli/cli-cmds.c:58: >>> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h: In function ‘pid_t gdb::waitpid(pid_t, int*, int)’: >>> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h:77:35: error: ‘::waitpid’ has not been declared; did you mean ‘gdb::waitpid’? >>> 77 | return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, options); >>> | ^~~~~~~ >>> | gdb::waitpid >>> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h:75:1: note: ‘gdb::waitpid’ declared here >>> 75 | waitpid (pid_t pid, int *wstatus, int options) >>> | ^~~~~~~ >>> Note that to get to it, you have to step past this other build error in >>> gdbserver (by doing `make all-gdb` for instance): >>> https://inbox.sourceware.org/gdb-patches/75926446-4c8a-40ee-8ed8-ab55f38e1520@simark.ca/T/#m194744b18419e37dfb4ec82c8e0ce73fb017ba17 >> >> Hi Simon, >> >> thanks for reporting this. >> >> I don't have a windows setup unfortunately, so I have no way of reproducing this, and at this point I have no idea why waitpid is not declared. > > FWIW (not much: not very Windows-savvy), Hi Kevin, same here. > I fixed my test build with the > following patch. I was also getting a "'::wait' has not been declared" > error, hence the extra #ifdef (found no HAVE_ macro for 'wait', so went > with HAVE_SYS_WAIT_H after glancing the 3posix manpage). > > (Figured I'd share since that let me build & test native Windows, though > emphatically not suggesting this as a "proper fix": not sure "wait ⇔ > HAVE_SYS_WAIT_H" is a correct implication, haven't checked if gnulib > might help, …) > Thanks for sharing this. I've been looking into this, and am currently testing a patch that simply uses "#ifndef USE_WIN32API". The HAVE_WAITPID is available in gdb but not gdbserver, so it could be used but would need moving to gdbsupport or duplicating to gdbserver. I suppose it would make sense to add a HAVE_WAIT alongside while doing that. I've left the '#include ' unmodified, since it causes no compilation problems, because there's a gnulib fallback. The situation around sys/wait.h and HAVE_SYS_WAIT_H is a bit confusing, for me at least. The platform doesn't have a sys/wait.h, but gnulib provides a fallback. While configuring, we ignore the gnulib header, and so HAVE_SYS_WAIT_H is undefined. But when compiling the gnulib header is not ignored, so we can use '#include '. AFAIU in the current situation, the only thing that guarding '#include ' with HAVE_SYS_WAIT_H achieves is preventing the gnulib fallback from being included. I suspect that this is a configuration bug, but I'm not sure. BTW, the canonical way (according to ARI) of including seems to be including gdb_wait.h (which does use HAVE_SYS_WAIT_H). Thanks, - Tom > diff --git a/gdbsupport/eintr.h b/gdbsupport/eintr.h > index 3980e3f5ac1..2bd17108f6e 100644 > --- a/gdbsupport/eintr.h > +++ b/gdbsupport/eintr.h > @@ -22,7 +22,9 @@ > > #include > #include > +#ifdef HAVE_SYS_WAIT_H > #include > +#endif > #include > #include > #include > @@ -71,11 +73,13 @@ handle_eintr (ErrorValType errval, const Fun &f, const Args &... args) > return ret; > } > > +#ifdef HAVE_WAITPID > inline pid_t > waitpid (pid_t pid, int *wstatus, int options) > { > return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, options); > } > +#endif > > inline int > open (const char *pathname, int flags) > @@ -83,11 +87,13 @@ open (const char *pathname, int flags) > return gdb::handle_eintr (-1, ::open, pathname, flags); > } > > +#ifdef HAVE_SYS_WAIT_H > inline pid_t > wait (int *wstatus) > { > return gdb::handle_eintr (-1, ::wait, wstatus); > } > +#endif > > inline int > close (int fd) >