From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id W604EafrSWc3gAQAWB0awg (envelope-from ) for ; Fri, 29 Nov 2024 11:28:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1732897703; bh=2JzrBxsNf5pP57v9JZjFa77VtWqkJRR0kg64krH2lbE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JWB/Hk/y2Ats3L9vy2w/NczZQS2AxAxd39upc1F2Qw0DNJyCO9tVAZjifahExgfpA GqG0iLStmogD8pL4ybwZ30tPK/0Ig5m7n54+PtJ/VysNTdC8S+Dy1fkEOWyrl2KasC E0MLb3oHl+FxOD2YtxrJDWiNhSywSKQ5rIZnZ8GE= Received: by simark.ca (Postfix, from userid 112) id 2DAD81E097; Fri, 29 Nov 2024 11:28:23 -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=e3AFMAgZ; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=FOJYKNpk; 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 5DBA41E05C for ; Fri, 29 Nov 2024 11:28:22 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B4423858C50 for ; Fri, 29 Nov 2024 16:28:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B4423858C50 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=e3AFMAgZ; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=FOJYKNpk Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 13E443858D26 for ; Fri, 29 Nov 2024 16:27:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13E443858D26 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 13E443858D26 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=1732897663; cv=none; b=LawENzRFelawrBdfXJS9Q7Vmlrj69POs7ISBxZVpSKsxyayRcbAZGSprFumWE6krHICGGKLPhq6832fX90XjexufTm9aoCp3pdCSX2CLG2XFi/ycwxM2MsH0KQIo813sfd1OCbwBc7XQPeYsHQMdbJyhi3ilYaudlq4GjP8fdXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732897663; c=relaxed/simple; bh=2JzrBxsNf5pP57v9JZjFa77VtWqkJRR0kg64krH2lbE=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=P0PWnU0eBeAXYTuAY3V18aHD/13jLkJGUORJR2bjRfKmE4x0yS4f86FcXM1nNKCk9uFZqIU8IF1L2i/6A6iyNkqragidXlg4e3Y/rJQF74Poxj/VH4+uRLfG1PXsa9l4DgMv4M3Mimy/fhKOiR+TRRWyoFhUGDFSyP2QwDnTHVI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13E443858D26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1732897662; bh=2JzrBxsNf5pP57v9JZjFa77VtWqkJRR0kg64krH2lbE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=e3AFMAgZVWQr+uEWAUViKrl3HNPZMXXPUL9/kxAiXdfFpcoxcXwZ15nBMahcKQLH1 9Zzic+1aw5wsMfWqp1KjjemXHAFWeXhYlrCQGTIQFoFd2vTqmTu6SIeNj1leVv7eHU ui7xqfcf1QTS7+Yy1l3FEunSvLezmr6VzQsquLZ0= Received: by simark.ca (Postfix, from userid 112) id 9A7FA1E0BB; Fri, 29 Nov 2024 11:27:42 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1732897661; bh=2JzrBxsNf5pP57v9JZjFa77VtWqkJRR0kg64krH2lbE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FOJYKNpkWs/LecLhLiT9aCefPE60mMrc/goS5Cn5jcKJPb9/EYoSuKT8WtUoh+ZoY k67KeTtkeUFqRdKJb7AI3VDw4dHk7Pr6E9NRYwCn2Q3dNxYsvZgAgjM8Cm/gX13xb5 b2w2MxJYAhOjew4Na6JGHmN+CKgdCi16lRLvLR5s= 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 0E6D81E05C; Fri, 29 Nov 2024 11:27:41 -0500 (EST) Message-ID: <2ca59a8a-6d37-4338-83a5-ce613f8d2663@simark.ca> Date: Fri, 29 Nov 2024 11:27:40 -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> <2a0ca637-82c7-4194-9b5e-6ce6802e3415@suse.de> Content-Language: en-US From: Simon Marchi In-Reply-To: <2a0ca637-82c7-4194-9b5e-6ce6802e3415@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-29 11:23, Tom de Vries wrote: > On 11/29/24 17:15, Simon Marchi wrote: >> >> >> 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 > > 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. For just build testing, I cross-compile with a mingw-w64 cross compiler, which is available on most distros, looks like it is on Suse: https://en.opensuse.org/MinGW The problem is that you might have to cross build the packages gdb requires. If you're lucky, your distro also packages them for mingw-w64. For instance, it looks like Suse packages libgmp: https://software.opensuse.org/package/mingw64-gmp?locale=ro These are the configure flags I currently use for this build: '--host=x86_64-w64-mingw32' \ 'CFLAGS=-g3 -O0' \ 'CC=ccache x86_64-w64-mingw32-gcc' \ 'CXXFLAGS=-g3 -O0 -fmax-errors=1' \ 'CXX=ccache x86_64-w64-mingw32-g++' \ '--disable-source-highlight' \ '--disable-gold' \ '--disable-ld' \ '--disable-binutils' \ '--disable-gprof' \ '--disable-gas' \ '--without-python' \ '--disable-nls' I'll try to get it to build inside a Suse container. Simon