LLDB  mainline
ObjCLanguageRuntime.h
Go to the documentation of this file.
1 //===-- ObjCLanguageRuntime.h -----------------------------------*- C++ -*-===//
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 #ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
10 #define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
11 
12 #include <functional>
13 #include <map>
14 #include <memory>
15 #include <unordered_set>
16 
17 #include "llvm/Support/Casting.h"
18 
23 #include "lldb/Symbol/Type.h"
26 #include "lldb/lldb-private.h"
27 
29 
30 namespace lldb_private {
31 
32 class TypeSystemClang;
33 class UtilityFunction;
34 
36 public:
37  enum class ObjCRuntimeVersions {
39  eAppleObjC_V1 = 1,
40  eAppleObjC_V2 = 2
41  };
42 
44 
46  typedef std::shared_ptr<ClassDescriptor> ClassDescriptorSP;
47 
48  // the information that we want to support retrieving from an ObjC class this
49  // needs to be pure virtual since there are at least 2 different
50  // implementations of the runtime, and more might come
52  public:
54 
55  virtual ~ClassDescriptor() = default;
56 
57  virtual ConstString GetClassName() = 0;
58 
59  virtual ClassDescriptorSP GetSuperclass() = 0;
60 
61  virtual ClassDescriptorSP GetMetaclass() const = 0;
62 
63  // virtual if any implementation has some other version-specific rules but
64  // for the known v1/v2 this is all that needs to be done
65  virtual bool IsKVO() {
67  const char *class_name = GetClassName().AsCString();
68  if (class_name && *class_name)
69  m_is_kvo =
70  (LazyBool)(strstr(class_name, "NSKVONotifying_") == class_name);
71  }
72  return (m_is_kvo == eLazyBoolYes);
73  }
74 
75  // virtual if any implementation has some other version-specific rules but
76  // for the known v1/v2 this is all that needs to be done
77  virtual bool IsCFType() {
78  if (m_is_cf == eLazyBoolCalculate) {
79  const char *class_name = GetClassName().AsCString();
80  if (class_name && *class_name)
81  m_is_cf = (LazyBool)(strcmp(class_name, "__NSCFType") == 0 ||
82  strcmp(class_name, "NSCFType") == 0);
83  }
84  return (m_is_cf == eLazyBoolYes);
85  }
86 
87  virtual bool IsValid() = 0;
88 
89  /// There are two routines in the ObjC runtime that tagged pointer clients
90  /// can call to get the value from their tagged pointer, one that retrieves
91  /// it as an unsigned value and one a signed value. These two
92  /// GetTaggedPointerInfo methods mirror those two ObjC runtime calls.
93  /// @{
94  virtual bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
95  uint64_t *value_bits = nullptr,
96  uint64_t *payload = nullptr) = 0;
97 
98  virtual bool GetTaggedPointerInfoSigned(uint64_t *info_bits = nullptr,
99  int64_t *value_bits = nullptr,
100  uint64_t *payload = nullptr) = 0;
101  /// @}
102 
103  virtual uint64_t GetInstanceSize() = 0;
104 
105  // use to implement version-specific additional constraints on pointers
106  virtual bool CheckPointer(lldb::addr_t value, uint32_t ptr_size) const {
107  return true;
108  }
109 
110  virtual ObjCISA GetISA() = 0;
111 
112  // This should return true iff the interface could be completed
113  virtual bool
114  Describe(std::function<void(ObjCISA)> const &superclass_func,
115  std::function<bool(const char *, const char *)> const
116  &instance_method_func,
117  std::function<bool(const char *, const char *)> const
118  &class_method_func,
119  std::function<bool(const char *, const char *, lldb::addr_t,
120  uint64_t)> const &ivar_func) const {
121  return false;
122  }
123 
124  lldb::TypeSP GetType() { return m_type_wp.lock(); }
125 
126  void SetType(const lldb::TypeSP &type_sp) { m_type_wp = type_sp; }
127 
128  struct iVarDescriptor {
131  uint64_t m_size;
132  int32_t m_offset;
133  };
134 
135  virtual size_t GetNumIVars() { return 0; }
136 
137  virtual iVarDescriptor GetIVarAtIndex(size_t idx) {
138  return iVarDescriptor();
139  }
140 
141  protected:
142  bool IsPointerValid(lldb::addr_t value, uint32_t ptr_size,
143  bool allow_NULLs = false, bool allow_tagged = false,
144  bool check_version_specific = false) const;
145 
146  private:
149  lldb::TypeWP m_type_wp;
150  };
151 
153  public:
154  virtual ~EncodingToType();
155 
156  virtual CompilerType RealizeType(TypeSystemClang &ast_ctx, const char *name,
157  bool for_expression) = 0;
158  virtual CompilerType RealizeType(const char *name, bool for_expression);
159 
160  protected:
161  std::shared_ptr<TypeSystemClang> m_scratch_ast_ctx_sp;
162  };
163 
165  public:
167 
168  ~ObjCExceptionPrecondition() override = default;
169 
170  bool EvaluatePrecondition(StoppointCallbackContext &context) override;
171  void GetDescription(Stream &stream, lldb::DescriptionLevel level) override;
172  Status ConfigurePrecondition(Args &args) override;
173 
174  protected:
175  void AddClassName(const char *class_name);
176 
177  private:
178  std::unordered_set<std::string> m_class_names;
179  };
180 
181  static lldb::BreakpointPreconditionSP
183  bool throw_bp);
184 
186  public:
187  virtual ~TaggedPointerVendor() = default;
188 
189  virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr) = 0;
190 
193 
194  protected:
195  TaggedPointerVendor() = default;
196 
197  private:
198  TaggedPointerVendor(const TaggedPointerVendor &) = delete;
199  const TaggedPointerVendor &operator=(const TaggedPointerVendor &) = delete;
200  };
201 
202  ~ObjCLanguageRuntime() override;
203 
204  static char ID;
205 
206  bool isA(const void *ClassID) const override {
207  return ClassID == &ID || LanguageRuntime::isA(ClassID);
208  }
209 
210  static bool classof(const LanguageRuntime *runtime) {
211  return runtime->isA(&ID);
212  }
213 
214  static ObjCLanguageRuntime *Get(Process &process) {
215  return llvm::cast_or_null<ObjCLanguageRuntime>(
217  }
218 
219  virtual TaggedPointerVendor *GetTaggedPointerVendor() { return nullptr; }
220 
221  typedef std::shared_ptr<EncodingToType> EncodingToTypeSP;
222 
224 
226 
228 
229  virtual ClassDescriptorSP
231 
233 
235 
238  }
239 
240  virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) = 0;
241 
242  virtual bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) = 0;
243 
244  virtual bool HasReadObjCLibrary() = 0;
245 
246  // These two methods actually use different caches. The only time we'll
247  // cache a sel_str is if we found a "selector specific stub" for the selector
248  // and conversely we only add to the SEL cache if we saw a regular dispatch.
251  llvm::StringRef sel_str);
252 
253  void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel,
254  lldb::addr_t impl_addr);
255 
256  void AddToMethodCache(lldb::addr_t class_addr, llvm::StringRef sel_str,
257  lldb::addr_t impl_addr);
258 
260 
261  void AddToClassNameCache(lldb::addr_t class_addr, const char *name,
262  lldb::TypeSP type_sp);
263 
264  void AddToClassNameCache(lldb::addr_t class_addr,
265  const TypeAndOrName &class_or_type_name);
266 
267  lldb::TypeSP LookupInCompleteClassCache(ConstString &name);
268 
269  llvm::Optional<CompilerType> GetRuntimeType(CompilerType base_type) override;
270 
271  virtual llvm::Expected<std::unique_ptr<UtilityFunction>>
273 
276  }
277 
278  bool IsValidISA(ObjCISA isa) {
280  return m_isa_to_descriptor.count(isa) > 0;
281  }
282 
283  virtual void UpdateISAToDescriptorMapIfNeeded() = 0;
284 
288  }
289  }
290 
291  virtual ObjCISA GetISA(ConstString name);
292 
293  virtual ObjCISA GetParentClass(ObjCISA isa);
294 
295  // Finds the byte offset of the child_type ivar in parent_type. If it can't
296  // find the offset, returns LLDB_INVALID_IVAR_OFFSET.
297 
298  virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type,
299  const char *ivar_name);
300 
305  else
307  }
308 
310  }
311 
312  void SymbolsDidLoad(const ModuleList &module_list) override {
314  }
315 
316  bool GetTypeBitSize(const CompilerType &compiler_type,
317  uint64_t &size) override;
318 
319  /// Check whether the name is "self" or "_cmd" and should show up in
320  /// "frame variable".
321  bool IsAllowedRuntimeValue(ConstString name) override;
322 
323 protected:
324  // Classes that inherit from ObjCLanguageRuntime can see and modify these
325  ObjCLanguageRuntime(Process *process);
326 
327  virtual bool CalculateHasNewLiteralsAndIndexing() { return false; }
328 
329  bool ISAIsCached(ObjCISA isa) const {
330  return m_isa_to_descriptor.find(isa) != m_isa_to_descriptor.end();
331  }
332 
333  bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp) {
334  if (isa != 0) {
335  m_isa_to_descriptor[isa] = descriptor_sp;
336  return true;
337  }
338  return false;
339  }
340 
341  bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp,
342  const char *class_name);
343 
344  bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp,
345  uint32_t class_name_hash) {
346  if (isa != 0) {
347  m_isa_to_descriptor[isa] = descriptor_sp;
348  m_hash_to_isa_map.insert(std::make_pair(class_name_hash, isa));
349  return true;
350  }
351  return false;
352  }
353 
354 private:
355  // We keep two maps of <Class,Selector>->Implementation so we don't have
356  // to call the resolver function over and over.
357  // The first comes from regular obj_msgSend type dispatch, and maps the
358  // class + uniqued SEL value to an implementation.
359  // The second comes from the "selector-specific stubs", which are always
360  // of the form _objc_msgSend$SelectorName, so we don't know the uniqued
361  // selector, only the string name.
362 
363  // FIXME: We need to watch for the loading of Protocols, and flush the cache
364  // for any
365  // class that we see so changed.
366 
367  struct ClassAndSel {
368  ClassAndSel() = default;
369 
370  ClassAndSel(lldb::addr_t in_class_addr, lldb::addr_t in_sel_addr)
371  : class_addr(in_class_addr), sel_addr(in_sel_addr) {}
372 
373  bool operator==(const ClassAndSel &rhs) {
374  if (class_addr == rhs.class_addr && sel_addr == rhs.sel_addr)
375  return true;
376  else
377  return false;
378  }
379 
380  bool operator<(const ClassAndSel &rhs) const {
381  if (class_addr < rhs.class_addr)
382  return true;
383  else if (class_addr > rhs.class_addr)
384  return false;
385  else {
386  if (sel_addr < rhs.sel_addr)
387  return true;
388  else
389  return false;
390  }
391  }
392 
395  };
396 
397  struct ClassAndSelStr {
398  ClassAndSelStr() = default;
399 
400  ClassAndSelStr(lldb::addr_t in_class_addr, llvm::StringRef in_sel_name)
401  : class_addr(in_class_addr), sel_name(in_sel_name) {}
402 
403  bool operator==(const ClassAndSelStr &rhs) {
404  return class_addr == rhs.class_addr && sel_name == rhs.sel_name;
405  }
406 
407  bool operator<(const ClassAndSelStr &rhs) const {
408  if (class_addr < rhs.class_addr)
409  return true;
410  else if (class_addr > rhs.class_addr)
411  return false;
412  else
414  }
415 
418  };
419 
420  typedef std::map<ClassAndSel, lldb::addr_t> MsgImplMap;
421  typedef std::map<ClassAndSelStr, lldb::addr_t> MsgImplStrMap;
422  typedef std::map<ObjCISA, ClassDescriptorSP> ISAToDescriptorMap;
423  typedef std::multimap<uint32_t, ObjCISA> HashToISAMap;
424  typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator;
425  typedef HashToISAMap::iterator HashToISAIterator;
427 
434 
435 protected:
437 
438  typedef std::map<ConstString, lldb::TypeWP> CompleteClassMap;
440 
442  size_t operator()(ConstString arg) const // for hashing
443  {
444  return (size_t)arg.GetCString();
445  }
447  ConstString arg2) const // for equality
448  {
449  return arg1.operator==(arg2);
450  }
451  };
452  typedef std::unordered_set<ConstString, ConstStringSetHelpers,
453  ConstStringSetHelpers>
456 
458 
459  friend class ::CommandObjectObjC_ClassTable_Dump;
460 
461  std::pair<ISAToDescriptorIterator, ISAToDescriptorIterator>
462  GetDescriptorIteratorPair(bool update_if_needed = true);
463 
464  void ReadObjCLibraryIfNeeded(const ModuleList &module_list);
465 
466  ObjCLanguageRuntime(const ObjCLanguageRuntime &) = delete;
467  const ObjCLanguageRuntime &operator=(const ObjCLanguageRuntime &) = delete;
468 };
469 
470 } // namespace lldb_private
471 
472 #endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
lldb_private::ObjCLanguageRuntime::ObjCLanguageRuntime
ObjCLanguageRuntime(Process *process)
Definition: ObjCLanguageRuntime.cpp:39
lldb_private::ObjCLanguageRuntime::ClassDescriptor::IsValid
virtual bool IsValid()=0
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::ObjCLanguageRuntime::ClassDescriptor::~ClassDescriptor
virtual ~ClassDescriptor()=default
lldb_private::ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor::m_offset
int32_t m_offset
Definition: ObjCLanguageRuntime.h:132
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor
Definition: ObjCLanguageRuntime.h:185
lldb_private::ObjCLanguageRuntime::GetByteOffsetForIvar
virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name)
Definition: ObjCLanguageRuntime.cpp:166
lldb_private::StoppointCallbackContext
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
Definition: StoppointCallbackContext.h:26
lldb_private::ObjCLanguageRuntime::ConstStringSetHelpers::operator()
bool operator()(ConstString arg1, ConstString arg2) const
Definition: ObjCLanguageRuntime.h:446
lldb_private::ObjCLanguageRuntime::GetNonKVOClassDescriptor
ClassDescriptorSP GetNonKVOClassDescriptor(ValueObject &in_value)
Definition: ObjCLanguageRuntime.cpp:281
lldb_private::ObjCLanguageRuntime::m_complete_class_cache
CompleteClassMap m_complete_class_cache
Definition: ObjCLanguageRuntime.h:439
lldb_private::ObjCLanguageRuntime::ClassAndSel::class_addr
lldb::addr_t class_addr
Definition: ObjCLanguageRuntime.h:393
lldb_private::ObjCLanguageRuntime::GetLanguageType
lldb::LanguageType GetLanguageType() const override
Definition: ObjCLanguageRuntime.h:236
lldb_private::ObjCLanguageRuntime::GetTaggedPointerVendor
virtual TaggedPointerVendor * GetTaggedPointerVendor()
Definition: ObjCLanguageRuntime.h:219
lldb_private::ObjCLanguageRuntime
Definition: ObjCLanguageRuntime.h:35
lldb_private::ObjCLanguageRuntime::GetDescriptorIterator
ISAToDescriptorIterator GetDescriptorIterator(ConstString name)
Definition: ObjCLanguageRuntime.cpp:193
lldb_private::ObjCLanguageRuntime::ClassDescriptorSP
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
Definition: ObjCLanguageRuntime.h:45
lldb_private::ObjCLanguageRuntime::ReadObjCLibrary
virtual bool ReadObjCLibrary(const lldb::ModuleSP &module_sp)=0
lldb_private::ObjCLanguageRuntime::EncodingToType::m_scratch_ast_ctx_sp
std::shared_ptr< TypeSystemClang > m_scratch_ast_ctx_sp
Definition: ObjCLanguageRuntime.h:161
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::ObjCExceptionPrecondition
ObjCExceptionPrecondition()
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetMetaclass
virtual ClassDescriptorSP GetMetaclass() const =0
lldb_private::ConstString::Compare
static int Compare(ConstString lhs, ConstString rhs, const bool case_sensitive=true)
Compare two string objects.
Definition: ConstString.cpp:258
lldb_private::ObjCLanguageRuntime::GetClassDescriptorFromClassName
virtual ClassDescriptorSP GetClassDescriptorFromClassName(ConstString class_name)
Definition: ObjCLanguageRuntime.cpp:249
lldb_private::ObjCLanguageRuntime::Get
static ObjCLanguageRuntime * Get(Process &process)
Definition: ObjCLanguageRuntime.h:214
lldb_private::ObjCLanguageRuntime::CompleteClassSet
std::unordered_set< ConstString, ConstStringSetHelpers, ConstStringSetHelpers > CompleteClassSet
Definition: ObjCLanguageRuntime.h:454
lldb_private::ObjCLanguageRuntime::GetClassDescriptorFromISA
virtual ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa)
Definition: ObjCLanguageRuntime.cpp:296
lldb_private::ObjCLanguageRuntime::ClassAndSelStr::sel_name
ConstString sel_name
Definition: ObjCLanguageRuntime.h:417
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
lldb_private::ObjCLanguageRuntime::HashToISAIterator
HashToISAMap::iterator HashToISAIterator
Definition: ObjCLanguageRuntime.h:425
lldb_private::Process
Definition: Process.h:338
lldb_private::ObjCLanguageRuntime::EncodingToTypeSP
std::shared_ptr< EncodingToType > EncodingToTypeSP
Definition: ObjCLanguageRuntime.h:221
lldb_private::ObjCLanguageRuntime::~ObjCLanguageRuntime
~ObjCLanguageRuntime() override
lldb_private::ObjCLanguageRuntime::ClassAndSel::operator<
bool operator<(const ClassAndSel &rhs) const
Definition: ObjCLanguageRuntime.h:380
lldb_private::ObjCLanguageRuntime::ClassDescriptor::IsPointerValid
bool IsPointerValid(lldb::addr_t value, uint32_t ptr_size, bool allow_NULLs=false, bool allow_tagged=false, bool check_version_specific=false) const
Definition: ObjCLanguageRuntime.cpp:171
lldb_private::ObjCLanguageRuntime::GetISA
virtual ObjCISA GetISA(ConstString name)
Definition: ObjCLanguageRuntime.cpp:185
lldb_private::ObjCLanguageRuntime::GetBreakpointExceptionPrecondition
static lldb::BreakpointPreconditionSP GetBreakpointExceptionPrecondition(lldb::LanguageType language, bool throw_bp)
Definition: ObjCLanguageRuntime.cpp:379
lldb_private::ObjCLanguageRuntime::m_impl_str_cache
MsgImplStrMap m_impl_str_cache
Definition: ObjCLanguageRuntime.h:429
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::ObjCLanguageRuntime::GetTypeBitSize
bool GetTypeBitSize(const CompilerType &compiler_type, uint64_t &size) override
Definition: ObjCLanguageRuntime.cpp:344
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetIVarAtIndex
virtual iVarDescriptor GetIVarAtIndex(size_t idx)
Definition: ObjCLanguageRuntime.h:137
lldb_private::ObjCLanguageRuntime::ClassAndSelStr::ClassAndSelStr
ClassAndSelStr()=default
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Args
Definition: Args.h:33
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::ObjCLanguageRuntime::ClassAndSelStr::operator<
bool operator<(const ClassAndSelStr &rhs) const
Definition: ObjCLanguageRuntime.h:407
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2
@ eAppleObjC_V2
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb_private::LanguageRuntime::isA
virtual bool isA(const void *ClassID) const
Definition: LanguageRuntime.h:173
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetSuperclass
virtual ClassDescriptorSP GetSuperclass()=0
lldb_private::ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor::m_type
CompilerType m_type
Definition: ObjCLanguageRuntime.h:130
lldb_private::ObjCLanguageRuntime::GetParentClass
virtual ObjCISA GetParentClass(ObjCISA isa)
Definition: ObjCLanguageRuntime.cpp:238
lldb_private::ObjCLanguageRuntime::m_hash_to_isa_map
HashToISAMap m_hash_to_isa_map
Definition: ObjCLanguageRuntime.h:432
lldb_private::ObjCLanguageRuntime::AddClass
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp, uint32_t class_name_hash)
Definition: ObjCLanguageRuntime.h:344
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition
Status ConfigurePrecondition(Args &args) override
Definition: ObjCLanguageRuntime.cpp:407
BreakpointPrecondition.h
lldb_private::ObjCLanguageRuntime::ClassAndSel::ClassAndSel
ClassAndSel()=default
lldb_private::ObjCLanguageRuntime::LookupInCompleteClassCache
lldb::TypeSP LookupInCompleteClassCache(ConstString &name)
Definition: ObjCLanguageRuntime.cpp:109
lldb_private::ObjCLanguageRuntime::ClassDescriptor::IsCFType
virtual bool IsCFType()
Definition: ObjCLanguageRuntime.h:77
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetType
lldb::TypeSP GetType()
Definition: ObjCLanguageRuntime.h:124
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor::~TaggedPointerVendor
virtual ~TaggedPointerVendor()=default
lldb_private::ObjCLanguageRuntime::GetRuntimeType
llvm::Optional< CompilerType > GetRuntimeType(CompilerType base_type) override
Definition: ObjCLanguageRuntime.cpp:417
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetInstanceSize
virtual uint64_t GetInstanceSize()=0
lldb_private::ObjCLanguageRuntime::ClassDescriptor::Describe
virtual bool Describe(std::function< void(ObjCISA)> const &superclass_func, std::function< bool(const char *, const char *)> const &instance_method_func, std::function< bool(const char *, const char *)> const &class_method_func, std::function< bool(const char *, const char *, lldb::addr_t, uint64_t)> const &ivar_func) const
Definition: ObjCLanguageRuntime.h:114
lldb_private::ObjCLanguageRuntime::UpdateISAToDescriptorMap
void UpdateISAToDescriptorMap()
Definition: ObjCLanguageRuntime.h:285
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::GetDescription
void GetDescription(Stream &stream, lldb::DescriptionLevel level) override
Definition: ObjCLanguageRuntime.cpp:404
lldb_private::ModuleList
Definition: ModuleList.h:82
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::m_class_names
std::unordered_set< std::string > m_class_names
Definition: ObjCLanguageRuntime.h:178
lldb_private::ObjCLanguageRuntime::isA
bool isA(const void *ClassID) const override
Definition: ObjCLanguageRuntime.h:206
lldb_private::Runtime::m_process
Process * m_process
Definition: Runtime.h:29
lldb_private::ObjCLanguageRuntime::m_impl_cache
MsgImplMap m_impl_cache
Definition: ObjCLanguageRuntime.h:428
lldb_private::ObjCLanguageRuntime::GetClassDescriptor
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
Definition: ObjCLanguageRuntime.cpp:258
Type.h
lldb_private::ObjCLanguageRuntime::EncodingToType::~EncodingToType
virtual ~EncodingToType()
lldb_private::ObjCLanguageRuntime::m_has_new_literals_and_indexing
LazyBool m_has_new_literals_and_indexing
Definition: ObjCLanguageRuntime.h:430
lldb_private::ObjCLanguageRuntime::GetDescriptorIteratorPair
std::pair< ISAToDescriptorIterator, ISAToDescriptorIterator > GetDescriptorIteratorPair(bool update_if_needed=true)
Definition: ObjCLanguageRuntime.cpp:228
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::EvaluatePrecondition
bool EvaluatePrecondition(StoppointCallbackContext &context) override
Definition: ObjCLanguageRuntime.cpp:399
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor::TaggedPointerVendor
TaggedPointerVendor()=default
lldb_private::ObjCLanguageRuntime::HasNewLiteralsAndIndexing
bool HasNewLiteralsAndIndexing()
Definition: ObjCLanguageRuntime.h:301
lldb_private::ConstString
Definition: ConstString.h:39
lldb_private::ObjCLanguageRuntime::IsAllowedRuntimeValue
bool IsAllowedRuntimeValue(ConstString name) override
Check whether the name is "self" or "_cmd" and should show up in "frame variable".
Definition: ObjCLanguageRuntime.cpp:46
lldb_private::ObjCLanguageRuntime::CalculateHasNewLiteralsAndIndexing
virtual bool CalculateHasNewLiteralsAndIndexing()
Definition: ObjCLanguageRuntime.h:327
lldb_private::ObjCLanguageRuntime::LookupInClassNameCache
TypeAndOrName LookupInClassNameCache(lldb::addr_t class_addr)
lldb_private::ObjCLanguageRuntime::TypeSizeCache
ThreadSafeDenseMap< void *, uint64_t > TypeSizeCache
Definition: ObjCLanguageRuntime.h:426
lldb_private::ObjCLanguageRuntime::ISAToDescriptorMap
std::map< ObjCISA, ClassDescriptorSP > ISAToDescriptorMap
Definition: ObjCLanguageRuntime.h:422
PluginInterface.h
CommandObjectObjC_ClassTable_Dump
Definition: AppleObjCRuntimeV2.cpp:839
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions::eObjC_VersionUnknown
@ eObjC_VersionUnknown
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions
ObjCRuntimeVersions
Definition: ObjCLanguageRuntime.h:37
lldb_private::ObjCLanguageRuntime::ReadObjCLibraryIfNeeded
void ReadObjCLibraryIfNeeded(const ModuleList &module_list)
lldb_private::ObjCLanguageRuntime::ClassDescriptor::m_is_kvo
LazyBool m_is_kvo
Definition: ObjCLanguageRuntime.h:147
lldb_private::ObjCLanguageRuntime::IsModuleObjCLibrary
virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp)=0
lldb_private::ObjCLanguageRuntime::ClassAndSelStr::class_addr
lldb::addr_t class_addr
Definition: ObjCLanguageRuntime.h:416
lldb_private::ObjCLanguageRuntime::GetRuntimeVersion
virtual ObjCRuntimeVersions GetRuntimeVersion() const
Definition: ObjCLanguageRuntime.h:274
lldb_private::LanguageRuntime
Definition: LanguageRuntime.h:60
lldb_private::ObjCLanguageRuntime::m_negative_complete_class_cache
CompleteClassSet m_negative_complete_class_cache
Definition: ObjCLanguageRuntime.h:455
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetNumIVars
virtual size_t GetNumIVars()
Definition: ObjCLanguageRuntime.h:135
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::ObjCLanguageRuntime::ISAIsCached
bool ISAIsCached(ObjCISA isa) const
Definition: ObjCLanguageRuntime.h:329
lldb_private::ObjCLanguageRuntime::AddClass
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp)
Definition: ObjCLanguageRuntime.h:333
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V1
@ eAppleObjC_V1
lldb_private::ObjCLanguageRuntime::m_isa_to_descriptor
ISAToDescriptorMap m_isa_to_descriptor
Definition: ObjCLanguageRuntime.h:431
CompilerType.h
lldb_private::ObjCLanguageRuntime::m_isa_to_descriptor_stop_id
uint32_t m_isa_to_descriptor_stop_id
Definition: ObjCLanguageRuntime.h:436
lldb_private::ObjCLanguageRuntime::UpdateISAToDescriptorMapIfNeeded
virtual void UpdateISAToDescriptorMapIfNeeded()=0
lldb_private::ObjCLanguageRuntime::EncodingToType::RealizeType
virtual CompilerType RealizeType(TypeSystemClang &ast_ctx, const char *name, bool for_expression)=0
lldb-private.h
lldb::eLanguageTypeObjC
@ eLanguageTypeObjC
Objective-C.
Definition: lldb-enumerations.h:454
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetISA
virtual ObjCISA GetISA()=0
lldb_private::ObjCLanguageRuntime::GetEncodingToType
virtual EncodingToTypeSP GetEncodingToType()
Definition: ObjCLanguageRuntime.cpp:340
lldb_private::ThreadSafeDenseMap< void *, uint64_t >
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor::operator=
const TaggedPointerVendor & operator=(const TaggedPointerVendor &)=delete
lldb_private::ObjCLanguageRuntime::AddToMethodCache
void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel, lldb::addr_t impl_addr)
Definition: ObjCLanguageRuntime.cpp:64
lldb_private::ObjCLanguageRuntime::ClassAndSelStr::operator==
bool operator==(const ClassAndSelStr &rhs)
Definition: ObjCLanguageRuntime.h:403
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor::GetClassDescriptor
virtual ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(lldb::addr_t ptr)=0
lldb_private::ObjCLanguageRuntime::ClassDescriptor
Definition: ObjCLanguageRuntime.h:51
lldb_private::ObjCLanguageRuntime::ClassAndSel::operator==
bool operator==(const ClassAndSel &rhs)
Definition: ObjCLanguageRuntime.h:373
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::ObjCLanguageRuntime::operator=
const ObjCLanguageRuntime & operator=(const ObjCLanguageRuntime &)=delete
uint32_t
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::ObjCLanguageRuntime::ID
static char ID
Definition: ObjCLanguageRuntime.h:204
lldb_private::ObjCLanguageRuntime::ISAToDescriptorIterator
ISAToDescriptorMap::iterator ISAToDescriptorIterator
Definition: ObjCLanguageRuntime.h:424
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor::IsPossibleTaggedPointer
virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr)=0
lldb_private::ObjCLanguageRuntime::ClassDescriptor::IsKVO
virtual bool IsKVO()
Definition: ObjCLanguageRuntime.h:65
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetClassName
virtual ConstString GetClassName()=0
lldb_private::ObjCLanguageRuntime::ObjCISA
lldb::addr_t ObjCISA
Definition: ObjCLanguageRuntime.h:43
lldb_private::ObjCLanguageRuntime::IsValidISA
bool IsValidISA(ObjCISA isa)
Definition: ObjCLanguageRuntime.h:278
lldb_private::Process::GetLanguageRuntime
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
Definition: Process.cpp:1512
lldb_private::ObjCLanguageRuntime::ClassDescriptor::ClassDescriptor
ClassDescriptor()
Definition: ObjCLanguageRuntime.h:53
lldb_private::ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor
Definition: ObjCLanguageRuntime.h:128
lldb_private::ObjCLanguageRuntime::ClassDescriptor::m_is_cf
LazyBool m_is_cf
Definition: ObjCLanguageRuntime.h:148
lldb_private::ObjCLanguageRuntime::HashToISAMap
std::multimap< uint32_t, ObjCISA > HashToISAMap
Definition: ObjCLanguageRuntime.h:423
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetTaggedPointerInfo
virtual bool GetTaggedPointerInfo(uint64_t *info_bits=nullptr, uint64_t *value_bits=nullptr, uint64_t *payload=nullptr)=0
There are two routines in the ObjC runtime that tagged pointer clients can call to get the value from...
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:35
ThreadSafeDenseMap.h
lldb_private::ObjCLanguageRuntime::MsgImplStrMap
std::map< ClassAndSelStr, lldb::addr_t > MsgImplStrMap
Definition: ObjCLanguageRuntime.h:421
lldb_private::ObjCLanguageRuntime::CreateObjectChecker
virtual llvm::Expected< std::unique_ptr< UtilityFunction > > CreateObjectChecker(std::string name, ExecutionContext &exe_ctx)=0
lldb_private::ObjCLanguageRuntime::classof
static bool classof(const LanguageRuntime *runtime)
Definition: ObjCLanguageRuntime.h:210
LanguageRuntime.h
lldb_private::BreakpointPrecondition
Definition: BreakpointPrecondition.h:21
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::~ObjCExceptionPrecondition
~ObjCExceptionPrecondition() override=default
lldb_private::ObjCLanguageRuntime::ClassDescriptor::SetType
void SetType(const lldb::TypeSP &type_sp)
Definition: ObjCLanguageRuntime.h:126
lldb_private::ObjCLanguageRuntime::ClassAndSelStr::ClassAndSelStr
ClassAndSelStr(lldb::addr_t in_class_addr, llvm::StringRef in_sel_name)
Definition: ObjCLanguageRuntime.h:400
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
lldb_private::ObjCLanguageRuntime::m_type_size_cache
TypeSizeCache m_type_size_cache
Definition: ObjCLanguageRuntime.h:433
lldb_private::TypeSystemClang
A TypeSystem implementation based on Clang.
Definition: TypeSystemClang.h:105
ConstString.h
lldb_private::ObjCLanguageRuntime::ConstStringSetHelpers::operator()
size_t operator()(ConstString arg) const
Definition: ObjCLanguageRuntime.h:442
lldb_private::ObjCLanguageRuntime::ClassDescriptor::m_type_wp
lldb::TypeWP m_type_wp
Definition: ObjCLanguageRuntime.h:149
lldb_private::ObjCLanguageRuntime::EncodingToType
Definition: ObjCLanguageRuntime.h:152
lldb_private::ObjCLanguageRuntime::ClassAndSel::sel_addr
lldb::addr_t sel_addr
Definition: ObjCLanguageRuntime.h:394
lldb_private::ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor::m_size
uint64_t m_size
Definition: ObjCLanguageRuntime.h:131
lldb_private::ObjCLanguageRuntime::CompleteClassMap
std::map< ConstString, lldb::TypeWP > CompleteClassMap
Definition: ObjCLanguageRuntime.h:438
lldb_private::ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor::m_name
ConstString m_name
Definition: ObjCLanguageRuntime.h:129
lldb_private::ObjCLanguageRuntime::SymbolsDidLoad
void SymbolsDidLoad(const ModuleList &module_list) override
Definition: ObjCLanguageRuntime.h:312
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::AddClassName
void AddClassName(const char *class_name)
Definition: ObjCLanguageRuntime.cpp:391
lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition
Definition: ObjCLanguageRuntime.h:164
lldb_private::TypeAndOrName
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:399
lldb_private::ObjCLanguageRuntime::MsgImplMap
std::map< ClassAndSel, lldb::addr_t > MsgImplMap
Definition: ObjCLanguageRuntime.h:420
lldb_private::ObjCLanguageRuntime::AddToClassNameCache
void AddToClassNameCache(lldb::addr_t class_addr, const char *name, lldb::TypeSP type_sp)
lldb_private::ObjCLanguageRuntime::ClassAndSel
Definition: ObjCLanguageRuntime.h:367
lldb_private::Process::GetStopID
uint32_t GetStopID() const
Definition: Process.h:1378
lldb_private::ObjCLanguageRuntime::HasReadObjCLibrary
virtual bool HasReadObjCLibrary()=0
lldb_private::ObjCLanguageRuntime::LookupInMethodCache
lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel)
Definition: ObjCLanguageRuntime.cpp:90
lldb_private::ObjCLanguageRuntime::ClassAndSelStr
Definition: ObjCLanguageRuntime.h:397
lldb_private::ObjCLanguageRuntime::ClassDescriptor::CheckPointer
virtual bool CheckPointer(lldb::addr_t value, uint32_t ptr_size) const
Definition: ObjCLanguageRuntime.h:106
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:208
lldb_private::ObjCLanguageRuntime::ClassAndSel::ClassAndSel
ClassAndSel(lldb::addr_t in_class_addr, lldb::addr_t in_sel_addr)
Definition: ObjCLanguageRuntime.h:370
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:437
lldb_private::ObjCLanguageRuntime::ConstStringSetHelpers
Definition: ObjCLanguageRuntime.h:441
lldb_private::ObjCLanguageRuntime::ClassDescriptor::GetTaggedPointerInfoSigned
virtual bool GetTaggedPointerInfoSigned(uint64_t *info_bits=nullptr, int64_t *value_bits=nullptr, uint64_t *payload=nullptr)=0