This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix cygwin compilation failure due to nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 28 Dec 2013 07:17:19 +0400
- Subject: Re: [RFA] Fix cygwin compilation failure due to nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing
- Authentication-results: sourceware.org; auth=none
- References: <20131218160707 dot GV30010 at calimero dot vinschen dot de> <834n66ccs9 dot fsf at gnu dot org> <20131218171819 dot GY30010 at calimero dot vinschen dot de> <831u1acblu dot fsf at gnu dot org> <20131218173155 dot GA30010 at calimero dot vinschen dot de> <83zjnyaupt dot fsf at gnu dot org> <20131218191757 dot GC30010 at calimero dot vinschen dot de> <83y53iapy6 dot fsf at gnu dot org> <20131218205416 dot GI30010 at calimero dot vinschen dot de> <83fvpobsh3 dot fsf at gnu dot org>
> 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