Thread names and non-ASCII characters

Eli Zaretskii eliz@gnu.org
Thu Dec 19 15:17:00 GMT 2019


Can someone tell what GDB assumes to be the character encoding used by
thread names we get from the system APIs (such as pthread_getname_np)?
It sounds like we assume the host character set, since the functions
used to display the thread name don't perform any encoding conversion.
Is my understanding correct?

I'm asking because Windows 10 introduces a new API for setting and
getting a thread's name, but this API wants a UTF-16 encoded string,
so if we want to use it, we need to decide from/to what encoding to
convert to/from UTF-16.  The current code in windows-nat.c that
processes the special MSVC exception used on older platforms to set
thread names for debugging purposes simply copies the name as an array
of 'char', so it, too, implicitly assumes the host encoding
(a.k.a. "system codepage" in Windows parlance).

Am I missing something?



More information about the Gdb mailing list