This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ping] [PATCH] Different outputs affected by locale


> Date: Thu, 12 Jun 2014 19:05:52 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: yao@codesourcery.com, tromey@redhat.com, brobecker@adacore.com,
>         gdb-patches@sourceware.org
> 
> Trying again then.

Thanks.

> The testsuite framework does, in gdb.exp:gdb_init:
> 
>     # We set LC_ALL, LC_CTYPE, and LANG to C so that we get the same
>     # messages as expected.
>     setenv LC_ALL C
>     setenv LC_CTYPE C
>     setenv LANG C
> 
> ... so that output is stable for everyone.

With you so far.  But note that on Windows, even the above does not
guarantee "stable output", because the console codepage is not changed
by 'setlocale', and moreover, the Windows 'setlocale' doesn't pay
attention to environment variables.  So on Windows, these tests run in
the default system locale (because we call 'setlocale' with the 2nd
argument an empty string).

> And if we do that, we miss making sure GDB works correctly
> with locales/charsets other than C/ASCII on most hosts.

And here, "works correctly" means what? sets host-charset? or
something else?  Assuming the former below.

> So I was just saying that IMO ideally we'd have tests that
> make sure GDB prints what we think it should print when
> LC_CTYPE (etc.) is set to something else, like e.g.,
> en_US.UTF-8.

You cannot ask the Windows 'setlocale' to use UTF-8 as the codeset
(although there is a UTF-8 codepage, and Windows does support it in
general).  More importantly, since 'setlocale' on Windows disregards
the environment variables, you cannot change the host charset by
setting environment variables.  You must do that by a GDB command that
sets host-charset.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]