From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4BE4FtYJcWPS+RcAWB0awg (envelope-from ) for ; Sun, 13 Nov 2022 10:14:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 4DA4C1E124; Sun, 13 Nov 2022 10:14:30 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_DNSWL_MED,RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F417B1E0D3 for ; Sun, 13 Nov 2022 10:14:29 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45D993842423 for ; Sun, 13 Nov 2022 15:14:29 +0000 (GMT) Received: from sa-prd-fep-042.btinternet.com (mailomta22-sa.btinternet.com [213.120.69.28]) by sourceware.org (Postfix) with ESMTPS id 274B83858289 for ; Sun, 13 Nov 2022 15:14:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 274B83858289 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dronecode.org.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=dronecode.org.uk Received: from sa-prd-rgout-002.btmx-prd.synchronoss.net ([10.2.38.5]) by sa-prd-fep-042.btinternet.com with ESMTP id <20221113151415.IYJJ3231.sa-prd-fep-042.btinternet.com@sa-prd-rgout-002.btmx-prd.synchronoss.net>; Sun, 13 Nov 2022 15:14:15 +0000 Authentication-Results: btinternet.com; auth=pass (PLAIN) smtp.auth=jonturney@btinternet.com; bimi=skipped X-SNCR-Rigid: 6139417C4336CF93 X-Originating-IP: [81.153.98.246] X-OWM-Source-IP: 81.153.98.246 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvgedrgedtgdejgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemuceutffkvffkuffjvffgnffgvefqofdpqfgfvfenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheplfhonhcuvfhurhhnvgihuceojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukheqnecuggftrfgrthhtvghrnhepffekiefgudejheetudeigfejledtleegleetkeduteeftdfffefhueefgfeutedtnecukfhppeekuddrudehfedrleekrddvgeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurddutdeingdpihhnvghtpeekuddrudehfedrleekrddvgeeipdhmrghilhhfrhhomhepjhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukhdpnhgspghrtghpthhtohepvddprhgtphhtthhopehguggsqdhprghttghhvghssehsohhurhgtvgifrghrvgdrohhrghdprhgtphhtthhopehtrhhomhgvhiesrggurggtohhrvgdrtghomh X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from [192.168.1.106] (81.153.98.246) by sa-prd-rgout-002.btmx-prd.synchronoss.net (5.8.716.04) (authenticated as jonturney@btinternet.com) id 6139417C4336CF93; Sun, 13 Nov 2022 15:14:15 +0000 Message-ID: Date: Sun, 13 Nov 2022 15:14:14 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] Use strwinerror in gdb/windows-nat.c Content-Language: en-GB To: Tom Tromey , gdb-patches@sourceware.org References: <20220728170555.85143-1-tromey@adacore.com> <877d38e1f7.fsf@tromey.com> <87k045484t.fsf@tromey.com> From: Jon Turney In-Reply-To: <87k045484t.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 08/11/2022 18:24, Tom Tromey via Gdb-patches wrote: >>>>>> "Jon" == Jon Turney writes: > > Jon> I'd suggest the attached to fix this, but I don't think this qualifies > Jon> as obvious, since it's not obvious what USE_WIN32API is supposed to > Jon> mean, so a review would be useful. > > I don't fully know either, but this is what gdbsupport/common.m4 says: > > case ${host} in > *mingw32*) > AC_DEFINE(USE_WIN32API, 1, > [Define if we should use the Windows API, instead of the > POSIX API. On Windows, we use the Windows API when > building for MinGW, but the POSIX API when building > for Cygwin.]) > WIN32APILIBS="-lws2_32" Well, yes. But this seems to mash up a few different things, e.g.: - using the Windows API for interfacing with the debuggee - not using any POSIX API - target is MinGW > Jon> Commit 02d04eac "Use strwinerror in gdb/windows-nat.c" also moves > Jon> strwinerror() under the USE_WIN32API conditional, which is not defined > Jon> for Cygwin (and looks like it shouldn't be, as appears to imply > Jon> non-POSIX and MiNGW and WinSock...) > > Jon> Also enable the declaration and definition of strwinerror() when > Jon> __CYGWIN__ is defined. > > I'm not sure how this area ought to work on Cygwin. The goal here is to > get a better error message when some Windows API fails. If Cygwin can > use strwinerror, then this seems fine. If not, I could write a patch to Thanks for reviewing this change. Cygwin currently uses the Windows Debug API to control the inferior, so it's getting Windows error codes back, so turning those into text like this is indeed useful. I'm going to take this as an approval and apply. (There is a locale issue, in that the Windows idea of the current locale, which FormatMessage() uses, is not necessary the same, or even in a 1:1 mapping with Cygwin's POSIX-like idea of it, but I think I'll ignore that for the moment...) > stub this out for Cygwin, which would be the status quo ante. I think the status quo includes that these function would be used in gdbserver, if anyone built it for Cygwin, because there weren't under USE_WIN32API before.