[lldb-dev] [Bug 45856] New: UTF8 data printed differently before and after program start

via lldb-dev lldb-dev at lists.llvm.org
Fri May 8 23:00:23 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45856

            Bug ID: 45856
           Summary: UTF8 data printed differently before and after program
                    start
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: pro.mathias.lang at gmail.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

test.cpp:
```
extern const char8_t data[12] = u8"Hello World";
int main () { return 0; }
```

Compiled with `clang++ -g -std=c++2a test.cpp`.
Running it under LLDB:
```
(lldb) target create "./a.out"
Current executable set to
'/Users/geod24/projects/dlang/llvm-project/lldb/a.out' (x86_64).
(lldb) p data
(const char8_t [12]) $0 = {
  [0] = 0x48 u8'H'
  [1] = 0x65 u8'e'
  [2] = 0x6c u8'l'
  [3] = 0x6c u8'l'
  [4] = 0x6f u8'o'
  [5] = 0x20 u8' '
  [6] = 0x57 u8'W'
  [7] = 0x6f u8'o'
  [8] = 0x72 u8'r'
  [9] = 0x6c u8'l'
  [10] = 0x64 u8'd'
  [11] = 0x00 u8'\0'
}
(lldb) b main
Breakpoint 1: where = a.out`main + 13 at test.cpp:2:15, address =
0x0000000100000f9d
(lldb) run
Process 54857 launched: '/Users/geod24/projects/dlang/llvm-project/lldb/a.out'
(x86_64)
Process 54857 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f9d a.out`main at test.cpp:2:15
   1    extern const char8_t data[12] = u8"Hello World";
-> 2    int main () { return 0; }
Target 0: (a.out) stopped.
(lldb) p data
(const char8_t [12]) $1 = u8"Hello World"
```

I would expect the output to be consistent before and after the program
started.
Tested under MacOSX 10.15, with the latest lldb (f058d397ff8). The issue isn't
C++ specific, as it was found while working on https://reviews.llvm.org/D79559
.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200509/17d87ff0/attachment.html>


More information about the lldb-dev mailing list