[Bug mi/34501] gdb responds with corrupt output on trying to inserting a breakpoint

"cvs-commit at gcc dot gnu.org via Gdb-prs" <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34501

--- Comment #13 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <[email protected]>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dbf19e0f878eb592011c25c1dbbfc35eee330ec2

commit dbf19e0f878eb592011c25c1dbbfc35eee330ec2
Author: Tom de Vries <[email protected]>
Date:   Thu Aug 13 03:59:17 2026 +0200

    [gdb/cli] Don't emit emojis in MI

    PR mi/34501 reports the following:
    ...
    $ gdb -q \
        -ex 'set charset UTF-8' \
        -ex 'interpreter-exec mi2 "-break-insert -f foo' \
        -ex quit
    &"�\235\214�\217 No symbol table is loaded.  Use the \"file\"
command.\n"
      ...
    $
    ...

    The output is a bit odd, but that gets better if we use
    'set print sevenbit-strings on':
    ...
    &"\342\235\214\357\270\217 No symbol table is loaded.  Use the \"file\"
command.\n"
    ...

    The output we see there is the error emoji:
    ...
    $ gdb
    (gdb) b foo
    âï¸ No symbol table is loaded.  Use the "file" command.
    ...

    More specifically, two utf-8 encoded unicode characters:
    - Cross Mark [1]: 0xE2 0x9D 0x8C
    - Variation Selector-16 (VS16) [2]: 0xEF 0xB8 0x8F

    Now the question: is GDB doing something wrong?

    I think we probably should encode unicode characters in MI error strings as
    octal escapes, independent of the sevenbit-strings setting.  This patch
does
    not address this part.

    Then there's the question whether we should emit emojis in MI error strings
in
    the first place [3].  In principle they're unicode characters encoded in
UTF-8,
    and we can expect other such unicode characters in translated error
strings.

    But, given that MI has can_emit_style_escape () == false, and already
filters
    out ANSI escape sequences, I think it's reasonable to also disable emojis.

    As for implementation, I introduced a function emoji_allowed alongside
    can_emit_style_escape, which defaults to the value of
can_emit_style_escape.

    Tested on x86_64-linux.

    Approved-By: Tom Tromey <[email protected]>

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34501

    [1] https://www.compart.com/en/unicode/U+274C
    [2] https://www.compart.com/en/unicode/U+FE0F
    [3] https://sourceware.org/bugzilla/show_bug.cgi?id=33920#c1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.