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

Jaroslav Sevcik via lldb-dev lldb-dev at lists.llvm.org
Mon Mar 23 16:40:51 PDT 2020


Attempt at a fix: https://reviews.llvm.org/D76650

On Mon, Mar 23, 2020 at 5:22 PM Lutz Justen via lldb-dev <
lldb-dev at lists.llvm.org> wrote:

> Sorry, the link was internal. Here's the proper on:
>
> https://github.com/llvm-mirror/lldb/blob/master/source/Core/FormatEntity.cpp#L861
>
>
> On Mon, Mar 23, 2020 at 4:00 PM Lutz Justen <ljusten at google.com> wrote:
>
>> 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.
>>
>
>
> --
>
> 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.
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>


-- 

Jaroslav Sevcik |  Software Engineer |  jarin at google.com |

Google Germany GmbH
Erika-Mann-Str. 33
80636 MĂŒnchen

GeschĂ€ftsfĂŒhrer: Paul Manicle, Halimah DeLaine Prado | Registergericht und
-nummer: Hamburg, HRB 86891 | Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und
löschen Sie die E-Mail und alle AnhÀnge. Vielen Dank.

This e-mail is confidential. If you are not the right addressee please do
not forward it, please inform the sender, and please erase this e-mail
including any attachments. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200324/7f52adff/attachment-0001.html>


More information about the lldb-dev mailing list