[lldb-dev] LLDB sometimes escapes unicode characters, sometimes not

Lutz Justen via lldb-dev lldb-dev at lists.llvm.org
Mon Mar 23 08:00:11 PDT 2020


Hey,

We've noticed that LLDB sometimes escapes certain characters (e.g. in the
+128/negative range) of const char* strings and sometimes it doesn't. In
particular, this happens for unicode strings:

C++:
const char* str =  u8"😂";

LLDB:
(lldb) expr str
(const char *) $0 = 0x00007ff662489d18 "â‰ĄÆ’ĂżĂ©"
(lldb) expr (const char*)str
(const char *) $1 = 0x00007ff662489d18
"\xfffffff0\xffffff9f\xffffff98\xffffff82"

To my understanding, evaluating 'str' and '(const char*)str' should be the
same since str is already a const char*.

We've found that the code takes a different path at this location:
https://source.corp.google.com/piper///depot/google3/third_party/llvm/llvm-project/lldb/source/Core/FormatEntity.cpp;l=865;rcl=294541377

Any idea what's going on? We'd like to get the unescaped strings. Is it
possible to enforce this?

Thanks,

- Lutz

-- 

Dr. Lutz Justen

Software Engineer

ljusten at google.com


Google Germany GmbH

ABC-Str. 19
<https://maps.google.com/?q=ABC-Str.+19+20354+Hamburg&entry=gmail&source=g>

20354 Hamburg
<https://maps.google.com/?q=ABC-Str.+19+20354+Hamburg&entry=gmail&source=g>

GeschĂ€ftsfĂŒhrer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Diese E-Mail ist vertraulich. Falls sie diese fÀlschlicherweise erhalten
haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter,
löschen Sie alle Kopien und AnhÀnge davon und lassen Sie mich bitte wissen,
dass die E-Mail an die falsche Person gesendet wurde.

This e-mail is confidential. If you received this communication by mistake,
please don't forward it to anyone else, please erase all copies and
attachments, and please let me know that it has gone to the wrong person.


Der Inhalt dieser E-Mail spiegelt den derzeitigen Stand der Verhandlungen
wider und dient als Basis fĂŒr weitere GesprĂ€che. Er soll keine rechtlich
verbindliche Verpflichtung begrĂŒnden. Eine solche Verpflichtung wird allein
durch einen zwischen allen beteiligten Parteien abgeschlossenen,
schriftlichen Vertrag geschaffen.

The above terms reflect a potential business arrangement, are provided
solely as a basis for further discussion, and are not intended to be and do
not constitute a legally binding obligation. No legally binding obligations
will be created, implied, or inferred until an agreement in final form is
executed in writing by all parties involved.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200323/52daa228/attachment.html>


More information about the lldb-dev mailing list