Bug 415410 - bad display of string values containing Unicode supplemental characters
Summary: bad display of string values containing Unicode supplemental characters
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: CPP Debugger (show other bugs)
Version: 5.4.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-20 18:01 UTC by Andy Heninger
Modified: 2019-12-20 18:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Heninger 2019-12-20 18:01:51 UTC
SUMMARY

The C++ debugger display of string values is garbled when the string contains Unicode supplemental characters, that is, character code points > 64k

STEPS TO REPRODUCE

1. Debug the following test program. The emoji 😎 is Unicode U+1F60E.
=========
#include <iostream>

int main() {
    const char     *cs8  {"Hello, Worldβ😎.\n"};
    const char16_t *cs16 {u"Hello, Worldβ😎.\n"};
    const char32_t *cs32 {U"Hello, Worldβ😎.\n"};

    std::cout << cs8 << std::endl;
}
==========

2. Put a break point on the std::cout line.
3. Examine the local variables in the variables debug window

OBSERVED RESULT

cs8      0x4d9ca0 <str> "Hello, Worldβ�\237\230\216.\n"
cs16     0x4d9ce0 <str> u"Hello, Worldβ�\237\230\216.\n"
cs32     0x4d9d40 <str> U"Hello, Worldβ�\237\230\216.\n"


EXPECTED RESULT

cs8      0x4d9ca0 <str> "Hello, Worldβ😎.\n"
cs16     0x4d9ce0 <str> u"Hello, Worldβ😎.\n"
cs32     0x4d9d40 <str> U"Hello, Worldβ😎.\n"

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Kubuntu 19.10
(available in About System)
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION

Raw gdb, run from the command line, works correctly.

(gdb) b 8
Breakpoint 1 at 0x11d6: file suppl.cpp, line 8.
(gdb) r
Starting program: /home/andy/icprogs/a.out 

Breakpoint 1, main () at suppl.cpp:8
8           std::cout << cs8 << std::endl;
(gdb) p cs8
$1 = 0x555555556009 "Hello, Worldβ😎.\n"
(gdb) p cs16
$2 = 0x555555556020 u"Hello, Worldβ😎.\n"
(gdb) p cs32
$3 = 0x555555556048 U"Hello, Worldβ😎.\n"