[lldb] Print unprintable characters as unsigned
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 23 Jun 2023 17:55:17 +0000 (10:55 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 23 Jun 2023 18:00:21 +0000 (11:00 -0700)
commit85f40fc676df65416568750f328c71758c84264a
tree0854bf5d8ec521babea1e72c738aef0bab539753
parent60941f1d28ce17958d1e931711d93b8f629d4ad3
[lldb] Print unprintable characters as unsigned

When specifying the C-string format for dumping memory, we treat
unprintable characters as signed. Whether a character is signed or not
is implementation defined, but all printable characters are signed.
Therefore it's fair to assume that unprintable characters are unsigned.

Before this patch, "\xcf\xfa\xed\xfe\f" would be printed as
"\xffffffcf\xfffffffa\xffffffed\xfffffffe\f". Now we correctly print the
original string.

rdar://111126134

Differential revision: https://reviews.llvm.org/D153644
lldb/source/Core/DumpDataExtractor.cpp
lldb/unittests/Core/DumpDataExtractorTest.cpp