From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8D5IBu7oSWdlfgQAWB0awg (envelope-from ) for ; Fri, 29 Nov 2024 11:16:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1732897006; bh=iXytqjjAC+lA2YQqdKKk/OCATPcibZ+DaXbizfNVqBE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=axNC6TF/V+2iN5fkMHKVBTNHo4b9BYRkvD054mBIft+LFGjGnsALz/pMHHjk7dWzN xb3IC70/Z0xoZPlgDzlZbAuyWXZ7Pl53MI6tVG6/LOb7FTkkrxEyr6Riw0ieezQn1c dK2AzCpCxTozQL4SjuQLb+5KLJlDPBtIj2xdz8Pk= Received: by simark.ca (Postfix, from userid 112) id 1531C1E097; Fri, 29 Nov 2024 11:16:46 -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 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=GUrCyDIH; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=MFJxxPLr; dkim-atps=neutral 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 772BC1E05C for ; Fri, 29 Nov 2024 11:16:45 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EEE4B3858C62 for ; Fri, 29 Nov 2024 16:16:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EEE4B3858C62 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=GUrCyDIH; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=MFJxxPLr Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 3E28F3858D26 for ; Fri, 29 Nov 2024 16:15:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3E28F3858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3E28F3858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732896912; cv=none; b=TwVn0Im6RMfqSYRlDxTeD0wNNpa6V7bTB1SOhWDQTvsRyzTNG7g7l4C38ZhSCFpHFwnRslKUBhMlJ3FUPWGY9N68XAebSPWsBCgFERvSC/zn/i4G8Dpsw2kyrDJBeWrfhxdaUYYzcmHrdwcFeR7N42OaejCvb+piP6FgwBYIPYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732896912; c=relaxed/simple; bh=iXytqjjAC+lA2YQqdKKk/OCATPcibZ+DaXbizfNVqBE=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=NwFVa/Xr7NAlBbA5dNKsMqpVe8GwC4lnhaLD1h2J4YEPvSgCdFI04AbMGbA1K/tlqGZbCv5h31mHe+WbdJontjyZ9vqrSwLxeVZdEGXFs9uWE6DileTzdhXF7QWX14YtXq9pfdocQLpg3IQnDWUcygNr13xkevd2dJJfGpsDK+A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E28F3858D26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1732896911; bh=iXytqjjAC+lA2YQqdKKk/OCATPcibZ+DaXbizfNVqBE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GUrCyDIHpBvAYFiznNUQR/m7Q2HBxgRExsXE8oFires9hGPnpH4uHoIuGAToV1ffB 1EWRtupnpm9QoZyufdjwLYdSrLW5NzT/Cw2c745Kxb6FGVn55fkjUFydKJBFtsfZLo MO+VtWCDsC11K+cgUg5pTU85jpCSZl5VCZQgxCwE= Received: by simark.ca (Postfix, from userid 112) id CE93D1E097; Fri, 29 Nov 2024 11:15:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1732896910; bh=iXytqjjAC+lA2YQqdKKk/OCATPcibZ+DaXbizfNVqBE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=MFJxxPLr775YHjEtoZ9NuaMekT4UNiUJejpMamP//A/w3MgOApuLejC5c5P8loMMl o0cUsF6V0squ/mrKxKO72gbGqMUR3kw5mbpPQDHiw3VPV5ok220ZueEdmohwsSwPGH i0PJxC9KLNYHek3C72z/yNcOLYdtEcuVYd5k/TxY= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 717731E05C; Fri, 29 Nov 2024 11:15:10 -0500 (EST) Message-ID: Date: Fri, 29 Nov 2024 11:15:10 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] [gdbsupport] Add gdb::{waitpid,read,write,close} To: Tom de Vries , Tom Tromey Cc: 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> Content-Language: en-US From: Simon Marchi In-Reply-To: <70b41955-4a06-47db-a467-ef8f24ca030a@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 2024-11-22 11:46, Tom de Vries wrote: > On 11/5/24 13:07, Tom de Vries wrote: >> On 11/1/24 18:35, Tom Tromey wrote: >>>>>>>> "Tom" == Tom de Vries writes: >>> >>> Tom> +namespace gdb { >>> Tom> + >>> Tom> +extern "C" { >>> >>> I didn't even know this was valid ... but is it really needed? >>> It seems wrong. >>> >> >> It seemed to work: >> ... >> $ cat test.c >> namespace gdb { >> >> extern "C" { >> int foo (void) { return 1; }; >> } >> } >> >> $ cat test2.c >> namespace gdb { >> extern "C" { >> int foo (void); >> } >> } >> >> int >> main (void) >> { >> return gdb::foo (); >> } >> $ g++ test.c test2.c >> ... >> but the linkage symbol is plain foo: >> ... >> $ nm ./a.out | grep foo >> 00000000004004c7 T foo >> ... >> >> So, you're right, this is wrong. >> >> I seem to have ended up with gdb_waitpid instead of gdb::waitpid in v2, similar to gdb_select, but thinking about it now I slightly prefer gdb::waitpid. I suppose it doesn't matter that much. >> > > When looking at this again today, it bugged me enough rewrite v2 in the gdb::waitpid style. Committed after retesting. 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 Simon