Thread names and non-ASCII characters

Tom Tromey
Thu Dec 19 17:22:00 GMT 2019

>>>>> "Eli" == Eli Zaretskii <> writes:

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

Yes, I believe so.

Eli> I'm asking because Windows 10 introduces a new API for setting and
Eli> getting a thread's name, but this API wants a UTF-16 encoded string,
Eli> so if we want to use it, we need to decide from/to what encoding to
Eli> convert to/from UTF-16.

Converting to the host charset is probably the thing to do.
If the host charset is decided incorrectly, then enhancing charset.c to
choose a better one would help in other places as well.

convert_between_encodings can be used to do the translation.


More information about the Gdb mailing list