teak-llvm/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter
Jordan Rupprecht 506144da04 [lldb][DataFormatters] Support pretty printing std::string when built with -funsigned-char.
Summary:
When built w/ `-funsigned-char`, `std::string` becomes equivalent to `std::basic_string<unsigned char>`, causing these formatters to not match. This patch adds overloads for both libstdc++ and libc++ string formatters that accepts unsigned char.

Motivated by the following example:

```
$ cat pretty_print.cc

template <typename T>
void print_val(T s) {
  std::cerr << s << '\n';  // Set a breakpoint here!
}

int main() {
  std::string val = "hello";
  print_val(val);
  return 0;
}
$ clang++ -stdlib=libc++ -funsigned-char -fstandalone-debug -g pretty_print.cc
$ lldb ./a.out -b -o 'b pretty_print.cc:6' -o r -o 'fr v'
...
(lldb) fr v
(std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >) s = {
  __r_ = {
    std::__1::__compressed_pair_elem<std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >::__rep, 0, false> = {
      __value_ = {
         = {
          __l = (__cap_ = 122511465736202, __size_ = 0, __data_ = 0x0000000000000000)
          __s = {
             = (__size_ = '\n', __lx = '\n')
            __data_ = {
              [0] = 'h'
              [1] = 'e'
              [2] = 'l'
              [3] = 'l'
              [4] = 'o'
              [5] = '\0'
...
```

Reviewers: labath, JDevlieghere, shafik

Subscribers: christof, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70517
2019-11-22 10:25:03 -08:00
..
boolreference Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
compactvectors Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
data-formatter-advanced [lldb] Process formatters in reverse-chronological order 2019-09-20 20:19:18 +00:00
data-formatter-categories [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-cpp [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-disabling [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-enum-format [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-globals [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-named-summaries [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-objc Add arm64_32 support to lldb, an ILP32 codegen 2019-10-16 19:14:49 +00:00
data-formatter-proper-plurals Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
data-formatter-ptr-to-array [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-python-synth [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-script [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-skip-summary Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
data-formatter-smart-array [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-stl [lldb][DataFormatters] Support pretty printing std::string when built with -funsigned-char. 2019-11-22 10:25:03 -08:00
data-formatter-synth [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-synthtype [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter-synthval [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
dump_dynamic [dotest] Delete trivial inline test makefiles 2019-09-05 06:55:23 +00:00
format-propagation [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
frameformat_smallstruct [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
hexcaps [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
language_category_updates [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
nsarraysynth Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
nsdictionarysynth Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
nssetsynth Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
ostypeformatting Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
parray [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
poarray Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
ptr_ref_typedef Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
pyobjsynthprovider [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
refpointer-recursion [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
setvaluefromcstring [dotest] Delete trivial inline test makefiles 2019-09-05 06:55:23 +00:00
stringprinter [dotest] Delete trivial inline test makefiles 2019-09-05 06:55:23 +00:00
summary-string-onfail [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
synthcapping [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
synthupdate Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
type_summary_list_arg [lldb][NFC] Remove unused imports in python tests 2019-08-02 08:06:22 +00:00
type_summary_list_script [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
typedef_array [dotest] Delete trivial inline test makefiles 2019-09-05 06:55:23 +00:00
user-format-vs-summary [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
var-in-aggregate-misuse [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
varscript_formatting [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
vector-types [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
.categories