[Mingw-users] UTF-8 stdio in `gdb --interpreter=mi`?

Back to archive index
Alkis Georgopoulos alkis****@gmail*****
Tue May 12 02:00:26 JST 2020


On 5/11/20 7:05 PM, Eli Zaretskii wrote:
>> From: Alkis Georgopoulos <alkis****@gmail*****>
>> Date: Mon, 11 May 2020 18:13:39 +0300
>> 
>> Is there any way to tell gdb that the mi commands it receives are in UTF-8?
>> If not, can it be implemented, even with some command line flag if 
>> necessary?
> 
> First, I don't think this is the right place for these questions.  You
> should be asking this on the GDB mailing list, gdb****@sourc*****.
> 
> More to the point, you are not talking about commands, you are talking
> about _file names_ encoded in UTF-8.  Right?  What you want is for GDB
> to convert the file names from UTF-8 to either ANSI or (better)
> UTF-16, and then use the result in the corresponding file I/O API.
> 
> There's no such feature in GDB, AFAIK.  GDB assumes that filenames it
> gets in the commands are in the same encoding as the local file names,
> and for Windows this means the current ANSI codepage.
> 
> (IMNSHO, it is quite silly of VSCode to use UTF-8 on Windows, since
> kits developers must know that UTF-8 is not supported well by
> Windows.  But that's me.)

Thank you for the answer,

I tested on Linux and gdb uses unicode there, so I thought it was 
something specific to mingw or windows; if not, then yeah I should ask 
there instead.

I only have minimal experience with gdb so I might be wrong, but from 
what I understand, `gdb --interpreter=mi` allows gdb to communicate with 
an external program via its stdio. It's not just about filenames; all 
other commands, error messages etc will be affected.

Most windows program nowadays properly support unicode.
ANSI isn't used much except for old programs compiled for windows 9x.
So I'm not sure why gdb can't support unicode, at least optionally.

If `gdb --interpreter=mi` can accept UTF-16 in its stdio, then the 
problem should be solved in vscode; but my quick tests showed that this 
isn't the case.
I tried this:
type utf16-commands.txt | gdb.exe --interpreter=mi
==> gdb there still assumes the commands are in ANSI and not in UTF-16.

Thanks again,
Alkis



More information about the MinGW-Users mailing list
Back to archive index