From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iPdiE1WATWcgmAEAWB0awg (envelope-from ) for ; Mon, 02 Dec 2024 04:39:33 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=bEqxtO4F; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4C3881E0BB; Mon, 2 Dec 2024 04:39:33 -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 E74A31E092 for ; Mon, 2 Dec 2024 04:39:32 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7975F3858CDB for ; Mon, 2 Dec 2024 09:39:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7975F3858CDB Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=bEqxtO4F Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id AE0F03858D26 for ; Mon, 2 Dec 2024 09:38:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE0F03858D26 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AE0F03858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733132332; cv=none; b=V5FtQ7BmrfbTffmKKqXKrzJhjecAHk7nyYj4LXdOw2eOwghF/oLQRDYHpI8/xq+0umA3aEhC7iS3ptp0FJ2o5lLvdJ6INCxAbbWUpD8mANQebM0w6Ej9M43DNV2cSil2Q67OgwhOOBOi3ZFOQS0IGFDvYzBHQTl4A5ew8ofYELc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733132332; c=relaxed/simple; bh=dpbi+mxLH9CYpqZEcBEaqsKKPrU/w6py3xN7D5n6CCU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=G1wKDtcWEhwXVl2u8JZ9ovGdfG94iZmmtOGAW8zhf/wnwRMy98w2dG+9RP0lK+36m9I1ENQSDcdjW2Hhey42VKNiNHrWsgF8ilmBf6bblTVvoed8hdjJR3rQX/gTSobwOuIWGhWaMOlqQqHM48woxia8WfrFrJxRi25dt1r1vuY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE0F03858D26 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-434acf1f9abso36735325e9.2 for ; Mon, 02 Dec 2024 01:38:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1733132330; x=1733737130; darn=sourceware.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cH2iDAHZJl9wxeGeyxDnl8HDCbY+IrDMrbcLJWWMnH4=; b=bEqxtO4FOeOYrGGi48aU7yI3TX1OVp0oK+ilqJioYKISTfXTzzSdCQfre2qb1jkE6X LgNi+cwPmu/eHNyGQhGusYZdVk2ill0Ks3tvSjJU+BK8iRBitJWx+oTWof0rQvS3au69 0e/OSAobku1JCv6YgIIbR+aRwLJ7MO8vqqG5cVHv3LQiKyHcFOd+uUE1P9D26ytys0pt +YVYWVtHCslxKKaGhJyWrbl6qB2aj5XsQe+SqFHVDmW0fI2ClLS3ekAFH5TTAntq8wVW DWdwEEkTG5cD0PH6o+z0nucXYO8KC7qDO9Z/Gx5f4C8yIASCubcaOhdm7r2m4lhGMp+B ckuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733132330; x=1733737130; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cH2iDAHZJl9wxeGeyxDnl8HDCbY+IrDMrbcLJWWMnH4=; b=hIDJgzRtPz/LJJ58bWluXs144RujfERWtNUFU9J2c/msVPqy/wpL/Q2H0VLC0rm41F V1xh+KYsLnA7sn1OXEO9MoLrWqRj7j1cDlq7F2ocFNCgNWa6zmm/+XXpMZONNigiC3VR ArBg+7YmtfkElya8FzrBdjafW4rEMEOk8/UjgKXHpcAW+JNE7+UoPZUsmAaVNwNtOQkL fXF6rarBlFVXXTbjDNR2MM7d/+YnTU1lL8B4Mox3kbKCqL4MgdpddOf88JFiBuJlGnOo VK0rxr9mQCMfZ/zKzPmZirXN7GjEDKu/D+T+fWq+mrLt/fJXuobVYUus3J7NUWNeqMkO zrXw== X-Forwarded-Encrypted: i=1; AJvYcCWPvMZU3o1mb4dk8ZHoU+5LSxjxfaF6BLSHteq0ufc+jA21N/vkrkALCK8lgAHegcOaF8btnkYQjI6Y0w==@sourceware.org X-Gm-Message-State: AOJu0YyF18CfMasFdUF4BVVu6xn2JsPqoWj8XAYrBFWDg+0C2RPZPg8V xnEpO3/yB6Y9BOyUA9vcBI/4Z9elh7HKjnJfLmWcOuiJKxiupeaVVFq1+1qgPSdLH2bOUwk1nzA = X-Gm-Gg: ASbGncu29IZA7TWGr81/b8bx7poIaAINxUcGGojos13g2UD/k/GA/h3T1jEoC2bG9UW r2ZCyZ8Pb6OmF/1nGz++UbDcUzaNa3BXdUvn4jVJPkRMOJA4e/ej06Ab4Xc0xsy27w/RWuvJpOb 7pIJBv0lznuIYaR3nv5uJHMccP5D5sF19+SVaGBa27yi9fo6PcgnaI7Q/E6dRL/D6a0+pVIEllK lYXgXftRYssRP3ra2KSK3X84sfDpCoUH4NurA4kVbCL22988I1iqTRTVBm9qpyJboAn7A== X-Google-Smtp-Source: AGHT+IEsiFINd47h8XUAEw+1fkpWNHgsAFg5h2T40kMMfARqsLRXv7pz6jDZWofOYiV0P8lv0wmuuA== X-Received: by 2002:a05:6000:1ac5:b0:382:47d0:64be with SMTP id ffacd0b85a97d-385c6ebefc2mr16690162f8f.29.1733132330070; Mon, 02 Dec 2024 01:38:50 -0800 (PST) Received: from legouguec-Precision-7550 ([2a01:e0a:253:fe0:d54d:b718:13f9:4a39]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385e9fda2f6sm5051062f8f.107.2024.12.02.01.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 01:38:49 -0800 (PST) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Tom de Vries Cc: Simon Marchi , Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] [gdbsupport] Add gdb::{waitpid,read,write,close} In-Reply-To: <2a0ca637-82c7-4194-9b5e-6ce6802e3415@suse.de> (Tom de Vries's message of "Fri, 29 Nov 2024 17:23:15 +0100") 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> Date: Mon, 02 Dec 2024 10:38:49 +0100 Message-ID: <87ser6v2za.fsf@adacore.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 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-cmd= s.c:58: >> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h: In functio= n =E2=80=98pid_t gdb::waitpid(pid_t, int*, int)=E2=80=99: >> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h:77:35: erro= r: =E2=80=98::waitpid=E2=80=99 has not been declared; did you mean =E2=80= =98gdb::waitpid=E2=80=99? >> 77 | return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, op= tions); >> | ^~~~~~~ >> | gdb::waitpid >> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h:75:1: note:= =E2=80=98gdb::waitpid=E2=80=99 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-ab55= f38e1520@simark.ca/T/#m194744b18419e37dfb4ec82c8e0ce73fb017ba17 > > Hi Simon, > > thanks for reporting this. > > I don't have a windows setup unfortunately, so I have no way of reproduci= ng this, and at this point I have no idea why waitpid is not declared. FWIW (not much: not very Windows-savvy), 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 =E2=87=94 HAVE_SYS_WAIT_H" is a correct implication, haven't checked if gnulib might help, =E2=80=A6) 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 @@ =20 #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; } =20 +#ifdef HAVE_WAITPID inline pid_t waitpid (pid_t pid, int *wstatus, int options) { return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, options); } +#endif =20 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); } =20 +#ifdef HAVE_SYS_WAIT_H inline pid_t wait (int *wstatus) { return gdb::handle_eintr (-1, ::wait, wstatus); } +#endif =20 inline int close (int fd)