From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10716 invoked by alias); 28 Dec 2013 03:17:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 10705 invoked by uid 89); 28 Dec 2013 03:17:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 28 Dec 2013 03:17:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 53931116561; Fri, 27 Dec 2013 22:17:23 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UjvCcwjITEup; Fri, 27 Dec 2013 22:17:23 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E41191164A3; Fri, 27 Dec 2013 22:17:22 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id DBAB5E0833; Sat, 28 Dec 2013 07:17:19 +0400 (RET) Date: Sat, 28 Dec 2013 03:17:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Fix cygwin compilation failure due to nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing Message-ID: <20131228031719.GC4532@adacore.com> References: <20131218160707.GV30010@calimero.vinschen.de> <834n66ccs9.fsf@gnu.org> <20131218171819.GY30010@calimero.vinschen.de> <831u1acblu.fsf@gnu.org> <20131218173155.GA30010@calimero.vinschen.de> <83zjnyaupt.fsf@gnu.org> <20131218191757.GC30010@calimero.vinschen.de> <83y53iapy6.fsf@gnu.org> <20131218205416.GI30010@calimero.vinschen.de> <83fvpobsh3.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83fvpobsh3.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-12/txt/msg00973.txt.bz2 > I took some time to test about a dozen of > the more popular CRT functions that deal with file names and accept > wchar_t arguments. Most of them worked with long file names in the > \\?\ format, but some didn't. thanks for the thorough research, Eli; that's a pretty useful amount of data for anyone wanting to tackle these kinds of issues. I would hate to see it all lost in the mailinglist archives, though. How about we turn this into either a comment in the code (my prefered option, most of the time), or a gdbint update (on the wiki), or even just a wiki page somewhere. We could open, if not already done, a section dealing with Windows-specific issues. > > First, _wchdir failed consistently with file names longer than 260. > Which might not be a surprise, since SetCurrentDirectoryW is > documented to be limited to MAX_PATH characters. But it does mean > that any application which wishes to lift the 260-char limitation will > need to replace chdir and getcwd (and DTRT for each thread). > > Next, _wstat fails for any file name in the \\?\ form, even if it > doesn't exceed the 260-character limit. By contrast, FindFirstFileW, > on which AFAIK the MS implementation of 'stat' is based, has no > problem with such file names, and works with filenames up to 32K > characters. > > On Windows XP (but not on Windows 7), _wfullpath also failed for long > file names. > > The upshot of all this is that it's not enough to just switch to > wchar_t and \\?\ form of file names, there's some non-trivial support > code that will need to be written to take advantage of that in any > sufficiently large application (such as GDB). > > Moreover, even just using Unicode APIs is of questionable value in GDB > (as in any other console program on Windows), because: > > . supporting Unicode on the console will need very serious changes > in Readline and in ui-*.c modules; without such changes, one can > never enter or display file names outside of the current ANSI > codepage > > . the Windows console has very weak support for non-ASCII fonts even > when Unicode APIs are used to read and write to the console > (basically, anything outside of Europe cannot be displayed) > > . any external libraries against which GDB is linked are likely not > to support Unicode file names or UTF-16 text, so you cannot easily > communicate with them without losing Unicode capabilities > > . suppose you get from a Unicode API, such as GetModuleFileNameW, a > file name that cannot be expressed in the current ANSI codepage -- > what can you do with such a file name in GDB? probably nothing > except displaying an error message > > So I think the benefits of switching the MinGW GDB to Unicode APIs are > questionable, although if someone steps forward and does a clean job > for that, I'm quite sure the patches will be more than welcome. -- Joel