LLDB  mainline
CPlusPlusLanguage.cpp
Go to the documentation of this file.
1 //===-- CPlusPlusLanguage.cpp ---------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "CPlusPlusLanguage.h"
10 
11 #include <cctype>
12 #include <cstring>
13 
14 #include <functional>
15 #include <memory>
16 #include <mutex>
17 #include <set>
18 
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/Demangle/ItaniumDemangle.h"
21 
22 #include "lldb/Core/Mangled.h"
23 #include "lldb/Core/Module.h"
31 #include "lldb/Symbol/SymbolFile.h"
34 #include "lldb/Utility/LLDBLog.h"
35 #include "lldb/Utility/Log.h"
37 
38 #include "BlockPointer.h"
39 #include "CPlusPlusNameParser.h"
40 #include "Coroutines.h"
41 #include "CxxStringTypes.h"
42 #include "Generic.h"
43 #include "LibCxx.h"
44 #include "LibCxxAtomic.h"
45 #include "LibCxxVariant.h"
46 #include "LibStdcpp.h"
48 
49 using namespace lldb;
50 using namespace lldb_private;
51 using namespace lldb_private::formatters;
52 
54 
55 void CPlusPlusLanguage::Initialize() {
56  PluginManager::RegisterPlugin(GetPluginNameStatic(), "C++ Language",
57  CreateInstance);
58 }
59 
60 void CPlusPlusLanguage::Terminate() {
61  PluginManager::UnregisterPlugin(CreateInstance);
62 }
63 
64 bool CPlusPlusLanguage::SymbolNameFitsToLanguage(Mangled mangled) const {
65  const char *mangled_name = mangled.GetMangledName().GetCString();
66  return mangled_name && CPlusPlusLanguage::IsCPPMangledName(mangled_name);
67 }
68 
69 ConstString CPlusPlusLanguage::GetDemangledFunctionNameWithoutArguments(
70  Mangled mangled) const {
71  const char *mangled_name_cstr = mangled.GetMangledName().GetCString();
72  ConstString demangled_name = mangled.GetDemangledName();
73  if (demangled_name && mangled_name_cstr && mangled_name_cstr[0]) {
74  if (mangled_name_cstr[0] == '_' && mangled_name_cstr[1] == 'Z' &&
75  (mangled_name_cstr[2] != 'T' && // avoid virtual table, VTT structure,
76  // typeinfo structure, and typeinfo
77  // mangled_name
78  mangled_name_cstr[2] != 'G' && // avoid guard variables
79  mangled_name_cstr[2] != 'Z')) // named local entities (if we
80  // eventually handle eSymbolTypeData,
81  // we will want this back)
82  {
83  CPlusPlusLanguage::MethodName cxx_method(demangled_name);
84  if (!cxx_method.GetBasename().empty()) {
85  std::string shortname;
86  if (!cxx_method.GetContext().empty())
87  shortname = cxx_method.GetContext().str() + "::";
88  shortname += cxx_method.GetBasename().str();
89  return ConstString(shortname);
90  }
91  }
92  }
93  if (demangled_name)
94  return demangled_name;
95  return mangled.GetMangledName();
96 }
97 
98 // Static Functions
99 
100 Language *CPlusPlusLanguage::CreateInstance(lldb::LanguageType language) {
101  // Use plugin for C++ but not for Objective-C++ (which has its own plugin).
102  if (Language::LanguageIsCPlusPlus(language) &&
103  language != eLanguageTypeObjC_plus_plus)
104  return new CPlusPlusLanguage();
105  return nullptr;
106 }
107 
108 void CPlusPlusLanguage::MethodName::Clear() {
109  m_full.Clear();
110  m_basename = llvm::StringRef();
111  m_context = llvm::StringRef();
112  m_arguments = llvm::StringRef();
113  m_qualifiers = llvm::StringRef();
114  m_return_type = llvm::StringRef();
115  m_parsed = false;
116  m_parse_error = false;
117 }
118 
119 static bool ReverseFindMatchingChars(const llvm::StringRef &s,
120  const llvm::StringRef &left_right_chars,
121  size_t &left_pos, size_t &right_pos,
122  size_t pos = llvm::StringRef::npos) {
123  assert(left_right_chars.size() == 2);
124  left_pos = llvm::StringRef::npos;
125  const char left_char = left_right_chars[0];
126  const char right_char = left_right_chars[1];
127  pos = s.find_last_of(left_right_chars, pos);
128  if (pos == llvm::StringRef::npos || s[pos] == left_char)
129  return false;
130  right_pos = pos;
131  uint32_t depth = 1;
132  while (pos > 0 && depth > 0) {
133  pos = s.find_last_of(left_right_chars, pos);
134  if (pos == llvm::StringRef::npos)
135  return false;
136  if (s[pos] == left_char) {
137  if (--depth == 0) {
138  left_pos = pos;
139  return left_pos < right_pos;
140  }
141  } else if (s[pos] == right_char) {
142  ++depth;
143  }
144  }
145  return false;
146 }
147 
148 static bool IsTrivialBasename(const llvm::StringRef &basename) {
149  // Check that the basename matches with the following regular expression
150  // "^~?([A-Za-z_][A-Za-z_0-9]*)$" We are using a hand written implementation
151  // because it is significantly more efficient then using the general purpose
152  // regular expression library.
153  size_t idx = 0;
154  if (basename.size() > 0 && basename[0] == '~')
155  idx = 1;
156 
157  if (basename.size() <= idx)
158  return false; // Empty string or "~"
159 
160  if (!std::isalpha(basename[idx]) && basename[idx] != '_')
161  return false; // First character (after removing the possible '~'') isn't in
162  // [A-Za-z_]
163 
164  // Read all characters matching [A-Za-z_0-9]
165  ++idx;
166  while (idx < basename.size()) {
167  if (!std::isalnum(basename[idx]) && basename[idx] != '_')
168  break;
169  ++idx;
170  }
171 
172  // We processed all characters. It is a vaild basename.
173  return idx == basename.size();
174 }
175 
176 /// Writes out the function name in 'full_name' to 'out_stream'
177 /// but replaces each argument type with the variable name
178 /// and the corresponding pretty-printed value
179 static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream,
180  char const *full_name,
181  ExecutionContextScope *exe_scope,
182  VariableList const &args) {
183  CPlusPlusLanguage::MethodName cpp_method{ConstString(full_name)};
184 
185  if (!cpp_method.IsValid())
186  return false;
187 
188  llvm::StringRef return_type = cpp_method.GetReturnType();
189  if (!return_type.empty()) {
190  out_stream.PutCString(return_type);
191  out_stream.PutChar(' ');
192  }
193 
194  out_stream.PutCString(cpp_method.GetScopeQualifiedName());
195  out_stream.PutChar('(');
196 
197  FormatEntity::PrettyPrintFunctionArguments(out_stream, args, exe_scope);
198 
199  out_stream.PutChar(')');
200 
201  llvm::StringRef qualifiers = cpp_method.GetQualifiers();
202  if (!qualifiers.empty()) {
203  out_stream.PutChar(' ');
204  out_stream.PutCString(qualifiers);
205  }
206 
207  return true;
208 }
209 
210 bool CPlusPlusLanguage::MethodName::TrySimplifiedParse() {
211  // This method tries to parse simple method definitions which are presumably
212  // most comman in user programs. Definitions that can be parsed by this
213  // function don't have return types and templates in the name.
214  // A::B::C::fun(std::vector<T> &) const
215  size_t arg_start, arg_end;
216  llvm::StringRef full(m_full.GetCString());
217  llvm::StringRef parens("()", 2);
218  if (ReverseFindMatchingChars(full, parens, arg_start, arg_end)) {
219  m_arguments = full.substr(arg_start, arg_end - arg_start + 1);
220  if (arg_end + 1 < full.size())
221  m_qualifiers = full.substr(arg_end + 1).ltrim();
222 
223  if (arg_start == 0)
224  return false;
225  size_t basename_end = arg_start;
226  size_t context_start = 0;
227  size_t context_end = full.rfind(':', basename_end);
228  if (context_end == llvm::StringRef::npos)
229  m_basename = full.substr(0, basename_end);
230  else {
231  if (context_start < context_end)
232  m_context = full.substr(context_start, context_end - 1 - context_start);
233  const size_t basename_begin = context_end + 1;
234  m_basename = full.substr(basename_begin, basename_end - basename_begin);
235  }
236 
237  if (IsTrivialBasename(m_basename)) {
238  return true;
239  } else {
240  // The C++ basename doesn't match our regular expressions so this can't
241  // be a valid C++ method, clear everything out and indicate an error
242  m_context = llvm::StringRef();
243  m_basename = llvm::StringRef();
244  m_arguments = llvm::StringRef();
245  m_qualifiers = llvm::StringRef();
246  m_return_type = llvm::StringRef();
247  return false;
248  }
249  }
250  return false;
251 }
252 
253 void CPlusPlusLanguage::MethodName::Parse() {
254  if (!m_parsed && m_full) {
255  if (TrySimplifiedParse()) {
256  m_parse_error = false;
257  } else {
258  CPlusPlusNameParser parser(m_full.GetStringRef());
259  if (auto function = parser.ParseAsFunctionDefinition()) {
260  m_basename = function.value().name.basename;
261  m_context = function.value().name.context;
262  m_arguments = function.value().arguments;
263  m_qualifiers = function.value().qualifiers;
264  m_return_type = function.value().return_type;
265  m_parse_error = false;
266  } else {
267  m_parse_error = true;
268  }
269  }
270  m_parsed = true;
271  }
272 }
273 
274 llvm::StringRef CPlusPlusLanguage::MethodName::GetBasename() {
275  if (!m_parsed)
276  Parse();
277  return m_basename;
278 }
279 
280 llvm::StringRef CPlusPlusLanguage::MethodName::GetContext() {
281  if (!m_parsed)
282  Parse();
283  return m_context;
284 }
285 
286 llvm::StringRef CPlusPlusLanguage::MethodName::GetArguments() {
287  if (!m_parsed)
288  Parse();
289  return m_arguments;
290 }
291 
292 llvm::StringRef CPlusPlusLanguage::MethodName::GetQualifiers() {
293  if (!m_parsed)
294  Parse();
295  return m_qualifiers;
296 }
297 
298 llvm::StringRef CPlusPlusLanguage::MethodName::GetReturnType() {
299  if (!m_parsed)
300  Parse();
301  return m_return_type;
302 }
303 
304 std::string CPlusPlusLanguage::MethodName::GetScopeQualifiedName() {
305  if (!m_parsed)
306  Parse();
307  if (m_context.empty())
308  return std::string(m_basename);
309 
310  std::string res;
311  res += m_context;
312  res += "::";
313  res += m_basename;
314  return res;
315 }
316 
317 llvm::StringRef
318 CPlusPlusLanguage::MethodName::GetBasenameNoTemplateParameters() {
319  llvm::StringRef basename = GetBasename();
320  size_t arg_start, arg_end;
321  llvm::StringRef parens("<>", 2);
322  if (ReverseFindMatchingChars(basename, parens, arg_start, arg_end))
323  return basename.substr(0, arg_start);
324 
325  return basename;
326 }
327 
328 bool CPlusPlusLanguage::MethodName::ContainsPath(llvm::StringRef path) {
329  if (!m_parsed)
330  Parse();
331 
332  // If we can't parse the incoming name, then just check that it contains path.
333  if (m_parse_error)
334  return m_full.GetStringRef().contains(path);
335 
336  llvm::StringRef identifier;
337  llvm::StringRef context;
338  std::string path_str = path.str();
339  bool success
340  = CPlusPlusLanguage::ExtractContextAndIdentifier(path_str.c_str(),
341  context,
342  identifier);
343  if (!success)
344  return m_full.GetStringRef().contains(path);
345 
346  // Basename may include template arguments.
347  // E.g.,
348  // GetBaseName(): func<int>
349  // identifier : func
350  //
351  // ...but we still want to account for identifiers with template parameter
352  // lists, e.g., when users set breakpoints on template specializations.
353  //
354  // E.g.,
355  // GetBaseName(): func<uint32_t>
356  // identifier : func<int32_t*>
357  //
358  // Try to match the basename with or without template parameters.
359  if (GetBasename() != identifier &&
360  GetBasenameNoTemplateParameters() != identifier)
361  return false;
362 
363  // Incoming path only had an identifier, so we match.
364  if (context.empty())
365  return true;
366  // Incoming path has context but this method does not, no match.
367  if (m_context.empty())
368  return false;
369 
370  llvm::StringRef haystack = m_context;
371  if (!haystack.consume_back(context))
372  return false;
373  if (haystack.empty() || !isalnum(haystack.back()))
374  return true;
375 
376  return false;
377 }
378 
379 bool CPlusPlusLanguage::IsCPPMangledName(llvm::StringRef name) {
380  // FIXME!! we should really run through all the known C++ Language plugins
381  // and ask each one if this is a C++ mangled name
382 
383  Mangled::ManglingScheme scheme = Mangled::GetManglingScheme(name);
384 
385  if (scheme == Mangled::eManglingSchemeNone)
386  return false;
387 
388  return true;
389 }
390 
391 bool CPlusPlusLanguage::DemangledNameContainsPath(llvm::StringRef path,
392  ConstString demangled) const {
393  MethodName demangled_name(demangled);
394  return demangled_name.ContainsPath(path);
395 }
396 
397 bool CPlusPlusLanguage::ExtractContextAndIdentifier(
398  const char *name, llvm::StringRef &context, llvm::StringRef &identifier) {
401  identifier);
402 
403  CPlusPlusNameParser parser(name);
404  if (auto full_name = parser.ParseAsFullName()) {
405  identifier = full_name.value().basename;
406  context = full_name.value().context;
407  return true;
408  }
409  return false;
410 }
411 
412 namespace {
413 class NodeAllocator {
414  llvm::BumpPtrAllocator Alloc;
415 
416 public:
417  void reset() { Alloc.Reset(); }
418 
419  template <typename T, typename... Args> T *makeNode(Args &&... args) {
420  return new (Alloc.Allocate(sizeof(T), alignof(T)))
421  T(std::forward<Args>(args)...);
422  }
423 
424  void *allocateNodeArray(size_t sz) {
425  return Alloc.Allocate(sizeof(llvm::itanium_demangle::Node *) * sz,
426  alignof(llvm::itanium_demangle::Node *));
427  }
428 };
429 
430 template <typename Derived>
431 class ManglingSubstitutor
432  : public llvm::itanium_demangle::AbstractManglingParser<Derived,
433  NodeAllocator> {
434  using Base =
435  llvm::itanium_demangle::AbstractManglingParser<Derived, NodeAllocator>;
436 
437 public:
438  ManglingSubstitutor() : Base(nullptr, nullptr) {}
439 
440  template <typename... Ts>
441  ConstString substitute(llvm::StringRef Mangled, Ts &&... Vals) {
442  this->getDerived().reset(Mangled, std::forward<Ts>(Vals)...);
443  return substituteImpl(Mangled);
444  }
445 
446 protected:
447  void reset(llvm::StringRef Mangled) {
448  Base::reset(Mangled.begin(), Mangled.end());
449  Written = Mangled.begin();
450  Result.clear();
451  Substituted = false;
452  }
453 
454  ConstString substituteImpl(llvm::StringRef Mangled) {
455  Log *log = GetLog(LLDBLog::Language);
456  if (this->parse() == nullptr) {
457  LLDB_LOG(log, "Failed to substitute mangling in {0}", Mangled);
458  return ConstString();
459  }
460  if (!Substituted)
461  return ConstString();
462 
463  // Append any trailing unmodified input.
464  appendUnchangedInput();
465  LLDB_LOG(log, "Substituted mangling {0} -> {1}", Mangled, Result);
466  return ConstString(Result);
467  }
468 
469  void trySubstitute(llvm::StringRef From, llvm::StringRef To) {
470  if (!llvm::StringRef(currentParserPos(), this->numLeft()).startswith(From))
471  return;
472 
473  // We found a match. Append unmodified input up to this point.
474  appendUnchangedInput();
475 
476  // And then perform the replacement.
477  Result += To;
478  Written += From.size();
479  Substituted = true;
480  }
481 
482 private:
483  /// Input character until which we have constructed the respective output
484  /// already.
485  const char *Written = "";
486 
487  llvm::SmallString<128> Result;
488 
489  /// Whether we have performed any substitutions.
490  bool Substituted = false;
491 
492  const char *currentParserPos() const { return this->First; }
493 
494  void appendUnchangedInput() {
495  Result +=
496  llvm::StringRef(Written, std::distance(Written, currentParserPos()));
497  Written = currentParserPos();
498  }
499 };
500 
501 /// Given a mangled function `Mangled`, replace all the primitive function type
502 /// arguments of `Search` with type `Replace`.
503 class TypeSubstitutor : public ManglingSubstitutor<TypeSubstitutor> {
504  llvm::StringRef Search;
505  llvm::StringRef Replace;
506 
507 public:
508  void reset(llvm::StringRef Mangled, llvm::StringRef Search,
509  llvm::StringRef Replace) {
510  ManglingSubstitutor::reset(Mangled);
511  this->Search = Search;
512  this->Replace = Replace;
513  }
514 
515  llvm::itanium_demangle::Node *parseType() {
516  trySubstitute(Search, Replace);
517  return ManglingSubstitutor::parseType();
518  }
519 };
520 
521 class CtorDtorSubstitutor : public ManglingSubstitutor<CtorDtorSubstitutor> {
522 public:
523  llvm::itanium_demangle::Node *
524  parseCtorDtorName(llvm::itanium_demangle::Node *&SoFar, NameState *State) {
525  trySubstitute("C1", "C2");
526  trySubstitute("D1", "D2");
527  return ManglingSubstitutor::parseCtorDtorName(SoFar, State);
528  }
529 };
530 } // namespace
531 
532 std::vector<ConstString> CPlusPlusLanguage::GenerateAlternateFunctionManglings(
533  const ConstString mangled_name) const {
534  std::vector<ConstString> alternates;
535 
536  /// Get a basic set of alternative manglings for the given symbol `name`, by
537  /// making a few basic possible substitutions on basic types, storage duration
538  /// and `const`ness for the given symbol. The output parameter `alternates`
539  /// is filled with a best-guess, non-exhaustive set of different manglings
540  /// for the given name.
541 
542  // Maybe we're looking for a const symbol but the debug info told us it was
543  // non-const...
544  if (!strncmp(mangled_name.GetCString(), "_ZN", 3) &&
545  strncmp(mangled_name.GetCString(), "_ZNK", 4)) {
546  std::string fixed_scratch("_ZNK");
547  fixed_scratch.append(mangled_name.GetCString() + 3);
548  alternates.push_back(ConstString(fixed_scratch));
549  }
550 
551  // Maybe we're looking for a static symbol but we thought it was global...
552  if (!strncmp(mangled_name.GetCString(), "_Z", 2) &&
553  strncmp(mangled_name.GetCString(), "_ZL", 3)) {
554  std::string fixed_scratch("_ZL");
555  fixed_scratch.append(mangled_name.GetCString() + 2);
556  alternates.push_back(ConstString(fixed_scratch));
557  }
558 
559  TypeSubstitutor TS;
560  // `char` is implementation defined as either `signed` or `unsigned`. As a
561  // result a char parameter has 3 possible manglings: 'c'-char, 'a'-signed
562  // char, 'h'-unsigned char. If we're looking for symbols with a signed char
563  // parameter, try finding matches which have the general case 'c'.
564  if (ConstString char_fixup =
565  TS.substitute(mangled_name.GetStringRef(), "a", "c"))
566  alternates.push_back(char_fixup);
567 
568  // long long parameter mangling 'x', may actually just be a long 'l' argument
569  if (ConstString long_fixup =
570  TS.substitute(mangled_name.GetStringRef(), "x", "l"))
571  alternates.push_back(long_fixup);
572 
573  // unsigned long long parameter mangling 'y', may actually just be unsigned
574  // long 'm' argument
575  if (ConstString ulong_fixup =
576  TS.substitute(mangled_name.GetStringRef(), "y", "m"))
577  alternates.push_back(ulong_fixup);
578 
579  if (ConstString ctor_fixup =
580  CtorDtorSubstitutor().substitute(mangled_name.GetStringRef()))
581  alternates.push_back(ctor_fixup);
582 
583  return alternates;
584 }
585 
586 ConstString CPlusPlusLanguage::FindBestAlternateFunctionMangledName(
587  const Mangled mangled, const SymbolContext &sym_ctx) const {
588  ConstString demangled = mangled.GetDemangledName();
589  if (!demangled)
590  return ConstString();
591 
592  CPlusPlusLanguage::MethodName cpp_name(demangled);
593  std::string scope_qualified_name = cpp_name.GetScopeQualifiedName();
594 
595  if (!scope_qualified_name.size())
596  return ConstString();
597 
598  if (!sym_ctx.module_sp)
599  return ConstString();
600 
601  lldb_private::SymbolFile *sym_file = sym_ctx.module_sp->GetSymbolFile();
602  if (!sym_file)
603  return ConstString();
604 
605  std::vector<ConstString> alternates;
606  sym_file->GetMangledNamesForFunction(scope_qualified_name, alternates);
607 
608  std::vector<ConstString> param_and_qual_matches;
609  std::vector<ConstString> param_matches;
610  for (size_t i = 0; i < alternates.size(); i++) {
611  ConstString alternate_mangled_name = alternates[i];
612  Mangled mangled(alternate_mangled_name);
613  ConstString demangled = mangled.GetDemangledName();
614 
615  CPlusPlusLanguage::MethodName alternate_cpp_name(demangled);
616  if (!cpp_name.IsValid())
617  continue;
618 
619  if (alternate_cpp_name.GetArguments() == cpp_name.GetArguments()) {
620  if (alternate_cpp_name.GetQualifiers() == cpp_name.GetQualifiers())
621  param_and_qual_matches.push_back(alternate_mangled_name);
622  else
623  param_matches.push_back(alternate_mangled_name);
624  }
625  }
626 
627  if (param_and_qual_matches.size())
628  return param_and_qual_matches[0]; // It is assumed that there will be only
629  // one!
630  else if (param_matches.size())
631  return param_matches[0]; // Return one of them as a best match
632  else
633  return ConstString();
634 }
635 
636 static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
637  if (!cpp_category_sp)
638  return;
639 
640  TypeSummaryImpl::Flags stl_summary_flags;
641  stl_summary_flags.SetCascades(true)
642  .SetSkipPointers(false)
643  .SetSkipReferences(false)
644  .SetDontShowChildren(true)
645  .SetDontShowValue(true)
646  .SetShowMembersOneLiner(false)
647  .SetHideItemNames(false);
648 
649  AddCXXSummary(cpp_category_sp,
651  "std::string summary provider",
652  ConstString("^std::__[[:alnum:]]+::string$"), stl_summary_flags,
653  true);
654  AddCXXSummary(cpp_category_sp,
656  "std::string summary provider",
657  ConstString("^std::__[[:alnum:]]+::basic_string<char, "
658  "std::__[[:alnum:]]+::char_traits<char>, "
659  "std::__[[:alnum:]]+::allocator<char> >$"),
660  stl_summary_flags, true);
661  AddCXXSummary(cpp_category_sp,
663  "std::string summary provider",
664  ConstString("^std::__[[:alnum:]]+::basic_string<unsigned char, "
665  "std::__[[:alnum:]]+::char_traits<unsigned char>, "
666  "std::__[[:alnum:]]+::allocator<unsigned char> >$"),
667  stl_summary_flags, true);
668 
669  AddCXXSummary(cpp_category_sp,
671  "std::u16string summary provider",
672  ConstString("^std::__[[:alnum:]]+::basic_string<char16_t, "
673  "std::__[[:alnum:]]+::char_traits<char16_t>, "
674  "std::__[[:alnum:]]+::allocator<char16_t> >$"),
675  stl_summary_flags, true);
676 
677  AddCXXSummary(cpp_category_sp,
679  "std::u32string summary provider",
680  ConstString("^std::__[[:alnum:]]+::basic_string<char32_t, "
681  "std::__[[:alnum:]]+::char_traits<char32_t>, "
682  "std::__[[:alnum:]]+::allocator<char32_t> >$"),
683  stl_summary_flags, true);
684 
687  "std::wstring summary provider",
688  ConstString("^std::__[[:alnum:]]+::wstring$"), stl_summary_flags, true);
689  AddCXXSummary(cpp_category_sp,
691  "std::wstring summary provider",
692  ConstString("^std::__[[:alnum:]]+::basic_string<wchar_t, "
693  "std::__[[:alnum:]]+::char_traits<wchar_t>, "
694  "std::__[[:alnum:]]+::allocator<wchar_t> >$"),
695  stl_summary_flags, true);
696 
697  AddCXXSummary(cpp_category_sp,
699  "std::string_view summary provider",
700  ConstString("^std::__[[:alnum:]]+::string_view$"),
701  stl_summary_flags, true);
702  AddCXXSummary(cpp_category_sp,
704  "std::string_view summary provider",
705  ConstString("^std::__[[:alnum:]]+::basic_string_view<char, "
706  "std::__[[:alnum:]]+::char_traits<char> >$"),
707  stl_summary_flags, true);
709  cpp_category_sp,
711  "std::string_view summary provider",
712  ConstString("^std::__[[:alnum:]]+::basic_string_view<unsigned char, "
713  "std::__[[:alnum:]]+::char_traits<unsigned char> >$"),
714  stl_summary_flags, true);
715 
716  AddCXXSummary(cpp_category_sp,
718  "std::u16string_view summary provider",
719  ConstString("^std::__[[:alnum:]]+::basic_string_view<char16_t, "
720  "std::__[[:alnum:]]+::char_traits<char16_t> >$"),
721  stl_summary_flags, true);
722 
723  AddCXXSummary(cpp_category_sp,
725  "std::u32string_view summary provider",
726  ConstString("^std::__[[:alnum:]]+::basic_string_view<char32_t, "
727  "std::__[[:alnum:]]+::char_traits<char32_t> >$"),
728  stl_summary_flags, true);
729 
730  AddCXXSummary(cpp_category_sp,
732  "std::wstring_view summary provider",
733  ConstString("^std::__[[:alnum:]]+::wstring_view$"),
734  stl_summary_flags, true);
735  AddCXXSummary(cpp_category_sp,
737  "std::wstring_view summary provider",
738  ConstString("^std::__[[:alnum:]]+::basic_string_view<wchar_t, "
739  "std::__[[:alnum:]]+::char_traits<wchar_t> >$"),
740  stl_summary_flags, true);
741 
742  SyntheticChildren::Flags stl_synth_flags;
743  stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
744  false);
745  SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
746  stl_deref_flags.SetFrontEndWantsDereference();
747 
749  cpp_category_sp,
751  "libc++ std::bitset synthetic children",
752  ConstString("^std::__[[:alnum:]]+::bitset<.+>(( )?&)?$"), stl_deref_flags,
753  true);
755  cpp_category_sp,
757  "libc++ std::vector synthetic children",
758  ConstString("^std::__[[:alnum:]]+::vector<.+>(( )?&)?$"), stl_deref_flags,
759  true);
761  cpp_category_sp,
763  "libc++ std::forward_list synthetic children",
764  ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
765  stl_synth_flags, true);
767  cpp_category_sp,
769  "libc++ std::list synthetic children",
770  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
771  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
772  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
773  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
774  stl_deref_flags, true);
776  cpp_category_sp,
778  "libc++ std::map synthetic children",
779  ConstString("^std::__[[:alnum:]]+::map<.+> >(( )?&)?$"), stl_synth_flags,
780  true);
782  cpp_category_sp,
784  "libc++ std::set synthetic children",
785  ConstString("^std::__[[:alnum:]]+::set<.+> >(( )?&)?$"), stl_deref_flags,
786  true);
788  cpp_category_sp,
790  "libc++ std::multiset synthetic children",
791  ConstString("^std::__[[:alnum:]]+::multiset<.+> >(( )?&)?$"),
792  stl_deref_flags, true);
794  cpp_category_sp,
796  "libc++ std::multimap synthetic children",
797  ConstString("^std::__[[:alnum:]]+::multimap<.+> >(( )?&)?$"),
798  stl_synth_flags, true);
800  cpp_category_sp,
802  "libc++ std::unordered containers synthetic children",
803  ConstString("^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$"),
804  stl_synth_flags, true);
806  cpp_category_sp,
808  "libc++ std::initializer_list synthetic children",
809  ConstString("^std::initializer_list<.+>(( )?&)?$"), stl_synth_flags,
810  true);
812  "libc++ std::queue synthetic children",
813  ConstString("^std::__[[:alnum:]]+::queue<.+>(( )?&)?$"),
814  stl_synth_flags, true);
816  "libc++ std::tuple synthetic children",
817  ConstString("^std::__[[:alnum:]]+::tuple<.*>(( )?&)?$"),
818  stl_synth_flags, true);
820  "libc++ std::optional synthetic children",
821  ConstString("^std::__[[:alnum:]]+::optional<.+>(( )?&)?$"),
822  stl_synth_flags, true);
824  "libc++ std::variant synthetic children",
825  ConstString("^std::__[[:alnum:]]+::variant<.+>(( )?&)?$"),
826  stl_synth_flags, true);
828  cpp_category_sp,
830  "libc++ std::atomic synthetic children",
831  ConstString("^std::__[[:alnum:]]+::atomic<.+>$"), stl_synth_flags, true);
833  cpp_category_sp,
835  "libc++ std::span synthetic children",
836  ConstString("^std::__[[:alnum:]]+::span<.+>(( )?&)?$"), stl_deref_flags,
837  true);
839  cpp_category_sp,
841  "libc++ std::ranges::ref_view synthetic children",
842  ConstString("^std::__[[:alnum:]]+::ranges::ref_view<.+>(( )?&)?$"),
843  stl_deref_flags, true);
844 
845  cpp_category_sp->AddTypeSynthetic(
846  "^(std::__[[:alnum:]]+::)deque<.+>(( )?&)?$", eFormatterMatchRegex,
847  SyntheticChildrenSP(new ScriptedSyntheticChildren(
848  stl_synth_flags,
849  "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
850 
852  cpp_category_sp,
854  "shared_ptr synthetic children",
855  ConstString("^(std::__[[:alnum:]]+::)shared_ptr<.+>(( )?&)?$"),
856  stl_synth_flags, true);
857 
858  ConstString libcxx_std_unique_ptr_regex(
859  "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$");
861  cpp_category_sp,
863  "unique_ptr synthetic children", libcxx_std_unique_ptr_regex,
864  stl_synth_flags, true);
865 
867  cpp_category_sp,
869  "weak_ptr synthetic children",
870  ConstString("^(std::__[[:alnum:]]+::)weak_ptr<.+>(( )?&)?$"),
871  stl_synth_flags, true);
872  AddCXXSummary(cpp_category_sp,
874  "libc++ std::function summary provider",
875  ConstString("^std::__[[:alnum:]]+::function<.+>$"),
876  stl_summary_flags, true);
877 
878  ConstString libcxx_std_coroutine_handle_regex(
879  "^std::__[[:alnum:]]+::coroutine_handle<.+>(( )?&)?$");
881  cpp_category_sp,
883  "coroutine_handle synthetic children", libcxx_std_coroutine_handle_regex,
884  stl_deref_flags, true);
885 
886  stl_summary_flags.SetDontShowChildren(false);
887  stl_summary_flags.SetSkipPointers(false);
888  AddCXXSummary(cpp_category_sp,
890  "libc++ std::bitset summary provider",
891  ConstString("^std::__[[:alnum:]]+::bitset<.+>(( )?&)?$"),
892  stl_summary_flags, true);
893  AddCXXSummary(cpp_category_sp,
895  "libc++ std::vector summary provider",
896  ConstString("^std::__[[:alnum:]]+::vector<.+>(( )?&)?$"),
897  stl_summary_flags, true);
898  AddCXXSummary(cpp_category_sp,
900  "libc++ std::list summary provider",
901  ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
902  stl_summary_flags, true);
905  "libc++ std::list summary provider",
906  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
907  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
908  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
909  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
910  stl_summary_flags, true);
911  AddCXXSummary(cpp_category_sp,
913  "libc++ std::map summary provider",
914  ConstString("^std::__[[:alnum:]]+::map<.+>(( )?&)?$"),
915  stl_summary_flags, true);
916  AddCXXSummary(cpp_category_sp,
918  "libc++ std::deque summary provider",
919  ConstString("^std::__[[:alnum:]]+::deque<.+>(( )?&)?$"),
920  stl_summary_flags, true);
921  AddCXXSummary(cpp_category_sp,
923  "libc++ std::queue summary provider",
924  ConstString("^std::__[[:alnum:]]+::queue<.+>(( )?&)?$"),
925  stl_summary_flags, true);
926  AddCXXSummary(cpp_category_sp,
928  "libc++ std::set summary provider",
929  ConstString("^std::__[[:alnum:]]+::set<.+>(( )?&)?$"),
930  stl_summary_flags, true);
931  AddCXXSummary(cpp_category_sp,
933  "libc++ std::multiset summary provider",
934  ConstString("^std::__[[:alnum:]]+::multiset<.+>(( )?&)?$"),
935  stl_summary_flags, true);
936  AddCXXSummary(cpp_category_sp,
938  "libc++ std::multimap summary provider",
939  ConstString("^std::__[[:alnum:]]+::multimap<.+>(( )?&)?$"),
940  stl_summary_flags, true);
943  "libc++ std::unordered containers summary provider",
944  ConstString("^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$"),
945  stl_summary_flags, true);
947  "libc++ std::tuple summary provider",
948  ConstString("^std::__[[:alnum:]]+::tuple<.*>(( )?&)?$"),
949  stl_summary_flags, true);
950  AddCXXSummary(cpp_category_sp,
952  "libc++ std::atomic summary provider",
953  ConstString("^std::__[[:alnum:]]+::atomic<.+>$"),
954  stl_summary_flags, true);
955  AddCXXSummary(cpp_category_sp,
957  "libc++ std::optional summary provider",
958  ConstString("^std::__[[:alnum:]]+::optional<.+>(( )?&)?$"),
959  stl_summary_flags, true);
960  AddCXXSummary(cpp_category_sp,
962  "libc++ std::variant summary provider",
963  ConstString("^std::__[[:alnum:]]+::variant<.+>(( )?&)?$"),
964  stl_summary_flags, true);
965  AddCXXSummary(cpp_category_sp,
967  "libc++ std::span summary provider",
968  ConstString("^std::__[[:alnum:]]+::span<.+>(( )?&)?$"),
969  stl_summary_flags, true);
970 
971  stl_summary_flags.SetSkipPointers(true);
972 
973  AddCXXSummary(cpp_category_sp,
975  "libc++ std::shared_ptr summary provider",
976  ConstString("^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"),
977  stl_summary_flags, true);
978  AddCXXSummary(cpp_category_sp,
980  "libc++ std::weak_ptr summary provider",
981  ConstString("^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"),
982  stl_summary_flags, true);
983  AddCXXSummary(cpp_category_sp,
985  "libc++ std::unique_ptr summary provider",
986  libcxx_std_unique_ptr_regex, stl_summary_flags, true);
987 
988  AddCXXSummary(cpp_category_sp,
990  "libc++ std::coroutine_handle summary provider",
991  libcxx_std_coroutine_handle_regex, stl_summary_flags, true);
992 
994  cpp_category_sp,
996  "std::vector iterator synthetic children",
997  ConstString("^std::__[[:alnum:]]+::__wrap_iter<.+>$"), stl_synth_flags,
998  true);
999 
1001  cpp_category_sp,
1003  "std::map iterator synthetic children",
1004  ConstString("^std::__[[:alnum:]]+::__map_(const_)?iterator<.+>$"), stl_synth_flags,
1005  true);
1006 
1008  cpp_category_sp,
1011  "std::unordered_map iterator synthetic children",
1012  ConstString("^std::__[[:alnum:]]+::__hash_map_(const_)?iterator<.+>$"),
1013  stl_synth_flags, true);
1014 }
1015 
1016 static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
1017  if (!cpp_category_sp)
1018  return;
1019 
1020  TypeSummaryImpl::Flags stl_summary_flags;
1021  stl_summary_flags.SetCascades(true)
1022  .SetSkipPointers(false)
1023  .SetSkipReferences(false)
1024  .SetDontShowChildren(true)
1025  .SetDontShowValue(true)
1026  .SetShowMembersOneLiner(false)
1027  .SetHideItemNames(false);
1028 
1029  lldb::TypeSummaryImplSP std_string_summary_sp(
1030  new StringSummaryFormat(stl_summary_flags, "${var._M_dataplus._M_p}"));
1031 
1032  lldb::TypeSummaryImplSP cxx11_string_summary_sp(new CXXFunctionSummaryFormat(
1033  stl_summary_flags, LibStdcppStringSummaryProvider,
1034  "libstdc++ c++11 std::string summary provider"));
1035  lldb::TypeSummaryImplSP cxx11_wstring_summary_sp(new CXXFunctionSummaryFormat(
1036  stl_summary_flags, LibStdcppWStringSummaryProvider,
1037  "libstdc++ c++11 std::wstring summary provider"));
1038 
1039  cpp_category_sp->AddTypeSummary("std::string", eFormatterMatchExact,
1040  std_string_summary_sp);
1041  cpp_category_sp->AddTypeSummary("std::basic_string<char>",
1042  eFormatterMatchRegex, std_string_summary_sp);
1043  cpp_category_sp->AddTypeSummary(
1044  "std::basic_string<char,std::char_traits<char>,std::allocator<char> >",
1045  eFormatterMatchExact, std_string_summary_sp);
1046  cpp_category_sp->AddTypeSummary(
1047  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >",
1048  eFormatterMatchExact, std_string_summary_sp);
1049 
1050  cpp_category_sp->AddTypeSummary("std::__cxx11::string", eFormatterMatchExact,
1051  cxx11_string_summary_sp);
1052  cpp_category_sp->AddTypeSummary(
1053  "std::__cxx11::basic_string<char, std::char_traits<char>, "
1054  "std::allocator<char> >",
1055  eFormatterMatchExact, cxx11_string_summary_sp);
1056  cpp_category_sp->AddTypeSummary("std::__cxx11::basic_string<unsigned char, "
1057  "std::char_traits<unsigned char>, "
1058  "std::allocator<unsigned char> >",
1060  cxx11_string_summary_sp);
1061 
1062  // making sure we force-pick the summary for printing wstring (_M_p is a
1063  // wchar_t*)
1064  lldb::TypeSummaryImplSP std_wstring_summary_sp(
1065  new StringSummaryFormat(stl_summary_flags, "${var._M_dataplus._M_p%S}"));
1066 
1067  cpp_category_sp->AddTypeSummary("std::wstring", eFormatterMatchExact,
1068  std_wstring_summary_sp);
1069  cpp_category_sp->AddTypeSummary("std::basic_string<wchar_t>",
1070  eFormatterMatchExact, std_wstring_summary_sp);
1071  cpp_category_sp->AddTypeSummary("std::basic_string<wchar_t,std::char_traits<"
1072  "wchar_t>,std::allocator<wchar_t> >",
1073  eFormatterMatchExact, std_wstring_summary_sp);
1074  cpp_category_sp->AddTypeSummary(
1075  "std::basic_string<wchar_t, std::char_traits<wchar_t>, "
1076  "std::allocator<wchar_t> >",
1077  eFormatterMatchExact, std_wstring_summary_sp);
1078 
1079  cpp_category_sp->AddTypeSummary("std::__cxx11::wstring", eFormatterMatchExact,
1080  cxx11_wstring_summary_sp);
1081  cpp_category_sp->AddTypeSummary(
1082  "std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, "
1083  "std::allocator<wchar_t> >",
1084  eFormatterMatchExact, cxx11_wstring_summary_sp);
1085 
1086  SyntheticChildren::Flags stl_synth_flags;
1087  stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
1088  false);
1089  SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
1090  stl_deref_flags.SetFrontEndWantsDereference();
1091 
1092  cpp_category_sp->AddTypeSynthetic(
1093  "^std::vector<.+>(( )?&)?$", eFormatterMatchRegex,
1094  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1095  stl_synth_flags,
1096  "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
1097  cpp_category_sp->AddTypeSynthetic(
1098  "^std::map<.+> >(( )?&)?$", eFormatterMatchRegex,
1099  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1100  stl_synth_flags,
1101  "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
1102  cpp_category_sp->AddTypeSynthetic(
1103  "^std::deque<.+>(( )?&)?$", eFormatterMatchRegex,
1104  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1105  stl_deref_flags,
1106  "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider")));
1107  cpp_category_sp->AddTypeSynthetic(
1108  "^std::set<.+> >(( )?&)?$", eFormatterMatchRegex,
1109  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1110  stl_deref_flags,
1111  "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
1112  cpp_category_sp->AddTypeSynthetic(
1113  "^std::multimap<.+> >(( )?&)?$", eFormatterMatchRegex,
1114  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1115  stl_deref_flags,
1116  "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
1117  cpp_category_sp->AddTypeSynthetic(
1118  "^std::multiset<.+> >(( )?&)?$", eFormatterMatchRegex,
1119  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1120  stl_deref_flags,
1121  "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
1122  cpp_category_sp->AddTypeSynthetic(
1123  "^std::unordered_(multi)?(map|set)<.+> >$", eFormatterMatchRegex,
1124  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1125  stl_deref_flags,
1126  "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
1127  cpp_category_sp->AddTypeSynthetic(
1128  "^std::(__cxx11::)?list<.+>(( )?&)?$", eFormatterMatchRegex,
1129  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1130  stl_deref_flags,
1131  "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
1132  cpp_category_sp->AddTypeSynthetic(
1133  "^std::(__cxx11::)?forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
1134  SyntheticChildrenSP(new ScriptedSyntheticChildren(
1135  stl_synth_flags,
1136  "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
1137 
1138  stl_summary_flags.SetDontShowChildren(false);
1139  stl_summary_flags.SetSkipPointers(false);
1140  cpp_category_sp->AddTypeSummary("^std::bitset<.+>(( )?&)?$",
1142  TypeSummaryImplSP(new StringSummaryFormat(
1143  stl_summary_flags, "size=${svar%#}")));
1144  cpp_category_sp->AddTypeSummary("^std::vector<.+>(( )?&)?$",
1146  TypeSummaryImplSP(new StringSummaryFormat(
1147  stl_summary_flags, "size=${svar%#}")));
1148  cpp_category_sp->AddTypeSummary("^std::map<.+> >(( )?&)?$",
1150  TypeSummaryImplSP(new StringSummaryFormat(
1151  stl_summary_flags, "size=${svar%#}")));
1152  cpp_category_sp->AddTypeSummary("^std::set<.+> >(( )?&)?$",
1154  TypeSummaryImplSP(new StringSummaryFormat(
1155  stl_summary_flags, "size=${svar%#}")));
1156  cpp_category_sp->AddTypeSummary("^std::deque<.+>(( )?&)?$",
1158  TypeSummaryImplSP(new StringSummaryFormat(
1159  stl_summary_flags, "size=${svar%#}")));
1160  cpp_category_sp->AddTypeSummary("^std::multimap<.+> >(( )?&)?$",
1162  TypeSummaryImplSP(new StringSummaryFormat(
1163  stl_summary_flags, "size=${svar%#}")));
1164  cpp_category_sp->AddTypeSummary("^std::multiset<.+> >(( )?&)?$",
1166  TypeSummaryImplSP(new StringSummaryFormat(
1167  stl_summary_flags, "size=${svar%#}")));
1168  cpp_category_sp->AddTypeSummary("^std::unordered_(multi)?(map|set)<.+> >$",
1170  TypeSummaryImplSP(new StringSummaryFormat(
1171  stl_summary_flags, "size=${svar%#}")));
1172  cpp_category_sp->AddTypeSummary("^std::(__cxx11::)?list<.+>(( )?&)?$",
1174  TypeSummaryImplSP(new StringSummaryFormat(
1175  stl_summary_flags, "size=${svar%#}")));
1176  cpp_category_sp->AddTypeSummary(
1177  "^std::(__cxx11::)?forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
1178  TypeSummaryImplSP(new ScriptSummaryFormat(
1179  stl_summary_flags,
1180  "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
1181 
1183  cpp_category_sp,
1185  "std::vector iterator synthetic children",
1186  ConstString("^__gnu_cxx::__normal_iterator<.+>$"), stl_synth_flags, true);
1187 
1189  cpp_category_sp,
1191  "std::map iterator synthetic children",
1192  ConstString("^std::_Rb_tree_iterator<.+>$"), stl_synth_flags, true);
1193 
1195  cpp_category_sp,
1197  "std::unique_ptr synthetic children",
1198  ConstString("^std::unique_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1200  cpp_category_sp,
1202  "std::shared_ptr synthetic children",
1203  ConstString("^std::shared_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1205  cpp_category_sp,
1207  "std::weak_ptr synthetic children",
1208  ConstString("^std::weak_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1210  cpp_category_sp,
1212  "std::tuple synthetic children", ConstString("^std::tuple<.+>(( )?&)?$"),
1213  stl_synth_flags, true);
1214 
1215  ConstString libstdcpp_std_coroutine_handle_regex(
1216  "^std::coroutine_handle<.+>(( )?&)?$");
1218  cpp_category_sp,
1220  "std::coroutine_handle synthetic children",
1221  libstdcpp_std_coroutine_handle_regex, stl_deref_flags, true);
1222 
1224  cpp_category_sp,
1226  "std::bitset synthetic child", ConstString("^std::bitset<.+>(( )?&)?$"),
1227  stl_deref_flags, true);
1228 
1230  cpp_category_sp,
1232  "std::optional synthetic child",
1233  ConstString("^std::optional<.+>(( )?&)?$"), stl_deref_flags, true);
1234 
1235  AddCXXSummary(cpp_category_sp,
1237  "libstdc++ std::unique_ptr summary provider",
1238  ConstString("^std::unique_ptr<.+>(( )?&)?$"), stl_summary_flags,
1239  true);
1240  AddCXXSummary(cpp_category_sp,
1242  "libstdc++ std::shared_ptr summary provider",
1243  ConstString("^std::shared_ptr<.+>(( )?&)?$"), stl_summary_flags,
1244  true);
1245  AddCXXSummary(cpp_category_sp,
1247  "libstdc++ std::weak_ptr summary provider",
1248  ConstString("^std::weak_ptr<.+>(( )?&)?$"), stl_summary_flags,
1249  true);
1250  AddCXXSummary(cpp_category_sp,
1252  "libstdc++ std::coroutine_handle summary provider",
1253  libstdcpp_std_coroutine_handle_regex, stl_summary_flags, true);
1254  AddCXXSummary(
1256  "libstd++ std::optional summary provider",
1257  ConstString("^std::optional<.+>(( )?&)?$"), stl_summary_flags, true);
1258 }
1259 
1260 static void LoadSystemFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
1261  if (!cpp_category_sp)
1262  return;
1263 
1264  TypeSummaryImpl::Flags string_flags;
1265  string_flags.SetCascades(true)
1266  .SetSkipPointers(true)
1267  .SetSkipReferences(false)
1268  .SetDontShowChildren(true)
1269  .SetDontShowValue(false)
1270  .SetShowMembersOneLiner(false)
1271  .SetHideItemNames(false);
1272 
1273  TypeSummaryImpl::Flags string_array_flags;
1274  string_array_flags.SetCascades(true)
1275  .SetSkipPointers(true)
1276  .SetSkipReferences(false)
1277  .SetDontShowChildren(true)
1278  .SetDontShowValue(true)
1279  .SetShowMembersOneLiner(false)
1280  .SetHideItemNames(false);
1281 
1282  AddCXXSummary(
1284  "char8_t * summary provider", ConstString("char8_t *"), string_flags);
1285  AddCXXSummary(cpp_category_sp,
1287  "char8_t [] summary provider",
1288  ConstString("char8_t ?\\[[0-9]+\\]"), string_array_flags, true);
1289 
1290  AddCXXSummary(
1292  "char16_t * summary provider", ConstString("char16_t *"), string_flags);
1293  AddCXXSummary(cpp_category_sp,
1295  "char16_t [] summary provider",
1296  ConstString("char16_t ?\\[[0-9]+\\]"), string_array_flags, true);
1297 
1298  AddCXXSummary(
1300  "char32_t * summary provider", ConstString("char32_t *"), string_flags);
1301  AddCXXSummary(cpp_category_sp,
1303  "char32_t [] summary provider",
1304  ConstString("char32_t ?\\[[0-9]+\\]"), string_array_flags, true);
1305 
1306  AddCXXSummary(
1308  "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
1309  AddCXXSummary(cpp_category_sp,
1311  "wchar_t * summary provider",
1312  ConstString("wchar_t ?\\[[0-9]+\\]"), string_array_flags, true);
1313 
1314  AddCXXSummary(
1316  "unichar * summary provider", ConstString("unichar *"), string_flags);
1317 
1318  TypeSummaryImpl::Flags widechar_flags;
1319  widechar_flags.SetDontShowValue(true)
1320  .SetSkipPointers(true)
1321  .SetSkipReferences(false)
1322  .SetCascades(true)
1323  .SetDontShowChildren(true)
1324  .SetHideItemNames(true)
1325  .SetShowMembersOneLiner(false);
1326 
1328  "char8_t summary provider", ConstString("char8_t"),
1329  widechar_flags);
1330  AddCXXSummary(
1332  "char16_t summary provider", ConstString("char16_t"), widechar_flags);
1333  AddCXXSummary(
1335  "char32_t summary provider", ConstString("char32_t"), widechar_flags);
1337  "wchar_t summary provider", ConstString("wchar_t"),
1338  widechar_flags);
1339 
1340  AddCXXSummary(
1342  "unichar summary provider", ConstString("unichar"), widechar_flags);
1343 }
1344 
1345 std::unique_ptr<Language::TypeScavenger> CPlusPlusLanguage::GetTypeScavenger() {
1346  class CPlusPlusTypeScavenger : public Language::ImageListTypeScavenger {
1347  public:
1348  CompilerType AdjustForInclusion(CompilerType &candidate) override {
1349  LanguageType lang_type(candidate.GetMinimumLanguage());
1350  if (!Language::LanguageIsC(lang_type) &&
1351  !Language::LanguageIsCPlusPlus(lang_type))
1352  return CompilerType();
1353  if (candidate.IsTypedefType())
1354  return candidate.GetTypedefedType();
1355  return candidate;
1356  }
1357  };
1358 
1359  return std::unique_ptr<TypeScavenger>(new CPlusPlusTypeScavenger());
1360 }
1361 
1362 lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
1363  static llvm::once_flag g_initialize;
1364  static TypeCategoryImplSP g_category;
1365 
1366  llvm::call_once(g_initialize, [this]() -> void {
1367  DataVisualization::Categories::GetCategory(ConstString(GetPluginName()),
1368  g_category);
1369  if (g_category) {
1370  LoadLibStdcppFormatters(g_category);
1371  LoadLibCxxFormatters(g_category);
1372  LoadSystemFormatters(g_category);
1373  }
1374  });
1375  return g_category;
1376 }
1377 
1379 CPlusPlusLanguage::GetHardcodedSummaries() {
1380  static llvm::once_flag g_initialize;
1381  static ConstString g_vectortypes("VectorTypes");
1382  static HardcodedFormatters::HardcodedSummaryFinder g_formatters;
1383 
1384  llvm::call_once(g_initialize, []() -> void {
1385  g_formatters.push_back(
1388  static CXXFunctionSummaryFormat::SharedPointer formatter_sp(
1392  "Function pointer summary provider"));
1393  if (valobj.GetCompilerType().IsFunctionPointerType()) {
1394  return formatter_sp;
1395  }
1396  return nullptr;
1397  });
1398  g_formatters.push_back(
1401  static CXXFunctionSummaryFormat::SharedPointer formatter_sp(
1404  .SetCascades(true)
1405  .SetDontShowChildren(true)
1406  .SetHideItemNames(true)
1407  .SetShowMembersOneLiner(true)
1408  .SetSkipPointers(true)
1409  .SetSkipReferences(false),
1411  "vector_type pointer summary provider"));
1412  if (valobj.GetCompilerType().IsVectorType()) {
1413  if (fmt_mgr.GetCategory(g_vectortypes)->IsEnabled())
1414  return formatter_sp;
1415  }
1416  return nullptr;
1417  });
1418  g_formatters.push_back(
1421  static CXXFunctionSummaryFormat::SharedPointer formatter_sp(
1424  .SetCascades(true)
1425  .SetDontShowChildren(true)
1426  .SetHideItemNames(true)
1427  .SetShowMembersOneLiner(true)
1428  .SetSkipPointers(true)
1429  .SetSkipReferences(false),
1431  "block pointer summary provider"));
1432  if (valobj.GetCompilerType().IsBlockPointerType()) {
1433  return formatter_sp;
1434  }
1435  return nullptr;
1436  });
1437  });
1438 
1439  return g_formatters;
1440 }
1441 
1443 CPlusPlusLanguage::GetHardcodedSynthetics() {
1444  static llvm::once_flag g_initialize;
1445  static ConstString g_vectortypes("VectorTypes");
1447 
1448  llvm::call_once(g_initialize, []() -> void {
1449  g_formatters.push_back([](lldb_private::ValueObject &valobj,
1452  static CXXSyntheticChildren::SharedPointer formatter_sp(
1455  .SetCascades(true)
1456  .SetSkipPointers(true)
1457  .SetSkipReferences(true)
1458  .SetNonCacheable(true),
1459  "vector_type synthetic children",
1461  if (valobj.GetCompilerType().IsVectorType()) {
1462  if (fmt_mgr.GetCategory(g_vectortypes)->IsEnabled())
1463  return formatter_sp;
1464  }
1465  return nullptr;
1466  });
1467  g_formatters.push_back([](lldb_private::ValueObject &valobj,
1470  static CXXSyntheticChildren::SharedPointer formatter_sp(
1473  .SetCascades(true)
1474  .SetSkipPointers(true)
1475  .SetSkipReferences(true)
1476  .SetNonCacheable(true),
1477  "block pointer synthetic children",
1479  if (valobj.GetCompilerType().IsBlockPointerType()) {
1480  return formatter_sp;
1481  }
1482  return nullptr;
1483  });
1484  });
1485 
1486  return g_formatters;
1487 }
1488 
1489 bool CPlusPlusLanguage::IsNilReference(ValueObject &valobj) {
1490  if (!Language::LanguageIsCPlusPlus(valobj.GetObjectRuntimeLanguage()) ||
1491  !valobj.IsPointerType())
1492  return false;
1493  bool canReadValue = true;
1494  bool isZero = valobj.GetValueAsUnsigned(0, &canReadValue) == 0;
1495  return canReadValue && isZero;
1496 }
1497 
1498 bool CPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const {
1499  const auto suffixes = {".cpp", ".cxx", ".c++", ".cc", ".c",
1500  ".h", ".hh", ".hpp", ".hxx", ".h++"};
1501  for (auto suffix : suffixes) {
1502  if (file_path.endswith_insensitive(suffix))
1503  return true;
1504  }
1505 
1506  // Check if we're in a STL path (where the files usually have no extension
1507  // that we could check for.
1508  return file_path.contains("/usr/include/c++/");
1509 }
1510 
1511 bool CPlusPlusLanguage::GetFunctionDisplayName(
1512  const SymbolContext *sc, const ExecutionContext *exe_ctx,
1513  FunctionNameRepresentation representation, Stream &s) {
1514  switch (representation) {
1515  case FunctionNameRepresentation::eNameWithArgs: {
1516  // Print the function name with arguments in it
1517  if (sc->function) {
1518  ExecutionContextScope *exe_scope =
1519  exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
1520  const char *cstr = sc->function->GetName().AsCString(nullptr);
1521  if (cstr) {
1522  const InlineFunctionInfo *inline_info = nullptr;
1523  VariableListSP variable_list_sp;
1524  bool get_function_vars = true;
1525  if (sc->block) {
1526  Block *inline_block = sc->block->GetContainingInlinedBlock();
1527 
1528  if (inline_block) {
1529  get_function_vars = false;
1530  inline_info = sc->block->GetInlinedFunctionInfo();
1531  if (inline_info)
1532  variable_list_sp = inline_block->GetBlockVariableList(true);
1533  }
1534  }
1535 
1536  if (get_function_vars) {
1537  variable_list_sp =
1538  sc->function->GetBlock(true).GetBlockVariableList(true);
1539  }
1540 
1541  if (inline_info) {
1542  s.PutCString(cstr);
1543  s.PutCString(" [inlined] ");
1544  cstr = inline_info->GetName().GetCString();
1545  }
1546 
1547  VariableList args;
1548  if (variable_list_sp)
1550  args);
1551  if (args.GetSize() > 0) {
1552  if (!PrettyPrintFunctionNameWithArgs(s, cstr, exe_scope, args))
1553  return false;
1554  } else {
1555  s.PutCString(cstr);
1556  }
1557  return true;
1558  }
1559  } else if (sc->symbol) {
1560  const char *cstr = sc->symbol->GetName().AsCString(nullptr);
1561  if (cstr) {
1562  s.PutCString(cstr);
1563  return true;
1564  }
1565  }
1566  } break;
1567  default:
1568  return false;
1569  }
1570 
1571  return false;
1572 }
lldb_private::SyntheticChildren::Flags
Definition: TypeSynthetic.h:134
RegularExpression.h
lldb_private::ScriptedSyntheticChildren
Definition: TypeSynthetic.h:387
lldb_private::SymbolFile
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:46
lldb_private::SymbolContext::block
Block * block
The Block for a given query.
Definition: SymbolContext.h:321
lldb_private::ValueObject::GetValueAsUnsigned
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
Definition: ValueObject.cpp:1098
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxUnorderedMap.cpp:257
LibCxxVariant.h
lldb_private::formatters::Char32SummaryProvider
bool Char32SummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:164
lldb_private::SyntheticChildren::Flags::SetSkipReferences
Flags & SetSkipReferences(bool value=true)
Definition: TypeSynthetic.h:189
Mangled.h
lldb_private::Block::GetBlockVariableList
lldb::VariableListSP GetBlockVariableList(bool can_create)
Get the variable list for this block only.
Definition: Block.cpp:399
Coroutines.h
lldb_private::formatters::LibcxxStringSummaryProviderUTF16
bool LibcxxStringSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:987
lldb_private::formatters::WCharSummaryProvider
bool WCharSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:169
CPlusPlusLanguage.h
VectorType.h
lldb_private::InlineFunctionInfo
Definition: Function.h:125
lldb_private::FormatManager
Definition: FormatManager.h:36
lldb_private::formatters::Char16StringSummaryProvider
bool Char16StringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:102
lldb_private::TypeSummaryImpl::Flags::SetDontShowChildren
Flags & SetDontShowChildren(bool value=true)
Definition: TypeSummary.h:121
lldb_private::VariableList::AppendVariablesWithScope
size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list, bool if_unique=true)
Definition: VariableList.cpp:128
lldb_private::CXXFunctionSummaryFormat
Definition: TypeSummary.h:306
lldb_private::formatters::LibcxxStringSummaryProviderUTF32
bool LibcxxStringSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:994
lldb_private::TypeSummaryImpl::Flags
Definition: TypeSummary.h:53
lldb_private::CompilerType::IsVectorType
bool IsVectorType(CompilerType *element_type=nullptr, uint64_t *size=nullptr) const
Definition: CompilerType.cpp:68
CPlusPlusNameParser.h
lldb_private::CPlusPlusNameParser::ParseAsFunctionDefinition
llvm::Optional< ParsedFunction > ParseAsFunctionDefinition()
Definition: CPlusPlusNameParser.cpp:23
ReverseFindMatchingChars
static bool ReverseFindMatchingChars(const llvm::StringRef &s, const llvm::StringRef &left_right_chars, size_t &left_pos, size_t &right_pos, size_t pos=llvm::StringRef::npos)
Definition: CPlusPlusLanguage.cpp:119
lldb_private::formatters::Char8SummaryProvider
bool Char8SummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:154
Module.h
lldb_private::VariableList::GetSize
size_t GetSize() const
Definition: VariableList.cpp:165
lldb_private::CPlusPlusLanguage::MethodName::GetScopeQualifiedName
std::string GetScopeQualifiedName()
Definition: CPlusPlusLanguage.cpp:304
lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxMap.cpp:460
lldb_private::CPlusPlusLanguage::MethodName::GetBasename
llvm::StringRef GetBasename()
Definition: CPlusPlusLanguage.cpp:274
lldb_private::CPlusPlusLanguage::MethodName::GetContext
llvm::StringRef GetContext()
Definition: CPlusPlusLanguage.cpp:280
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:192
lldb_private::ValueObject::IsPointerType
virtual bool IsPointerType()
Definition: ValueObject.h:382
lldb_private::CompilerType::IsFunctionPointerType
bool IsFunctionPointerType() const
Definition: CompilerType.cpp:149
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Args
Definition: Args.h:33
lldb_private::FormatManager::GetCategory
lldb::TypeCategoryImplSP GetCategory(const char *category_name=nullptr, bool can_create=true)
Definition: FormatManager.h:99
lldb_private::CPlusPlusNameParser
Definition: CPlusPlusNameParser.h:23
LoadLibStdcppFormatters
static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp)
Definition: CPlusPlusLanguage.cpp:1016
UniqueCStringMap.h
lldb_private::CPlusPlusLanguage::MethodName::GetQualifiers
llvm::StringRef GetQualifiers()
Definition: CPlusPlusLanguage.cpp:292
lldb_private::CPlusPlusLanguage::MethodName::GetArguments
llvm::StringRef GetArguments()
Definition: CPlusPlusLanguage.cpp:286
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::formatters::VectorTypeSummaryProvider
bool VectorTypeSummaryProvider(ValueObject &, Stream &, const TypeSummaryOptions &)
Definition: VectorType.cpp:252
lldb_private::VariableList
Definition: VariableList.h:18
lldb_private::formatters::GenericOptionalSummaryProvider
bool GenericOptionalSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: GenericOptional.cpp:19
lldb_private::CPlusPlusLanguage::MethodName::ContainsPath
bool ContainsPath(llvm::StringRef path)
Definition: CPlusPlusLanguage.cpp:328
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:384
lldb_private::HardcodedFormatters::HardcodedSummaryFinder
HardcodedFormatterFinders< TypeSummaryImpl > HardcodedSummaryFinder
Definition: FormatClasses.h:41
lldb_private::formatters::LibStdcppStringSummaryProvider
bool LibStdcppStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibStdcpp.cpp:231
lldb_private::formatters::LibcxxVariantSummaryProvider
bool LibcxxVariantSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxxVariant.cpp:148
lldb_private::formatters::LibcxxWStringSummaryProvider
bool LibcxxWStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:893
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
lldb_private::CXXFunctionSummaryFormat::SharedPointer
std::shared_ptr< CXXFunctionSummaryFormat > SharedPointer
Definition: TypeSummary.h:343
lldb_private::formatters::LibcxxStringViewSummaryProviderASCII
bool LibcxxStringViewSummaryProviderASCII(ValueObject &valueObj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1040
lldb_private::formatters::LibStdcppUniquePointerSummaryProvider
bool LibStdcppUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibStdcppUniquePointer.cpp:178
LoadLibCxxFormatters
static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp)
Definition: CPlusPlusLanguage.cpp:636
lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxVector.cpp:284
lldb_private::Function::GetName
ConstString GetName() const
Definition: Function.cpp:654
lldb_private::formatters::AddCXXSummary
void AddCXXSummary(TypeCategoryImpl::SharedPointer category_sp, CXXFunctionSummaryFormat::Callback funct, const char *description, ConstString type_name, TypeSummaryImpl::Flags flags, bool regex=false)
Add a summary that is implemented by a C++ callback.
Definition: FormattersHelpers.cpp:63
lldb_private::ConstString::GetStringRef
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:201
Log.h
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::formatters::LibcxxFunctionSummaryProvider
bool LibcxxFunctionSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:70
lldb_private::CPlusPlusNameParser::ParseAsFullName
llvm::Optional< ParsedName > ParseAsFullName()
Definition: CPlusPlusNameParser.cpp:50
lldb_private::TypeSummaryImpl::Flags::SetShowMembersOneLiner
Flags & SetShowMembersOneLiner(bool value=true)
Definition: TypeSummary.h:160
lldb_private::formatters::LibStdcppOptionalSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibStdcppOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: GenericOptional.cpp:125
lldb_private::formatters::VectorTypeSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * VectorTypeSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: VectorType.cpp:290
lldb_private::formatters::LibcxxSmartPointerSummaryProvider
bool LibcxxSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:118
lldb_private::Function::GetBlock
Block & GetBlock(bool can_create)
Get accessor for the block list.
Definition: Function.cpp:345
lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:534
lldb_private::SyntheticChildren::Flags::SetFrontEndWantsDereference
Flags & SetFrontEndWantsDereference(bool value=true)
Definition: TypeSynthetic.h:215
LoadSystemFormatters
static void LoadSystemFormatters(lldb::TypeCategoryImplSP cpp_category_sp)
Definition: CPlusPlusLanguage.cpp:1260
lldb_private::SymbolContext::function
Function * function
The Function for a given query.
Definition: SymbolContext.h:320
lldb_private::formatters::StdlibCoroutineHandleSummaryProvider
bool StdlibCoroutineHandleSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Summary provider for std::coroutine_handle<T> from libc++, libstdc++ and MSVC STL.
Definition: Coroutines.cpp:108
IsTrivialBasename
static bool IsTrivialBasename(const llvm::StringRef &basename)
Definition: CPlusPlusLanguage.cpp:148
lldb_private::ConstString
Definition: ConstString.h:39
MSVCUndecoratedNameParser.h
CxxStringTypes.h
lldb_private::ScriptSummaryFormat
Definition: TypeSummary.h:352
MSVCUndecoratedNameParser::ExtractContextAndIdentifier
static bool ExtractContextAndIdentifier(llvm::StringRef name, llvm::StringRef &context, llvm::StringRef &identifier)
Definition: MSVCUndecoratedNameParser.cpp:85
Generic.h
PrettyPrintFunctionNameWithArgs
static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, char const *full_name, ExecutionContextScope *exe_scope, VariableList const &args)
Writes out the function name in 'full_name' to 'out_stream' but replaces each argument type with the ...
Definition: CPlusPlusLanguage.cpp:179
Base
lldb_private::InlineFunctionInfo::GetName
ConstString GetName() const
Definition: Function.cpp:96
lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * StdlibCoroutineHandleSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: Coroutines.cpp:203
lldb_private::formatters::Char8StringSummaryProvider
bool Char8StringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:97
lldb_private::formatters::BlockPointerSummaryProvider
bool BlockPointerSummaryProvider(ValueObject &, Stream &, const TypeSummaryOptions &)
Definition: BlockPointer.cpp:172
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:498
lldb_private::CompilerType::IsTypedefType
bool IsTypedefType() const
Definition: CompilerType.cpp:263
lldb::eValueTypeVariableArgument
@ eValueTypeVariableArgument
function argument variables
Definition: lldb-enumerations.h:320
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxRangesRefView.cpp:76
lldb_private::formatters::LibcxxStringSummaryProviderASCII
bool LibcxxStringSummaryProviderASCII(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:980
lldb::eFormatterMatchExact
@ eFormatterMatchExact
Definition: lldb-enumerations.h:840
lldb_private::Stream::PutChar
size_t PutChar(char ch)
Definition: Stream.cpp:104
lldb_private::formatters::LibcxxInitializerListSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxInitializerList.cpp:117
lldb_private::formatters::LibcxxBitsetSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: GenericBitset.cpp:143
lldb_private::formatters::LibcxxAtomicSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxAtomicSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxAtomic.cpp:146
lldb_private::formatters::LibStdcppBitsetSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibStdcppBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: GenericBitset.cpp:135
VariableList.h
lldb_private::TypeSummaryImpl::Flags::SetCascades
Flags & SetCascades(bool value=true)
Definition: TypeSummary.h:82
lldb_private::SyntheticChildren::SharedPointer
std::shared_ptr< SyntheticChildren > SharedPointer
Definition: TypeSynthetic.h:264
lldb_private::formatters::LibcxxStringViewSummaryProviderUTF16
bool LibcxxStringViewSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1047
lldb_private::formatters::LibStdcppUniquePtrSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibStdcppUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibStdcppUniquePointer.cpp:172
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:500
lldb_private::TypeSummaryImpl::Flags::SetSkipPointers
Flags & SetSkipPointers(bool value=true)
Definition: TypeSummary.h:95
lldb_private::TypeSummaryImpl::Flags::SetDontShowValue
Flags & SetDontShowValue(bool value=true)
Definition: TypeSummary.h:147
lldb_private::formatters::Char32StringSummaryProvider
bool Char32StringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:107
lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibstdcppMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibStdcpp.cpp:154
lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:424
lldb_private::CompilerType::IsBlockPointerType
bool IsBlockPointerType(CompilerType *function_pointer_type_ptr=nullptr) const
Definition: CompilerType.cpp:156
lldb_private::formatters::LibStdcppWStringSummaryProvider
bool LibStdcppWStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibStdcpp.cpp:280
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::formatters::LibcxxContainerSummaryProvider
bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:712
DataVisualization.h
lldb_private::formatters::LibcxxStdForwardListSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:430
lldb_private::Block
Definition: Block.h:41
lldb_private::formatters::WCharStringSummaryProvider
bool WCharStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:112
lldb_private::formatters::LibcxxStdSpanSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxSpan.cpp:140
uint32_t
lldb_private::ExecutionContext::GetBestExecutionContextScope
ExecutionContextScope * GetBestExecutionContextScope() const
Definition: ExecutionContext.cpp:214
lldb_private::Language
Definition: Language.h:29
lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:652
lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:635
lldb_private::CPlusPlusLanguage::MethodName
Definition: CPlusPlusLanguage.h:28
lldb_private::formatters::LibcxxStringViewSummaryProviderUTF32
bool LibcxxStringViewSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1054
lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibStdcppSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibStdcpp.cpp:384
lldb_private::ValueObject::GetCompilerType
CompilerType GetCompilerType()
Definition: ValueObject.h:352
lldb_private::TypeSummaryImpl::SharedPointer
std::shared_ptr< TypeSummaryImpl > SharedPointer
Definition: TypeSummary.h:263
lldb_private::formatters::LibStdcppSmartPointerSummaryProvider
bool LibStdcppSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibStdcpp.cpp:390
lldb_private::formatters::LibStdcppTupleSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibStdcppTupleSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibStdcppTuple.cpp:108
lldb_private::formatters::LibcxxQueueFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxQueue.cpp:60
lldb_private::SymbolContext::module_sp
lldb::ModuleSP module_sp
The Module for a given query.
Definition: SymbolContext.h:318
PluginManager.h
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:215
LibCxxAtomic.h
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:337
lldb_private::formatters::LibcxxVariantFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxVariantFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
Definition: LibCxxVariant.cpp:281
lldb_private::CompilerType::GetTypedefedType
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
Definition: CompilerType.cpp:525
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:35
lldb_private::formatters::LibcxxUniquePointerSummaryProvider
bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:161
lldb_private::formatters
Definition: CXXFunctionPointer.h:15
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
BlockPointer.h
lldb_private::formatters::Char16SummaryProvider
bool Char16SummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CxxStringTypes.cpp:159
lldb_private::formatters::LibcxxOptionalSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
Definition: GenericOptional.cpp:133
lldb_private::formatters::LibCxxAtomicSummaryProvider
bool LibCxxAtomicSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxxAtomic.cpp:71
LibCxx.h
lldb_private::CPlusPlusLanguage
Definition: CPlusPlusLanguage.h:24
lldb_private::CompilerType::GetMinimumLanguage
lldb::LanguageType GetMinimumLanguage()
Definition: CompilerType.cpp:338
lldb_private::Language::ImageListTypeScavenger
Definition: Language.h:57
lldb_private::SyntheticChildren::Flags::SetSkipPointers
Flags & SetSkipPointers(bool value=true)
Definition: TypeSynthetic.h:176
lldb_private::formatters::BlockPointerSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * BlockPointerSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: BlockPointer.cpp:204
ConstString.h
MSVCUndecoratedNameParser::IsMSVCUndecoratedName
static bool IsMSVCUndecoratedName(llvm::StringRef name)
Definition: MSVCUndecoratedNameParser.cpp:81
ValueObjectVariable.h
lldb_private::formatters::CXXFunctionPointerSummaryProvider
bool CXXFunctionPointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CXXFunctionPointer.cpp:23
lldb_private::formatters::LibStdcppVectorIteratorSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibStdcppVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibStdcpp.cpp:171
lldb_private::formatters::LibCxxVectorIteratorSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:550
lldb_private::StringSummaryFormat
Definition: TypeSummary.h:278
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb_private::Log
Definition: Log.h:115
lldb_private::Block::GetInlinedFunctionInfo
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
Definition: Block.h:276
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::formatters::LibcxxWStringViewSummaryProvider
bool LibcxxWStringViewSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1061
lldb_private::CPlusPlusLanguage::MethodName::IsValid
bool IsValid()
Definition: CPlusPlusLanguage.h:39
lldb_private::CXXSyntheticChildren
Definition: TypeSynthetic.h:358
lldb::eLanguageTypeObjC_plus_plus
@ eLanguageTypeObjC_plus_plus
Objective-C++.
Definition: lldb-enumerations.h:458
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb_private::TypeSummaryImpl::Flags::SetHideItemNames
Flags & SetHideItemNames(bool value=true)
Definition: TypeSummary.h:173
lldb_private::SymbolFile::GetMangledNamesForFunction
virtual void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< ConstString > &mangled_names)
Definition: SymbolFile.cpp:132
FormattersHelpers.h
CXXFunctionPointer.h
lldb
Definition: SBAddress.h:15
LibStdcpp.h
lldb_private::formatters::AddCXXSynthetic
void AddCXXSynthetic(TypeCategoryImpl::SharedPointer category_sp, CXXSyntheticChildren::CreateFrontEndCallback generator, const char *description, ConstString type_name, ScriptedSyntheticChildren::Flags flags, bool regex=false)
Add a synthetic that is implemented by a C++ callback.
Definition: FormattersHelpers.cpp:75
LLDBLog.h
SymbolFile.h
lldb_private::Block::GetContainingInlinedBlock
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
Definition: Block.cpp:208
lldb::eFormatterMatchRegex
@ eFormatterMatchRegex
Definition: lldb-enumerations.h:841
lldb_private::SyntheticChildren::Flags::SetCascades
Flags & SetCascades(bool value=true)
Definition: TypeSynthetic.h:163
lldb_private::ValueObject::GetObjectRuntimeLanguage
virtual lldb::LanguageType GetObjectRuntimeLanguage()
Definition: ValueObject.h:373
lldb_private::formatters::LibcxxTupleFrontEndCreator
SyntheticChildrenFrontEnd * LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxTuple.cpp:88
lldb_private::HardcodedFormatters::HardcodedSyntheticFinder
HardcodedFormatterFinders< SyntheticChildren > HardcodedSyntheticFinder
Definition: FormatClasses.h:42
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:440
lldb_private::TypeSummaryImpl::Flags::SetSkipReferences
Flags & SetSkipReferences(bool value=true)
Definition: TypeSummary.h:108