From: Joel Brobecker <brobecker@adacore.com>
To: Eli Zaretskii <eliz@gnu.org>
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
Date: Sat, 28 Dec 2013 03:17:00 -0000 [thread overview]
Message-ID: <20131228031719.GC4532@adacore.com> (raw)
In-Reply-To: <83fvpobsh3.fsf@gnu.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
next prev parent reply other threads:[~2013-12-28 3:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <52ab8d0e.8aa2420a.30ff.ffffd8f1SMTPIN_ADDED_BROKEN@mx.google.com>
2013-12-16 17:13 ` Pedro Alves
2013-12-16 22:50 ` Pierre Muller
2013-12-18 11:20 ` Corinna Vinschen
2013-12-18 15:46 ` Eli Zaretskii
2013-12-18 16:07 ` Corinna Vinschen
2013-12-18 17:03 ` Eli Zaretskii
2013-12-18 17:18 ` Corinna Vinschen
2013-12-18 17:29 ` Eli Zaretskii
2013-12-18 17:31 ` Corinna Vinschen
2013-12-18 18:19 ` Eli Zaretskii
2013-12-18 19:18 ` Corinna Vinschen
2013-12-18 20:01 ` Eli Zaretskii
2013-12-18 20:54 ` Corinna Vinschen
2013-12-19 18:33 ` Eli Zaretskii
2013-12-28 3:17 ` Joel Brobecker [this message]
2013-12-28 9:02 ` Eli Zaretskii
2013-12-13 22:41 Pierre Muller
2013-12-16 2:21 ` Yao Qi
2013-12-16 18:05 ` Pedro Alves
2013-12-17 0:43 ` Yao Qi
2013-12-17 8:43 ` Pierre Muller
2013-12-18 3:37 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131228031719.GC4532@adacore.com \
--to=brobecker@adacore.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).