LLDB  mainline
ObjCLanguage.cpp
Go to the documentation of this file.
1 //===-- ObjCLanguage.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 <mutex>
10 
11 #include "ObjCLanguage.h"
12 
16 #include "lldb/Core/ValueObject.h"
20 #include "lldb/Target/Target.h"
23 
24 #include "llvm/Support/Threading.h"
25 
28 
29 #include "CF.h"
30 #include "Cocoa.h"
31 #include "CoreMedia.h"
32 #include "NSDictionary.h"
33 #include "NSSet.h"
34 #include "NSString.h"
35 
36 using namespace lldb;
37 using namespace lldb_private;
38 using namespace lldb_private::formatters;
39 
41 
42 void ObjCLanguage::Initialize() {
43  PluginManager::RegisterPlugin(GetPluginNameStatic(), "Objective-C Language",
44  CreateInstance);
45 }
46 
47 void ObjCLanguage::Terminate() {
48  PluginManager::UnregisterPlugin(CreateInstance);
49 }
50 
51 lldb_private::ConstString ObjCLanguage::GetPluginNameStatic() {
52  static ConstString g_name("objc");
53  return g_name;
54 }
55 
56 // Static Functions
57 
58 Language *ObjCLanguage::CreateInstance(lldb::LanguageType language) {
59  switch (language) {
61  return new ObjCLanguage();
62  default:
63  return nullptr;
64  }
65 }
66 
67 void ObjCLanguage::MethodName::Clear() {
68  m_full.Clear();
69  m_class.Clear();
70  m_category.Clear();
71  m_selector.Clear();
72  m_type = eTypeUnspecified;
73  m_category_is_valid = false;
74 }
75 
76 bool ObjCLanguage::MethodName::SetName(llvm::StringRef name, bool strict) {
77  Clear();
78  if (name.empty())
79  return IsValid(strict);
80 
81  // If "strict" is true. then the method must be specified with a '+' or '-'
82  // at the beginning. If "strict" is false, then the '+' or '-' can be omitted
83  bool valid_prefix = false;
84 
85  if (name.size() > 1 && (name[0] == '+' || name[0] == '-')) {
86  valid_prefix = name[1] == '[';
87  if (name[0] == '+')
88  m_type = eTypeClassMethod;
89  else
90  m_type = eTypeInstanceMethod;
91  } else if (!strict) {
92  // "strict" is false, the name just needs to start with '['
93  valid_prefix = name[0] == '[';
94  }
95 
96  if (valid_prefix) {
97  int name_len = name.size();
98  // Objective-C methods must have at least:
99  // "-[" or "+[" prefix
100  // One character for a class name
101  // One character for the space between the class name
102  // One character for the method name
103  // "]" suffix
104  if (name_len >= (5 + (strict ? 1 : 0)) && name.back() == ']') {
105  m_full.SetString(name);
106  }
107  }
108  return IsValid(strict);
109 }
110 
111 bool ObjCLanguage::MethodName::SetName(const char *name, bool strict) {
112  return SetName(llvm::StringRef(name), strict);
113 }
114 
115 ConstString ObjCLanguage::MethodName::GetClassName() {
116  if (!m_class) {
117  if (IsValid(false)) {
118  const char *full = m_full.GetCString();
119  const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
120  const char *paren_pos = strchr(class_start, '(');
121  if (paren_pos) {
122  m_class.SetCStringWithLength(class_start, paren_pos - class_start);
123  } else {
124  // No '(' was found in the full name, we can definitively say that our
125  // category was valid (and empty).
126  m_category_is_valid = true;
127  const char *space_pos = strchr(full, ' ');
128  if (space_pos) {
129  m_class.SetCStringWithLength(class_start, space_pos - class_start);
130  if (!m_class_category) {
131  // No category in name, so we can also fill in the m_class_category
132  m_class_category = m_class;
133  }
134  }
135  }
136  }
137  }
138  return m_class;
139 }
140 
141 ConstString ObjCLanguage::MethodName::GetClassNameWithCategory() {
142  if (!m_class_category) {
143  if (IsValid(false)) {
144  const char *full = m_full.GetCString();
145  const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
146  const char *space_pos = strchr(full, ' ');
147  if (space_pos) {
148  m_class_category.SetCStringWithLength(class_start,
149  space_pos - class_start);
150  // If m_class hasn't been filled in and the class with category doesn't
151  // contain a '(', then we can also fill in the m_class
152  if (!m_class && strchr(m_class_category.GetCString(), '(') == nullptr) {
153  m_class = m_class_category;
154  // No '(' was found in the full name, we can definitively say that
155  // our category was valid (and empty).
156  m_category_is_valid = true;
157  }
158  }
159  }
160  }
161  return m_class_category;
162 }
163 
164 ConstString ObjCLanguage::MethodName::GetSelector() {
165  if (!m_selector) {
166  if (IsValid(false)) {
167  const char *full = m_full.GetCString();
168  const char *space_pos = strchr(full, ' ');
169  if (space_pos) {
170  ++space_pos; // skip the space
171  m_selector.SetCStringWithLength(space_pos, m_full.GetLength() -
172  (space_pos - full) - 1);
173  }
174  }
175  }
176  return m_selector;
177 }
178 
179 ConstString ObjCLanguage::MethodName::GetCategory() {
180  if (!m_category_is_valid && !m_category) {
181  if (IsValid(false)) {
182  m_category_is_valid = true;
183  const char *full = m_full.GetCString();
184  const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
185  const char *open_paren_pos = strchr(class_start, '(');
186  if (open_paren_pos) {
187  ++open_paren_pos; // Skip the open paren
188  const char *close_paren_pos = strchr(open_paren_pos, ')');
189  if (close_paren_pos)
190  m_category.SetCStringWithLength(open_paren_pos,
191  close_paren_pos - open_paren_pos);
192  }
193  }
194  }
195  return m_category;
196 }
197 
198 ConstString ObjCLanguage::MethodName::GetFullNameWithoutCategory(
199  bool empty_if_no_category) {
200  if (IsValid(false)) {
201  if (HasCategory()) {
202  StreamString strm;
203  if (m_type == eTypeClassMethod)
204  strm.PutChar('+');
205  else if (m_type == eTypeInstanceMethod)
206  strm.PutChar('-');
207  strm.Printf("[%s %s]", GetClassName().GetCString(),
208  GetSelector().GetCString());
209  return ConstString(strm.GetString());
210  }
211 
212  if (!empty_if_no_category) {
213  // Just return the full name since it doesn't have a category
214  return GetFullName();
215  }
216  }
217  return ConstString();
218 }
219 
220 std::vector<Language::MethodNameVariant>
221 ObjCLanguage::GetMethodNameVariants(ConstString method_name) const {
222  std::vector<Language::MethodNameVariant> variant_names;
223  ObjCLanguage::MethodName objc_method(method_name.GetCString(), false);
224  if (!objc_method.IsValid(false)) {
225  return variant_names;
226  }
227 
228  variant_names.emplace_back(objc_method.GetSelector(),
229  lldb::eFunctionNameTypeSelector);
230 
231  const bool is_class_method =
232  objc_method.GetType() == MethodName::eTypeClassMethod;
233  const bool is_instance_method =
234  objc_method.GetType() == MethodName::eTypeInstanceMethod;
235  ConstString name_sans_category =
236  objc_method.GetFullNameWithoutCategory(/*empty_if_no_category*/ true);
237 
238  if (is_class_method || is_instance_method) {
239  if (name_sans_category)
240  variant_names.emplace_back(name_sans_category,
241  lldb::eFunctionNameTypeFull);
242  } else {
243  StreamString strm;
244 
245  strm.Printf("+%s", objc_method.GetFullName().GetCString());
246  variant_names.emplace_back(ConstString(strm.GetString()),
247  lldb::eFunctionNameTypeFull);
248  strm.Clear();
249 
250  strm.Printf("-%s", objc_method.GetFullName().GetCString());
251  variant_names.emplace_back(ConstString(strm.GetString()),
252  lldb::eFunctionNameTypeFull);
253  strm.Clear();
254 
255  if (name_sans_category) {
256  strm.Printf("+%s", name_sans_category.GetCString());
257  variant_names.emplace_back(ConstString(strm.GetString()),
258  lldb::eFunctionNameTypeFull);
259  strm.Clear();
260 
261  strm.Printf("-%s", name_sans_category.GetCString());
262  variant_names.emplace_back(ConstString(strm.GetString()),
263  lldb::eFunctionNameTypeFull);
264  }
265  }
266 
267  return variant_names;
268 }
269 
270 bool ObjCLanguage::SymbolNameFitsToLanguage(Mangled mangled) const {
271  ConstString demangled_name = mangled.GetDemangledName();
272  if (!demangled_name)
273  return false;
274  return ObjCLanguage::IsPossibleObjCMethodName(demangled_name.GetCString());
275 }
276 
277 static void LoadObjCFormatters(TypeCategoryImplSP objc_category_sp) {
278  if (!objc_category_sp)
279  return;
280 
281  TypeSummaryImpl::Flags objc_flags;
282  objc_flags.SetCascades(false)
283  .SetSkipPointers(true)
284  .SetSkipReferences(true)
285  .SetDontShowChildren(true)
286  .SetDontShowValue(true)
287  .SetShowMembersOneLiner(false)
288  .SetHideItemNames(false);
289 
290  lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(
292  objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL"),
293  ObjC_BOOL_summary);
294  objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL &"),
295  ObjC_BOOL_summary);
296  objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL *"),
297  ObjC_BOOL_summary);
298 
299  // we need to skip pointers here since we are special casing a SEL* when
300  // retrieving its value
301  objc_flags.SetSkipPointers(true);
302  AddCXXSummary(objc_category_sp,
304  "SEL summary provider", ConstString("SEL"), objc_flags);
307  "SEL summary provider", ConstString("struct objc_selector"), objc_flags);
310  "SEL summary provider", ConstString("objc_selector"), objc_flags);
313  "SEL summary provider", ConstString("objc_selector *"), objc_flags);
314  AddCXXSummary(objc_category_sp,
316  "SEL summary provider", ConstString("SEL *"), objc_flags);
317 
318  AddCXXSummary(objc_category_sp,
320  "Class summary provider", ConstString("Class"), objc_flags);
321 
322  SyntheticChildren::Flags class_synth_flags;
323  class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
324  false);
325 
326  AddCXXSynthetic(objc_category_sp,
328  "Class synthetic children", ConstString("Class"),
329  class_synth_flags);
330 
331  objc_flags.SetSkipPointers(false);
332  objc_flags.SetCascades(true);
333  objc_flags.SetSkipReferences(false);
334 
335  AddStringSummary(objc_category_sp, "${var.__FuncPtr%A}",
336  ConstString("__block_literal_generic"), objc_flags);
337 
338  AddStringSummary(objc_category_sp, "${var.years} years, ${var.months} "
339  "months, ${var.days} days, ${var.hours} "
340  "hours, ${var.minutes} minutes "
341  "${var.seconds} seconds",
342  ConstString("CFGregorianUnits"), objc_flags);
343  AddStringSummary(objc_category_sp,
344  "location=${var.location} length=${var.length}",
345  ConstString("CFRange"), objc_flags);
346 
347  AddStringSummary(objc_category_sp,
348  "location=${var.location}, length=${var.length}",
349  ConstString("NSRange"), objc_flags);
350  AddStringSummary(objc_category_sp, "(${var.origin}, ${var.size}), ...",
351  ConstString("NSRectArray"), objc_flags);
352 
353  AddOneLineSummary(objc_category_sp, ConstString("NSPoint"), objc_flags);
354  AddOneLineSummary(objc_category_sp, ConstString("NSSize"), objc_flags);
355  AddOneLineSummary(objc_category_sp, ConstString("NSRect"), objc_flags);
356 
357  AddOneLineSummary(objc_category_sp, ConstString("CGSize"), objc_flags);
358  AddOneLineSummary(objc_category_sp, ConstString("CGPoint"), objc_flags);
359  AddOneLineSummary(objc_category_sp, ConstString("CGRect"), objc_flags);
360 
361  AddStringSummary(objc_category_sp,
362  "red=${var.red} green=${var.green} blue=${var.blue}",
363  ConstString("RGBColor"), objc_flags);
365  objc_category_sp,
366  "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
367  ConstString("Rect"), objc_flags);
368  AddStringSummary(objc_category_sp, "{(v=${var.v}, h=${var.h})}",
369  ConstString("Point"), objc_flags);
370  AddStringSummary(objc_category_sp,
371  "${var.month}/${var.day}/${var.year} ${var.hour} "
372  ":${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
373  ConstString("DateTimeRect *"), objc_flags);
374  AddStringSummary(objc_category_sp, "${var.ld.month}/${var.ld.day}/"
375  "${var.ld.year} ${var.ld.hour} "
376  ":${var.ld.minute} :${var.ld.second} "
377  "dayOfWeek:${var.ld.dayOfWeek}",
378  ConstString("LongDateRect"), objc_flags);
379  AddStringSummary(objc_category_sp, "(x=${var.x}, y=${var.y})",
380  ConstString("HIPoint"), objc_flags);
381  AddStringSummary(objc_category_sp, "origin=${var.origin} size=${var.size}",
382  ConstString("HIRect"), objc_flags);
383 
384  TypeSummaryImpl::Flags appkit_flags;
385  appkit_flags.SetCascades(true)
386  .SetSkipPointers(false)
387  .SetSkipReferences(false)
388  .SetDontShowChildren(true)
389  .SetDontShowValue(false)
390  .SetShowMembersOneLiner(false)
391  .SetHideItemNames(false);
392 
393  appkit_flags.SetDontShowChildren(false);
394 
397  "NSArray summary provider", ConstString("NSArray"), appkit_flags);
400  "NSArray summary provider", ConstString("NSConstantArray"), appkit_flags);
403  "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
406  "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
409  "NSArray summary provider", ConstString("__NSArray0"), appkit_flags);
410  AddCXXSummary(objc_category_sp,
412  "NSArray summary provider",
413  ConstString("__NSSingleObjectArrayI"), appkit_flags);
416  "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
419  "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
422  "NSArray summary provider", ConstString("_NSCallStackArray"), appkit_flags);
425  "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
426  AddCXXSummary(objc_category_sp,
428  "NSArray summary provider", ConstString("CFMutableArrayRef"),
429  appkit_flags);
430 
431  AddCXXSummary(objc_category_sp,
433  "NSDictionary summary provider", ConstString("NSDictionary"),
434  appkit_flags);
435  AddCXXSummary(objc_category_sp,
437  "NSDictionary summary provider",
438  ConstString("NSConstantDictionary"), appkit_flags);
439  AddCXXSummary(objc_category_sp,
441  "NSDictionary summary provider",
442  ConstString("NSMutableDictionary"), appkit_flags);
443  AddCXXSummary(objc_category_sp,
445  "NSDictionary summary provider",
446  ConstString("__NSCFDictionary"), appkit_flags);
447  AddCXXSummary(objc_category_sp,
449  "NSDictionary summary provider", ConstString("__NSDictionaryI"),
450  appkit_flags);
451  AddCXXSummary(objc_category_sp,
453  "NSDictionary summary provider",
454  ConstString("__NSSingleEntryDictionaryI"), appkit_flags);
455  AddCXXSummary(objc_category_sp,
457  "NSDictionary summary provider", ConstString("__NSDictionaryM"),
458  appkit_flags);
459  AddCXXSummary(objc_category_sp,
461  "NSDictionary summary provider", ConstString("CFDictionaryRef"),
462  appkit_flags);
463  AddCXXSummary(objc_category_sp,
465  "NSDictionary summary provider", ConstString("__CFDictionary"),
466  appkit_flags);
467  AddCXXSummary(objc_category_sp,
469  "NSDictionary summary provider",
470  ConstString("CFMutableDictionaryRef"), appkit_flags);
471 
472  AddCXXSummary(objc_category_sp,
473  lldb_private::formatters::NSSetSummaryProvider<false>,
474  "NSSet summary", ConstString("NSSet"), appkit_flags);
476  objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
477  "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
478  AddCXXSummary(objc_category_sp,
479  lldb_private::formatters::NSSetSummaryProvider<true>,
480  "CFSetRef summary", ConstString("CFSetRef"), appkit_flags);
482  objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>,
483  "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags);
484  AddCXXSummary(objc_category_sp,
485  lldb_private::formatters::NSSetSummaryProvider<false>,
486  "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags);
487  AddCXXSummary(objc_category_sp,
488  lldb_private::formatters::NSSetSummaryProvider<false>,
489  "__CFSet summary", ConstString("__CFSet"), appkit_flags);
490  AddCXXSummary(objc_category_sp,
491  lldb_private::formatters::NSSetSummaryProvider<false>,
492  "__NSSetI summary", ConstString("__NSSetI"), appkit_flags);
493  AddCXXSummary(objc_category_sp,
494  lldb_private::formatters::NSSetSummaryProvider<false>,
495  "__NSSetM summary", ConstString("__NSSetM"), appkit_flags);
497  objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
498  "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags);
500  objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
501  "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
503  objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
504  "NSOrderedSet summary", ConstString("NSOrderedSet"), appkit_flags);
506  objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
507  "__NSOrderedSetI summary", ConstString("__NSOrderedSetI"), appkit_flags);
509  objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
510  "__NSOrderedSetM summary", ConstString("__NSOrderedSetM"), appkit_flags);
511 
514  "NSError summary provider", ConstString("NSError"), appkit_flags);
517  "NSException summary provider", ConstString("NSException"), appkit_flags);
518 
519  // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}",
520  // ConstString("$_lldb_typegen_nspair"), appkit_flags);
521 
522  appkit_flags.SetDontShowChildren(true);
523 
524  AddCXXSynthetic(objc_category_sp,
526  "NSArray synthetic children", ConstString("__NSArrayM"),
527  ScriptedSyntheticChildren::Flags());
528  AddCXXSynthetic(objc_category_sp,
530  "NSArray synthetic children", ConstString("__NSArrayI"),
531  ScriptedSyntheticChildren::Flags());
532  AddCXXSynthetic(objc_category_sp,
534  "NSArray synthetic children", ConstString("__NSArray0"),
535  ScriptedSyntheticChildren::Flags());
536  AddCXXSynthetic(objc_category_sp,
538  "NSArray synthetic children",
539  ConstString("__NSSingleObjectArrayI"),
540  ScriptedSyntheticChildren::Flags());
541  AddCXXSynthetic(objc_category_sp,
543  "NSArray synthetic children", ConstString("NSArray"),
544  ScriptedSyntheticChildren::Flags());
545  AddCXXSynthetic(objc_category_sp,
547  "NSArray synthetic children", ConstString("NSConstantArray"),
548  ScriptedSyntheticChildren::Flags());
549  AddCXXSynthetic(objc_category_sp,
551  "NSArray synthetic children", ConstString("NSMutableArray"),
552  ScriptedSyntheticChildren::Flags());
553  AddCXXSynthetic(objc_category_sp,
555  "NSArray synthetic children", ConstString("__NSCFArray"),
556  ScriptedSyntheticChildren::Flags());
557  AddCXXSynthetic(objc_category_sp,
559  "NSArray synthetic children", ConstString("_NSCallStackArray"),
560  ScriptedSyntheticChildren::Flags());
561  AddCXXSynthetic(objc_category_sp,
563  "NSArray synthetic children",
564  ConstString("CFMutableArrayRef"),
565  ScriptedSyntheticChildren::Flags());
566  AddCXXSynthetic(objc_category_sp,
568  "NSArray synthetic children", ConstString("CFArrayRef"),
569  ScriptedSyntheticChildren::Flags());
570 
572  objc_category_sp,
574  "NSDictionary synthetic children", ConstString("__NSDictionaryM"),
575  ScriptedSyntheticChildren::Flags());
577  objc_category_sp,
579  "NSDictionary synthetic children", ConstString("NSConstantDictionary"),
580  ScriptedSyntheticChildren::Flags());
582  objc_category_sp,
584  "NSDictionary synthetic children", ConstString("__NSDictionaryI"),
585  ScriptedSyntheticChildren::Flags());
587  objc_category_sp,
589  "NSDictionary synthetic children",
590  ConstString("__NSSingleEntryDictionaryI"),
591  ScriptedSyntheticChildren::Flags());
593  objc_category_sp,
595  "NSDictionary synthetic children", ConstString("__NSCFDictionary"),
596  ScriptedSyntheticChildren::Flags());
598  objc_category_sp,
600  "NSDictionary synthetic children", ConstString("NSDictionary"),
601  ScriptedSyntheticChildren::Flags());
603  objc_category_sp,
605  "NSDictionary synthetic children", ConstString("NSMutableDictionary"),
606  ScriptedSyntheticChildren::Flags());
608  objc_category_sp,
610  "NSDictionary synthetic children", ConstString("CFDictionaryRef"),
611  ScriptedSyntheticChildren::Flags());
613  objc_category_sp,
615  "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"),
616  ScriptedSyntheticChildren::Flags());
618  objc_category_sp,
620  "NSDictionary synthetic children", ConstString("__CFDictionary"),
621  ScriptedSyntheticChildren::Flags());
622 
623  AddCXXSynthetic(objc_category_sp,
625  "NSError synthetic children", ConstString("NSError"),
626  ScriptedSyntheticChildren::Flags());
627  AddCXXSynthetic(objc_category_sp,
629  "NSException synthetic children", ConstString("NSException"),
630  ScriptedSyntheticChildren::Flags());
631 
632  AddCXXSynthetic(objc_category_sp,
634  "NSSet synthetic children", ConstString("NSSet"),
635  ScriptedSyntheticChildren::Flags());
636  AddCXXSynthetic(objc_category_sp,
638  "__NSSetI synthetic children", ConstString("__NSSetI"),
639  ScriptedSyntheticChildren::Flags());
640  AddCXXSynthetic(objc_category_sp,
642  "__NSSetM synthetic children", ConstString("__NSSetM"),
643  ScriptedSyntheticChildren::Flags());
644  AddCXXSynthetic(objc_category_sp,
646  "__NSCFSet synthetic children", ConstString("__NSCFSet"),
647  ScriptedSyntheticChildren::Flags());
648  AddCXXSynthetic(objc_category_sp,
650  "CFSetRef synthetic children", ConstString("CFSetRef"),
651  ScriptedSyntheticChildren::Flags());
652 
655  "NSMutableSet synthetic children", ConstString("NSMutableSet"),
656  ScriptedSyntheticChildren::Flags());
659  "NSOrderedSet synthetic children", ConstString("NSOrderedSet"),
660  ScriptedSyntheticChildren::Flags());
663  "__NSOrderedSetI synthetic children", ConstString("__NSOrderedSetI"),
664  ScriptedSyntheticChildren::Flags());
667  "__NSOrderedSetM synthetic children", ConstString("__NSOrderedSetM"),
668  ScriptedSyntheticChildren::Flags());
669  AddCXXSynthetic(objc_category_sp,
671  "__CFSet synthetic children", ConstString("__CFSet"),
672  ScriptedSyntheticChildren::Flags());
673 
674  AddCXXSynthetic(objc_category_sp,
676  "NSIndexPath synthetic children", ConstString("NSIndexPath"),
677  ScriptedSyntheticChildren::Flags());
678 
681  "CFBag summary provider", ConstString("CFBagRef"), appkit_flags);
682  AddCXXSummary(objc_category_sp,
684  "CFBag summary provider", ConstString("__CFBag"), appkit_flags);
685  AddCXXSummary(objc_category_sp,
687  "CFBag summary provider", ConstString("const struct __CFBag"),
688  appkit_flags);
691  "CFBag summary provider", ConstString("CFMutableBagRef"), appkit_flags);
692 
693  AddCXXSummary(objc_category_sp,
695  "CFBinaryHeap summary provider", ConstString("CFBinaryHeapRef"),
696  appkit_flags);
697  AddCXXSummary(objc_category_sp,
699  "CFBinaryHeap summary provider", ConstString("__CFBinaryHeap"),
700  appkit_flags);
701 
704  "NSString summary provider", ConstString("NSString"), appkit_flags);
707  "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
710  "NSString summary provider", ConstString("__CFString"), appkit_flags);
711  AddCXXSummary(objc_category_sp,
713  "NSString summary provider", ConstString("CFMutableStringRef"),
714  appkit_flags);
715  AddCXXSummary(objc_category_sp,
717  "NSString summary provider", ConstString("NSMutableString"),
718  appkit_flags);
719  AddCXXSummary(objc_category_sp,
721  "NSString summary provider",
722  ConstString("__NSCFConstantString"), appkit_flags);
725  "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
726  AddCXXSummary(objc_category_sp,
728  "NSString summary provider", ConstString("NSCFConstantString"),
729  appkit_flags);
732  "NSString summary provider", ConstString("NSCFString"), appkit_flags);
735  "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
736  AddCXXSummary(objc_category_sp,
738  "NSString summary provider",
739  ConstString("NSTaggedPointerString"), appkit_flags);
740 
741  AddCXXSummary(objc_category_sp,
743  "NSAttributedString summary provider",
744  ConstString("NSAttributedString"), appkit_flags);
746  objc_category_sp,
748  "NSMutableAttributedString summary provider",
749  ConstString("NSMutableAttributedString"), appkit_flags);
751  objc_category_sp,
753  "NSMutableAttributedString summary provider",
754  ConstString("NSConcreteMutableAttributedString"), appkit_flags);
755 
758  "NSBundle summary provider", ConstString("NSBundle"), appkit_flags);
759 
760  AddCXXSummary(objc_category_sp,
762  "NSData summary provider", ConstString("NSData"), appkit_flags);
765  "NSData summary provider", ConstString("_NSInlineData"), appkit_flags);
768  "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
769  AddCXXSummary(objc_category_sp,
771  "NSData summary provider", ConstString("NSConcreteMutableData"),
772  appkit_flags);
775  "NSData summary provider", ConstString("NSMutableData"), appkit_flags);
778  "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
781  "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
784  "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
785 
788  "NSMachPort summary provider", ConstString("NSMachPort"), appkit_flags);
789 
790  AddCXXSummary(objc_category_sp,
792  "NSNotification summary provider",
793  ConstString("NSNotification"), appkit_flags);
794  AddCXXSummary(objc_category_sp,
796  "NSNotification summary provider",
797  ConstString("NSConcreteNotification"), appkit_flags);
798 
801  "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
802  AddCXXSummary(objc_category_sp,
804  "NSNumber summary provider",
805  ConstString("NSConstantIntegerNumber"), appkit_flags);
806  AddCXXSummary(objc_category_sp,
808  "NSNumber summary provider",
809  ConstString("NSConstantDoubleNumber"), appkit_flags);
810  AddCXXSummary(objc_category_sp,
812  "NSNumber summary provider",
813  ConstString("NSConstantFloatNumber"), appkit_flags);
816  "CFNumberRef summary provider", ConstString("CFNumberRef"), appkit_flags);
819  "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
822  "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
825  "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
828  "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
829  AddCXXSummary(objc_category_sp,
831  "NSDecimalNumber summary provider",
832  ConstString("NSDecimalNumber"), appkit_flags);
833 
834  AddCXXSummary(objc_category_sp,
836  "NSURL summary provider", ConstString("NSURL"), appkit_flags);
839  "NSURL summary provider", ConstString("CFURLRef"), appkit_flags);
840 
841  AddCXXSummary(objc_category_sp,
843  "NSDate summary provider", ConstString("NSDate"), appkit_flags);
846  "NSDate summary provider", ConstString("__NSDate"), appkit_flags);
849  "NSDate summary provider", ConstString("__NSTaggedDate"), appkit_flags);
852  "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags);
853 
856  "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags);
857  AddCXXSummary(objc_category_sp,
859  "NSTimeZone summary provider", ConstString("CFTimeZoneRef"),
860  appkit_flags);
863  "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags);
864 
865  // CFAbsoluteTime is actually a double rather than a pointer to an object we
866  // do not care about the numeric value, since it is probably meaningless to
867  // users
868  appkit_flags.SetDontShowValue(true);
869  AddCXXSummary(objc_category_sp,
871  "CFAbsoluteTime summary provider",
872  ConstString("CFAbsoluteTime"), appkit_flags);
873  appkit_flags.SetDontShowValue(false);
874 
877  "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags);
878  AddCXXSummary(objc_category_sp,
880  "NSIndexSet summary provider", ConstString("NSMutableIndexSet"),
881  appkit_flags);
882 
883  AddStringSummary(objc_category_sp,
884  "@\"${var.month%d}/${var.day%d}/${var.year%d} "
885  "${var.hour%d}:${var.minute%d}:${var.second}\"",
886  ConstString("CFGregorianDate"), appkit_flags);
887 
888  AddCXXSummary(objc_category_sp,
890  "CFBitVector summary provider", ConstString("CFBitVectorRef"),
891  appkit_flags);
892  AddCXXSummary(objc_category_sp,
894  "CFBitVector summary provider",
895  ConstString("CFMutableBitVectorRef"), appkit_flags);
896  AddCXXSummary(objc_category_sp,
898  "CFBitVector summary provider", ConstString("__CFBitVector"),
899  appkit_flags);
900  AddCXXSummary(objc_category_sp,
902  "CFBitVector summary provider",
903  ConstString("__CFMutableBitVector"), appkit_flags);
904 }
905 
906 static void LoadCoreMediaFormatters(TypeCategoryImplSP objc_category_sp) {
907  if (!objc_category_sp)
908  return;
909 
910  TypeSummaryImpl::Flags cm_flags;
911  cm_flags.SetCascades(true)
912  .SetDontShowChildren(false)
913  .SetDontShowValue(false)
914  .SetHideItemNames(false)
915  .SetShowMembersOneLiner(false)
916  .SetSkipPointers(false)
917  .SetSkipReferences(false);
918 
919  AddCXXSummary(objc_category_sp,
921  "CMTime summary provider", ConstString("CMTime"), cm_flags);
922 }
923 
924 lldb::TypeCategoryImplSP ObjCLanguage::GetFormatters() {
925  static llvm::once_flag g_initialize;
926  static TypeCategoryImplSP g_category;
927 
928  llvm::call_once(g_initialize, [this]() -> void {
929  DataVisualization::Categories::GetCategory(ConstString(GetPluginName()),
930  g_category);
931  if (g_category) {
932  LoadCoreMediaFormatters(g_category);
933  LoadObjCFormatters(g_category);
934  }
935  });
936  return g_category;
937 }
938 
939 std::vector<ConstString>
940 ObjCLanguage::GetPossibleFormattersMatches(ValueObject &valobj,
941  lldb::DynamicValueType use_dynamic) {
942  std::vector<ConstString> result;
943 
944  if (use_dynamic == lldb::eNoDynamicValues)
945  return result;
946 
947  CompilerType compiler_type(valobj.GetCompilerType());
948 
949  const bool check_cpp = false;
950  const bool check_objc = true;
951  bool canBeObjCDynamic =
952  compiler_type.IsPossibleDynamicType(nullptr, check_cpp, check_objc);
953 
954  if (canBeObjCDynamic && ClangUtil::IsClangType(compiler_type)) {
955  do {
956  lldb::ProcessSP process_sp = valobj.GetProcessSP();
957  if (!process_sp)
958  break;
959  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
960  if (runtime == nullptr)
961  break;
963  runtime->GetClassDescriptor(valobj));
964  if (!objc_class_sp)
965  break;
966  if (ConstString name = objc_class_sp->GetClassName())
967  result.push_back(name);
968  } while (false);
969  }
970 
971  return result;
972 }
973 
974 std::unique_ptr<Language::TypeScavenger> ObjCLanguage::GetTypeScavenger() {
975  class ObjCScavengerResult : public Language::TypeScavenger::Result {
976  public:
977  ObjCScavengerResult(CompilerType type)
978  : Language::TypeScavenger::Result(), m_compiler_type(type) {}
979 
980  bool IsValid() override { return m_compiler_type.IsValid(); }
981 
982  bool DumpToStream(Stream &stream, bool print_help_if_available) override {
983  if (IsValid()) {
984  m_compiler_type.DumpTypeDescription(&stream);
985  stream.EOL();
986  return true;
987  }
988  return false;
989  }
990 
991  private:
992  CompilerType m_compiler_type;
993  };
994 
995  class ObjCRuntimeScavenger : public Language::TypeScavenger {
996  protected:
997  bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
998  ResultSet &results) override {
999  bool result = false;
1000 
1001  if (auto *process = exe_scope->CalculateProcess().get()) {
1002  if (auto *objc_runtime = ObjCLanguageRuntime::Get(*process)) {
1003  if (auto *decl_vendor = objc_runtime->GetDeclVendor()) {
1004  ConstString name(key);
1005  for (const CompilerType &type :
1006  decl_vendor->FindTypes(name, /*max_matches*/ UINT32_MAX)) {
1007  result = true;
1008  std::unique_ptr<Language::TypeScavenger::Result> result(
1009  new ObjCScavengerResult(type));
1010  results.insert(std::move(result));
1011  }
1012  }
1013  }
1014  }
1015 
1016  return result;
1017  }
1018 
1019  friend class lldb_private::ObjCLanguage;
1020  };
1021 
1022  class ObjCModulesScavenger : public Language::TypeScavenger {
1023  protected:
1024  bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
1025  ResultSet &results) override {
1026  bool result = false;
1027 
1028  if (auto *target = exe_scope->CalculateTarget().get()) {
1029  auto *persistent_vars = llvm::cast<ClangPersistentVariables>(
1030  target->GetPersistentExpressionStateForLanguage(
1032  if (std::shared_ptr<ClangModulesDeclVendor> clang_modules_decl_vendor =
1033  persistent_vars->GetClangModulesDeclVendor()) {
1034  ConstString key_cs(key);
1035  auto types = clang_modules_decl_vendor->FindTypes(
1036  key_cs, /*max_matches*/ UINT32_MAX);
1037  if (!types.empty()) {
1038  result = true;
1039  std::unique_ptr<Language::TypeScavenger::Result> result(
1040  new ObjCScavengerResult(types.front()));
1041  results.insert(std::move(result));
1042  }
1043  }
1044  }
1045 
1046  return result;
1047  }
1048 
1049  friend class lldb_private::ObjCLanguage;
1050  };
1051 
1052  class ObjCDebugInfoScavenger : public Language::ImageListTypeScavenger {
1053  public:
1054  CompilerType AdjustForInclusion(CompilerType &candidate) override {
1055  LanguageType lang_type(candidate.GetMinimumLanguage());
1056  if (!Language::LanguageIsObjC(lang_type))
1057  return CompilerType();
1058  if (candidate.IsTypedefType())
1059  return candidate.GetTypedefedType();
1060  return candidate;
1061  }
1062  };
1063 
1064  return std::unique_ptr<TypeScavenger>(
1065  new Language::EitherTypeScavenger<ObjCModulesScavenger,
1066  ObjCRuntimeScavenger,
1067  ObjCDebugInfoScavenger>());
1068 }
1069 
1070 bool ObjCLanguage::GetFormatterPrefixSuffix(ValueObject &valobj,
1071  ConstString type_hint,
1072  std::string &prefix,
1073  std::string &suffix) {
1074  static ConstString g_CFBag("CFBag");
1075  static ConstString g_CFBinaryHeap("CFBinaryHeap");
1076 
1077  static ConstString g_NSNumberChar("NSNumber:char");
1078  static ConstString g_NSNumberShort("NSNumber:short");
1079  static ConstString g_NSNumberInt("NSNumber:int");
1080  static ConstString g_NSNumberLong("NSNumber:long");
1081  static ConstString g_NSNumberInt128("NSNumber:int128_t");
1082  static ConstString g_NSNumberFloat("NSNumber:float");
1083  static ConstString g_NSNumberDouble("NSNumber:double");
1084 
1085  static ConstString g_NSData("NSData");
1086  static ConstString g_NSArray("NSArray");
1087  static ConstString g_NSString("NSString");
1088  static ConstString g_NSStringStar("NSString*");
1089 
1090  if (type_hint.IsEmpty())
1091  return false;
1092 
1093  prefix.clear();
1094  suffix.clear();
1095 
1096  if (type_hint == g_CFBag || type_hint == g_CFBinaryHeap) {
1097  prefix = "@";
1098  return true;
1099  }
1100 
1101  if (type_hint == g_NSNumberChar) {
1102  prefix = "(char)";
1103  return true;
1104  }
1105  if (type_hint == g_NSNumberShort) {
1106  prefix = "(short)";
1107  return true;
1108  }
1109  if (type_hint == g_NSNumberInt) {
1110  prefix = "(int)";
1111  return true;
1112  }
1113  if (type_hint == g_NSNumberLong) {
1114  prefix = "(long)";
1115  return true;
1116  }
1117  if (type_hint == g_NSNumberInt128) {
1118  prefix = "(int128_t)";
1119  return true;
1120  }
1121  if (type_hint == g_NSNumberFloat) {
1122  prefix = "(float)";
1123  return true;
1124  }
1125  if (type_hint == g_NSNumberDouble) {
1126  prefix = "(double)";
1127  return true;
1128  }
1129 
1130  if (type_hint == g_NSData || type_hint == g_NSArray) {
1131  prefix = "@\"";
1132  suffix = "\"";
1133  return true;
1134  }
1135 
1136  if (type_hint == g_NSString || type_hint == g_NSStringStar) {
1137  prefix = "@";
1138  return true;
1139  }
1140 
1141  return false;
1142 }
1143 
1144 bool ObjCLanguage::IsNilReference(ValueObject &valobj) {
1145  const uint32_t mask = eTypeIsObjC | eTypeIsPointer;
1146  bool isObjCpointer =
1147  (((valobj.GetCompilerType().GetTypeInfo(nullptr)) & mask) == mask);
1148  if (!isObjCpointer)
1149  return false;
1150  bool canReadValue = true;
1151  bool isZero = valobj.GetValueAsUnsigned(0, &canReadValue) == 0;
1152  return canReadValue && isZero;
1153 }
1154 
1155 bool ObjCLanguage::IsSourceFile(llvm::StringRef file_path) const {
1156  const auto suffixes = {".h", ".m", ".M"};
1157  for (auto suffix : suffixes) {
1158  if (file_path.endswith_insensitive(suffix))
1159  return true;
1160  }
1161  return false;
1162 }
lldb_private::SyntheticChildren::Flags
Definition: TypeSynthetic.h:134
lldb_private::ValueObject::GetValueAsUnsigned
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
Definition: ValueObject.cpp:1090
lldb_private::SyntheticChildren::Flags::SetSkipReferences
Flags & SetSkipReferences(bool value=true)
Definition: TypeSynthetic.h:189
lldb_private::formatters::ObjCClassSummaryProvider
bool ObjCClassSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:993
lldb_private::ObjCLanguage::MethodName::GetType
Type GetType() const
Definition: ObjCLanguage.h:57
ClangModulesDeclVendor.h
lldb_private::formatters::AddOneLineSummary
void AddOneLineSummary(TypeCategoryImpl::SharedPointer category_sp, ConstString type_name, TypeSummaryImpl::Flags flags, bool regex=false)
Definition: FormattersHelpers.cpp:61
lldb_private::formatters::NSDateSummaryProvider
bool NSDateSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:891
lldb_private::ObjCLanguageRuntime
Definition: ObjCLanguageRuntime.h:34
lldb_private::ObjCLanguageRuntime::ClassDescriptorSP
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
Definition: ObjCLanguageRuntime.h:44
lldb::eNoDynamicValues
@ eNoDynamicValues
Definition: lldb-enumerations.h:495
lldb_private::formatters::NSIndexPathSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * NSIndexPathSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: NSIndexPath.cpp:303
lldb_private::formatters::ObjCSELSummaryProvider< false >
template bool ObjCSELSummaryProvider< false >(ValueObject &, Stream &, const TypeSummaryOptions &)
lldb_private::TypeSummaryImpl::Flags::SetDontShowChildren
Flags & SetDontShowChildren(bool value=true)
Definition: TypeSummary.h:121
lldb_private::formatters::ObjCBOOLSummaryProvider
bool ObjCBOOLSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:1114
lldb_private::CXXFunctionSummaryFormat
Definition: TypeSummary.h:306
lldb_private::TypeSummaryImpl::Flags
Definition: TypeSummary.h:53
lldb_private::Language::TypeScavenger::Result
Definition: Language.h:33
lldb_private::formatters::NSArraySummaryProvider
bool NSArraySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSArray.cpp:335
lldb_private::formatters::NSNumberSummaryProvider
bool NSNumberSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:423
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::formatters::CMTimeSummaryProvider
bool CMTimeSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CoreMedia.cpp:22
lldb_private::Stream
Definition: Stream.h:28
lldb_private::ObjCLanguage::MethodName::GetFullName
ConstString GetFullName() const
Definition: ObjCLanguage.h:59
lldb_private::formatters::NSError_SummaryProvider
bool NSError_SummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSError.cpp:55
lldb_private::formatters::NSArraySyntheticFrontEndCreator
SyntheticChildrenFrontEnd * NSArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: NSArray.cpp:797
lldb_private::formatters::NSDictionarySyntheticFrontEndCreator
SyntheticChildrenFrontEnd * NSDictionarySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: NSDictionary.cpp:520
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::ObjCLanguage::MethodName::GetFullNameWithoutCategory
ConstString GetFullNameWithoutCategory(bool empty_if_no_category)
Definition: ObjCLanguage.cpp:198
lldb_private::formatters::ObjCClassSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * ObjCClassSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: Cocoa.cpp:1045
lldb_private::Language::TypeScavenger::Result::IsValid
virtual bool IsValid()=0
ClangUtil.h
LoadObjCFormatters
static void LoadObjCFormatters(TypeCategoryImplSP objc_category_sp)
Definition: ObjCLanguage.cpp:277
lldb_private::formatters::NSStringSummaryProvider
bool NSStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSString.cpp:52
lldb_private::formatters::AddStringSummary
void AddStringSummary(TypeCategoryImpl::SharedPointer category_sp, const char *string, ConstString type_name, TypeSummaryImpl::Flags flags, bool regex=false)
Definition: FormattersHelpers.cpp:48
Target.h
lldb_private::ValueObject::GetProcessSP
lldb::ProcessSP GetProcessSP() const
Definition: ValueObject.h:338
lldb_private::formatters::CFAbsoluteTimeSummaryProvider
bool CFAbsoluteTimeSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CF.cpp:29
lldb_private::Language::EitherTypeScavenger
Definition: Language.h:96
lldb_private::CompilerType::IsPossibleDynamicType
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus, bool check_objc) const
Definition: CompilerType.cpp:214
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:75
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::formatters::NSDataSummaryProvider< false >
template bool NSDataSummaryProvider< false >(ValueObject &, Stream &, const TypeSummaryOptions &)
TypeSystemClang.h
lldb_private::ConstString::IsEmpty
bool IsEmpty() const
Test for empty string.
Definition: ConstString.h:304
lldb_private::TypeSummaryImpl::Flags::SetShowMembersOneLiner
Flags & SetShowMembersOneLiner(bool value=true)
Definition: TypeSummary.h:160
lldb_private::Language::TypeScavenger
Definition: Language.h:31
lldb_private::StreamString::Clear
void Clear()
Definition: StreamString.cpp:31
lldb_private::formatters::NSDataSummaryProvider< true >
template bool NSDataSummaryProvider< true >(ValueObject &, Stream &, const TypeSummaryOptions &)
lldb_private::ObjCLanguageRuntime::GetClassDescriptor
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
Definition: ObjCLanguageRuntime.cpp:235
StreamString.h
lldb_private::formatters::CFBinaryHeapSummaryProvider
bool CFBinaryHeapSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CF.cpp:227
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::formatters::NSTimeZoneSummaryProvider
bool NSTimeZoneSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:90
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::formatters::NSDictionarySummaryProvider< false >
template bool NSDictionarySummaryProvider< false >(ValueObject &, Stream &, const TypeSummaryOptions &)
ObjCLanguage.h
lldb_private::formatters::NSIndexSetSummaryProvider
bool NSIndexSetSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:234
lldb_private::formatters::NSMachPortSummaryProvider
bool NSMachPortSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:188
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
NSSet.h
lldb_private::CompilerType::IsTypedefType
bool IsTypedefType() const
Definition: CompilerType.cpp:230
CoreMedia.h
CF.h
lldb::eLanguageTypeObjC
@ eLanguageTypeObjC
Objective-C.
Definition: lldb-enumerations.h:453
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::ObjCLanguage
Definition: ObjCLanguage.h:22
lldb_private::Stream::PutChar
size_t PutChar(char ch)
Definition: Stream.cpp:104
CompilerType.h
lldb_private::ObjCLanguage::MethodName
Definition: ObjCLanguage.h:26
ValueObject.h
lldb_private::TypeSummaryImpl::Flags::SetCascades
Flags & SetCascades(bool value=true)
Definition: TypeSummary.h:82
lldb_private::formatters::NSDictionarySummaryProvider< true >
template bool NSDictionarySummaryProvider< true >(ValueObject &, Stream &, const TypeSummaryOptions &)
lldb_private::formatters::NSURLSummaryProvider
bool NSURLSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:765
lldb_private::formatters::NSMutableAttributedStringSummaryProvider
bool NSMutableAttributedStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSString.cpp:326
lldb_private::ObjCLanguage::MethodName::GetSelector
ConstString GetSelector()
Definition: ObjCLanguage.cpp:164
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::ObjCSELSummaryProvider< true >
template bool ObjCSELSummaryProvider< true >(ValueObject &, Stream &, const TypeSummaryOptions &)
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
DataVisualization.h
lldb_private::formatters::NSExceptionSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * NSExceptionSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
Definition: NSException.cpp:178
uint32_t
lldb_private::Language
Definition: Language.h:29
lldb_private::formatters::NSException_SummaryProvider
bool NSException_SummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSException.cpp:100
lldb_private::Stream::EOL
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:128
lldb_private::CompilerType::GetTypeInfo
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
Definition: CompilerType.cpp:290
NSDictionary.h
lldb_private::formatters::NSNotificationSummaryProvider
bool NSNotificationSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:139
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::ValueObject::GetCompilerType
CompilerType GetCompilerType()
Definition: ValueObject.h:352
ObjCLanguageRuntime.h
PluginManager.h
lldb_private::formatters::NSBundleSummaryProvider
bool NSBundleSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: Cocoa.cpp:39
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
lldb_private::formatters::CFBitVectorSummaryProvider
bool CFBitVectorSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CF.cpp:109
lldb_private::CompilerType::GetTypedefedType
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
Definition: CompilerType.cpp:464
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::formatters
Definition: CXXFunctionPointer.h:15
lldb_private::ExecutionContextScope::CalculateProcess
virtual lldb::ProcessSP CalculateProcess()=0
lldb::eLanguageTypeC
@ eLanguageTypeC
Non-standardized C, such as K&R.
Definition: lldb-enumerations.h:439
NSString.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::formatters::CFBagSummaryProvider
bool CFBagSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: CF.cpp:45
lldb_private::ExecutionContextScope::CalculateTarget
virtual lldb::TargetSP CalculateTarget()=0
lldb_private::CompilerType::GetMinimumLanguage
lldb::LanguageType GetMinimumLanguage()
Definition: CompilerType.cpp:298
lldb_private::Language::ImageListTypeScavenger
Definition: Language.h:57
lldb_private::ObjCLanguage::MethodName::IsValid
bool IsValid(bool strict) const
Definition: ObjCLanguage.h:45
lldb_private::SyntheticChildren::Flags::SetSkipPointers
Flags & SetSkipPointers(bool value=true)
Definition: TypeSynthetic.h:176
ConstString.h
lldb_private::formatters::NSErrorSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * NSErrorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
Definition: NSError.cpp:185
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
Cocoa.h
lldb_private::formatters::NSAttributedStringSummaryProvider
bool NSAttributedStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSString.cpp:297
lldb_private::TypeSummaryImpl::Flags::SetHideItemNames
Flags & SetHideItemNames(bool value=true)
Definition: TypeSummary.h:173
FormattersHelpers.h
lldb
Definition: SBAddress.h:15
LoadCoreMediaFormatters
static void LoadCoreMediaFormatters(TypeCategoryImplSP objc_category_sp)
Definition: ObjCLanguage.cpp:906
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:89
lldb_private::formatters::NSSetSyntheticFrontEndCreator
SyntheticChildrenFrontEnd * NSSetSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: NSSet.cpp:340
lldb_private::SyntheticChildren::Flags::SetCascades
Flags & SetCascades(bool value=true)
Definition: TypeSynthetic.h:163
lldb_private::TypeSummaryImpl::Flags::SetSkipReferences
Flags & SetSkipReferences(bool value=true)
Definition: TypeSummary.h:108