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


On 06/12/2014 07:36 PM, Pedro Alves wrote:
> What does "show host-charset" show on Windows, before and after
> you make GDB pick LC_CTYPE=C from the environment (with the
> setlocale gnulib module)?

GDB on Windows gets host charset from GetACP(), in
charset.c:_initialize_charset ().

#elif defined (USE_WIN32API)
  {
    /* "CP" + x<=5 digits + paranoia.  */
    static char w32_host_default_charset[16];

    snprintf (w32_host_default_charset, sizeof w32_host_default_charset,
	      "CP%d", GetACP());
    auto_host_charset_name = w32_host_default_charset;
    auto_target_charset_name = auto_host_charset_name;
  }
#endif

GetACP doesn't depend on locale, so I don't think LC_CTYPE=C affects the
host-charset in GDB.  However, I do this:

  printf ("%d\n", GetACP());

  setlocale (LC_CTYPE, "");
  printf ("%d\n", GetACP());

  setlocale (LC_CTYPE, "C");
  printf ("%d\n", GetACP());

On my Windows machine, 1252 is printed three times.

> 
> (Ideally, the wchar tests would actually iterate testing GDB
> behaves as expected with different values of LC_CTYPE, etc. set
> in the environment.  With all other tests assuming ASCII as set
> by default by the testsuite framework.)

On the condition that we know or enumerate the expected output for
wchars under each LC_CTYPE on different host (or OS).  Test like this
is out of the scope of GDB (or debugger) testing, IMO.

-- 
Yao (éå)


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