From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from re-prd-fep-047.btinternet.com (mailomta5-re.btinternet.com [213.120.69.98]) by sourceware.org (Postfix) with ESMTPS id CD232385E032 for ; Thu, 2 Jun 2022 19:29:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CD232385E032 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 re-prd-rgout-002.btmx-prd.synchronoss.net ([10.2.54.5]) by re-prd-fep-047.btinternet.com with ESMTP id <20220602192937.KHYC3222.re-prd-fep-047.btinternet.com@re-prd-rgout-002.btmx-prd.synchronoss.net>; Thu, 2 Jun 2022 20:29:37 +0100 Authentication-Results: btinternet.com; auth=pass (PLAIN) smtp.auth=jonturney@btinternet.com; bimi=skipped X-SNCR-Rigid: 613A8DE8268B4D01 X-Originating-IP: [86.139.167.41] X-OWM-Source-IP: 86.139.167.41 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvfedrleeggddtjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemuceutffkvffkuffjvffgnffgvefqofdpqfgfvfenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheplfhonhcuvfhurhhnvgihuceojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukheqnecuggftrfgrthhtvghrnhepffekiefgudejheetudeigfejledtleegleetkeduteeftdfffefhueefgfeutedtnecukfhppeekiedrudefledrudeijedrgedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurddutdehngdpihhnvghtpeekiedrudefledrudeijedrgedupdhmrghilhhfrhhomhepjhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukhdpnhgspghrtghpthhtohepvddprhgtphhtthhopehguggsqdhprghttghhvghssehsohhurhgtvgifrghrvgdrohhrghdprhgtphhtthhopehtrhhomhgvhiesrggurggtohhrvgdrtghomh X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from [192.168.1.105] (86.139.167.41) by re-prd-rgout-002.btmx-prd.synchronoss.net (5.8.716.04) (authenticated as jonturney@btinternet.com) id 613A8DE8268B4D01; Thu, 2 Jun 2022 20:29:37 +0100 Message-ID: <1133f958-06f5-7ece-6202-078cc6d3c8f6@dronecode.org.uk> Date: Thu, 2 Jun 2022 20:29:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] Handle encoding failures in Windows thread names Content-Language: en-GB To: Tom Tromey , gdb-patches@sourceware.org References: <20220421143926.2550856-1-tromey@adacore.com> <6f7e3db5-76f4-e21d-edbd-2cd1993a7bdd@dronecode.org.uk> <878rqf3zkx.fsf@tromey.com> From: Jon Turney In-Reply-To: <878rqf3zkx.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1194.0 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, NICE_REPLY_A, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 02 Jun 2022 19:29:41 -0000 On 02/06/2022 15:33, Tom Tromey wrote: >>>>>> "Jon" == Jon Turney writes: > > Jon> This is probably wrong on Cygwin (as the target encoding should be > Jon> Cygwin's conception of the locale, not the Windows codepage). Here I meant "Cygwin's conception of the locale for the gdb process" > If there's some way for gdb to know the locale of the inferior, I guess > we could use that here. I don't have Cygwin and so I can't test it or > anything, but if I knew what to do I could try to write a patch for > someone else to test. I am confused by this, but probably I'm missing something. GetThreadDescription() only exists as a wide-char API, so the threadname it returns is always UTF-16 encoded, irrespective of the inferior's locale. Probably, the "right" thing to do on cygwin is use wcstombs(), but apparently that can't report the encoding failure condition you want to detect.