LLDB  mainline
AppleObjCRuntimeV2.cpp
Go to the documentation of this file.
1 //===-- AppleObjCRuntimeV2.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 <cstdint>
10 
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/DeclObjC.h"
17 
18 #include "lldb/Host/OptionParser.h"
20 #include "lldb/lldb-enumerations.h"
21 
23 #include "lldb/Core/Debugger.h"
24 #include "lldb/Core/Module.h"
26 #include "lldb/Core/Section.h"
37 #include "lldb/Symbol/ObjectFile.h"
38 #include "lldb/Symbol/Symbol.h"
39 #include "lldb/Symbol/TypeList.h"
41 #include "lldb/Target/ABI.h"
44 #include "lldb/Target/Platform.h"
45 #include "lldb/Target/Process.h"
48 #include "lldb/Target/Target.h"
49 #include "lldb/Target/Thread.h"
51 #include "lldb/Utility/Log.h"
52 #include "lldb/Utility/Scalar.h"
53 #include "lldb/Utility/Status.h"
54 #include "lldb/Utility/Stream.h"
56 #include "lldb/Utility/Timer.h"
57 
59 #include "AppleObjCDeclVendor.h"
60 #include "AppleObjCRuntimeV2.h"
63 
64 #include "clang/AST/ASTContext.h"
65 #include "clang/AST/DeclObjC.h"
66 #include "clang/Basic/TargetInfo.h"
67 
69 
70 #include <vector>
71 
72 using namespace lldb;
73 using namespace lldb_private;
74 
75 char AppleObjCRuntimeV2::ID = 0;
76 
77 static const char *g_get_dynamic_class_info_name =
78  "__lldb_apple_objc_v2_get_dynamic_class_info";
79 
80 static const char *g_get_dynamic_class_info_body = R"(
81 
82 extern "C"
83 {
84  size_t strlen(const char *);
85  char *strncpy (char * s1, const char * s2, size_t n);
86  int printf(const char * format, ...);
87 }
88 #define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
89 
90 typedef struct _NXMapTable {
91  void *prototype;
92  unsigned num_classes;
93  unsigned num_buckets_minus_one;
94  void *buckets;
95 } NXMapTable;
96 
97 #define NX_MAPNOTAKEY ((void *)(-1))
98 
99 typedef struct BucketInfo
100 {
101  const char *name_ptr;
102  Class isa;
103 } BucketInfo;
104 
105 struct ClassInfo
106 {
107  Class isa;
108  uint32_t hash;
109 } __attribute__((__packed__));
110 
111 uint32_t
112 __lldb_apple_objc_v2_get_dynamic_class_info (void *gdb_objc_realized_classes_ptr,
113  void *class_infos_ptr,
114  uint32_t class_infos_byte_size,
115  uint32_t should_log)
116 {
117  DEBUG_PRINTF ("gdb_objc_realized_classes_ptr = %p\n", gdb_objc_realized_classes_ptr);
118  DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
119  DEBUG_PRINTF ("class_infos_byte_size = %u\n", class_infos_byte_size);
120  const NXMapTable *grc = (const NXMapTable *)gdb_objc_realized_classes_ptr;
121  if (grc)
122  {
123  const unsigned num_classes = grc->num_classes;
124  DEBUG_PRINTF ("num_classes = %u\n", grc->num_classes);
125  if (class_infos_ptr)
126  {
127  const unsigned num_buckets_minus_one = grc->num_buckets_minus_one;
128  DEBUG_PRINTF ("num_buckets_minus_one = %u\n", num_buckets_minus_one);
129 
130  const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
131  DEBUG_PRINTF ("max_class_infos = %u\n", max_class_infos);
132 
133  ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
134  BucketInfo *buckets = (BucketInfo *)grc->buckets;
135 
136  uint32_t idx = 0;
137  for (unsigned i=0; i<=num_buckets_minus_one; ++i)
138  {
139  if (buckets[i].name_ptr != NX_MAPNOTAKEY)
140  {
141  if (idx < max_class_infos)
142  {
143  const char *s = buckets[i].name_ptr;
144  uint32_t h = 5381;
145  for (unsigned char c = *s; c; c = *++s)
146  h = ((h << 5) + h) + c;
147  class_infos[idx].hash = h;
148  class_infos[idx].isa = buckets[i].isa;
149  DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, buckets[i].name_ptr);
150  }
151  ++idx;
152  }
153  }
154  if (idx < max_class_infos)
155  {
156  class_infos[idx].isa = NULL;
157  class_infos[idx].hash = 0;
158  }
159  }
160  return num_classes;
161  }
162  return 0;
163 }
164 
165 )";
166 
167 static const char *g_get_dynamic_class_info2_name =
168  "__lldb_apple_objc_v2_get_dynamic_class_info2";
169 
170 static const char *g_get_dynamic_class_info2_body = R"(
171 
172 extern "C" {
173  int printf(const char * format, ...);
174  void free(void *ptr);
175  Class* objc_copyRealizedClassList_nolock(unsigned int *outCount);
176  const char* objc_debug_class_getNameRaw(Class cls);
177 }
178 
179 #define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
180 
181 struct ClassInfo
182 {
183  Class isa;
184  uint32_t hash;
185 } __attribute__((__packed__));
186 
187 uint32_t
188 __lldb_apple_objc_v2_get_dynamic_class_info2(void *gdb_objc_realized_classes_ptr,
189  void *class_infos_ptr,
190  uint32_t class_infos_byte_size,
191  uint32_t should_log)
192 {
193  DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
194  DEBUG_PRINTF ("class_infos_byte_size = %u\n", class_infos_byte_size);
195 
196  const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
197  DEBUG_PRINTF ("max_class_infos = %u\n", max_class_infos);
198 
199  ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
200 
201  uint32_t count = 0;
202  Class* realized_class_list = objc_copyRealizedClassList_nolock(&count);
203  DEBUG_PRINTF ("count = %u\n", count);
204 
205  uint32_t idx = 0;
206  for (uint32_t i=0; i<=count; ++i)
207  {
208  if (idx < max_class_infos)
209  {
210  Class isa = realized_class_list[i];
211  const char *name_ptr = objc_debug_class_getNameRaw(isa);
212  if (name_ptr == NULL)
213  continue;
214  const char *s = name_ptr;
215  uint32_t h = 5381;
216  for (unsigned char c = *s; c; c = *++s)
217  h = ((h << 5) + h) + c;
218  class_infos[idx].hash = h;
219  class_infos[idx].isa = isa;
220  DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name_ptr);
221  }
222  idx++;
223  }
224 
225  if (idx < max_class_infos)
226  {
227  class_infos[idx].isa = NULL;
228  class_infos[idx].hash = 0;
229  }
230 
231  free(realized_class_list);
232  return count;
233 }
234 )";
235 
236 // We'll substitute in class_getName or class_getNameRaw depending
237 // on which is present.
238 static const char *g_shared_cache_class_name_funcptr = R"(
239 extern "C"
240 {
241  const char *%s(void *objc_class);
242  const char *(*class_name_lookup_func)(void *) = %s;
243 }
244 )";
245 
247  "__lldb_apple_objc_v2_get_shared_cache_class_info";
248 
249 static const char *g_get_shared_cache_class_info_body = R"(
250 
251 extern "C"
252 {
253  size_t strlen(const char *);
254  char *strncpy (char * s1, const char * s2, size_t n);
255  int printf(const char * format, ...);
256 }
257 
258 #define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
259 
260 
261 struct objc_classheader_t {
262  int32_t clsOffset;
263  int32_t hiOffset;
264 };
265 
266 struct objc_classheader_v16_t {
267  uint64_t isDuplicate : 1,
268  objectCacheOffset : 47, // Offset from the shared cache base
269  dylibObjCIndex : 16;
270 };
271 
272 struct objc_clsopt_t {
273  uint32_t capacity;
274  uint32_t occupied;
275  uint32_t shift;
276  uint32_t mask;
277  uint32_t zero;
278  uint32_t unused;
279  uint64_t salt;
280  uint32_t scramble[256];
281  uint8_t tab[0]; // tab[mask+1]
282  // uint8_t checkbytes[capacity];
283  // int32_t offset[capacity];
284  // objc_classheader_t clsOffsets[capacity];
285  // uint32_t duplicateCount;
286  // objc_classheader_t duplicateOffsets[duplicateCount];
287 };
288 
289 struct objc_clsopt_v16_t {
290  uint32_t version;
291  uint32_t capacity;
292  uint32_t occupied;
293  uint32_t shift;
294  uint32_t mask;
295  uint64_t salt;
296  uint32_t scramble[256];
297  uint8_t tab[0]; // tab[mask+1]
298  // uint8_t checkbytes[capacity];
299  // int32_t offset[capacity];
300  // objc_classheader_t clsOffsets[capacity];
301  // uint32_t duplicateCount;
302  // objc_classheader_t duplicateOffsets[duplicateCount];
303 };
304 
305 struct objc_opt_t {
306  uint32_t version;
307  int32_t selopt_offset;
308  int32_t headeropt_offset;
309  int32_t clsopt_offset;
310 };
311 
312 struct objc_opt_v14_t {
313  uint32_t version;
314  uint32_t flags;
315  int32_t selopt_offset;
316  int32_t headeropt_offset;
317  int32_t clsopt_offset;
318 };
319 
320 struct objc_opt_v16_t {
321  uint32_t version;
322  uint32_t flags;
323  int32_t selopt_offset;
324  int32_t headeropt_ro_offset;
325  int32_t unused_clsopt_offset;
326  int32_t unused_protocolopt_offset;
327  int32_t headeropt_rw_offset;
328  int32_t unused_protocolopt2_offset;
329  int32_t largeSharedCachesClassOffset;
330  int32_t largeSharedCachesProtocolOffset;
331  uint64_t relativeMethodSelectorBaseAddressCacheOffset;
332 };
333 
334 struct ClassInfo
335 {
336  Class isa;
337  uint32_t hash;
338 } __attribute__((__packed__));
339 
340 uint32_t
341 __lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr,
342  void *shared_cache_base_ptr,
343  void *class_infos_ptr,
344  uint64_t *relative_selector_offset,
345  uint32_t class_infos_byte_size,
346  uint32_t should_log)
347 {
348  *relative_selector_offset = 0;
349  uint32_t idx = 0;
350  DEBUG_PRINTF ("objc_opt_ro_ptr = %p\n", objc_opt_ro_ptr);
351  DEBUG_PRINTF ("shared_cache_base_ptr = %p\n", shared_cache_base_ptr);
352  DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
353  DEBUG_PRINTF ("class_infos_byte_size = %u (%llu class infos)\n", class_infos_byte_size, (uint64_t)(class_infos_byte_size/sizeof(ClassInfo)));
354  if (objc_opt_ro_ptr)
355  {
356  const objc_opt_t *objc_opt = (objc_opt_t *)objc_opt_ro_ptr;
357  const objc_opt_v14_t* objc_opt_v14 = (objc_opt_v14_t*)objc_opt_ro_ptr;
358  const objc_opt_v16_t* objc_opt_v16 = (objc_opt_v16_t*)objc_opt_ro_ptr;
359  if (objc_opt->version >= 16)
360  {
361  *relative_selector_offset = objc_opt_v16->relativeMethodSelectorBaseAddressCacheOffset;
362  DEBUG_PRINTF ("objc_opt->version = %u\n", objc_opt_v16->version);
363  DEBUG_PRINTF ("objc_opt->flags = %u\n", objc_opt_v16->flags);
364  DEBUG_PRINTF ("objc_opt->selopt_offset = %d\n", objc_opt_v16->selopt_offset);
365  DEBUG_PRINTF ("objc_opt->headeropt_ro_offset = %d\n", objc_opt_v16->headeropt_ro_offset);
366  DEBUG_PRINTF ("objc_opt->relativeMethodSelectorBaseAddressCacheOffset = %d\n", *relative_selector_offset);
367  }
368  else if (objc_opt->version >= 14)
369  {
370  DEBUG_PRINTF ("objc_opt->version = %u\n", objc_opt_v14->version);
371  DEBUG_PRINTF ("objc_opt->flags = %u\n", objc_opt_v14->flags);
372  DEBUG_PRINTF ("objc_opt->selopt_offset = %d\n", objc_opt_v14->selopt_offset);
373  DEBUG_PRINTF ("objc_opt->headeropt_offset = %d\n", objc_opt_v14->headeropt_offset);
374  DEBUG_PRINTF ("objc_opt->clsopt_offset = %d\n", objc_opt_v14->clsopt_offset);
375  }
376  else
377  {
378  DEBUG_PRINTF ("objc_opt->version = %u\n", objc_opt->version);
379  DEBUG_PRINTF ("objc_opt->selopt_offset = %d\n", objc_opt->selopt_offset);
380  DEBUG_PRINTF ("objc_opt->headeropt_offset = %d\n", objc_opt->headeropt_offset);
381  DEBUG_PRINTF ("objc_opt->clsopt_offset = %d\n", objc_opt->clsopt_offset);
382  }
383 
384  if (objc_opt->version == 16)
385  {
386  const objc_clsopt_v16_t* clsopt = (const objc_clsopt_v16_t*)((uint8_t *)objc_opt + objc_opt_v16->largeSharedCachesClassOffset);
387  const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
388 
389  DEBUG_PRINTF("max_class_infos = %llu\n", (uint64_t)max_class_infos);
390 
391  ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
392 
393  const uint8_t *checkbytes = &clsopt->tab[clsopt->mask+1];
394  const int32_t *offsets = (const int32_t *)(checkbytes + clsopt->capacity);
395  const objc_classheader_v16_t *classOffsets = (const objc_classheader_v16_t *)(offsets + clsopt->capacity);
396 
397  DEBUG_PRINTF ("clsopt->capacity = %u\n", clsopt->capacity);
398  DEBUG_PRINTF ("clsopt->mask = 0x%8.8x\n", clsopt->mask);
399  DEBUG_PRINTF ("classOffsets = %p\n", classOffsets);
400 
401  for (uint32_t i=0; i<clsopt->capacity; ++i)
402  {
403  const uint64_t objectCacheOffset = classOffsets[i].objectCacheOffset;
404  DEBUG_PRINTF("objectCacheOffset[%u] = %u\n", i, objectCacheOffset);
405 
406  if (classOffsets[i].isDuplicate) {
407  DEBUG_PRINTF("isDuplicate = true\n");
408  continue; // duplicate
409  }
410 
411  if (objectCacheOffset == 0) {
412  DEBUG_PRINTF("objectCacheOffset == invalidEntryOffset\n");
413  continue; // invalid offset
414  }
415 
416  if (class_infos && idx < max_class_infos)
417  {
418  class_infos[idx].isa = (Class)((uint8_t *)shared_cache_base_ptr + objectCacheOffset);
419 
420  // Lookup the class name.
421  const char *name = class_name_lookup_func(class_infos[idx].isa);
422  DEBUG_PRINTF("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
423 
424  // Hash the class name so we don't have to read it.
425  const char *s = name;
426  uint32_t h = 5381;
427  for (unsigned char c = *s; c; c = *++s)
428  {
429  // class_getName demangles swift names and the hash must
430  // be calculated on the mangled name. hash==0 means lldb
431  // will fetch the mangled name and compute the hash in
432  // ParseClassInfoArray.
433  if (c == '.')
434  {
435  h = 0;
436  break;
437  }
438  h = ((h << 5) + h) + c;
439  }
440  class_infos[idx].hash = h;
441  }
442  else
443  {
444  DEBUG_PRINTF("not(class_infos && idx < max_class_infos)\n");
445  }
446  ++idx;
447  }
448 
449  const uint32_t *duplicate_count_ptr = (uint32_t *)&classOffsets[clsopt->capacity];
450  const uint32_t duplicate_count = *duplicate_count_ptr;
451  const objc_classheader_v16_t *duplicateClassOffsets = (const objc_classheader_v16_t *)(&duplicate_count_ptr[1]);
452 
453  DEBUG_PRINTF ("duplicate_count = %u\n", duplicate_count);
454  DEBUG_PRINTF ("duplicateClassOffsets = %p\n", duplicateClassOffsets);
455 
456  for (uint32_t i=0; i<duplicate_count; ++i)
457  {
458  const uint64_t objectCacheOffset = classOffsets[i].objectCacheOffset;
459  DEBUG_PRINTF("objectCacheOffset[%u] = %u\n", i, objectCacheOffset);
460 
461  if (classOffsets[i].isDuplicate) {
462  DEBUG_PRINTF("isDuplicate = true\n");
463  continue; // duplicate
464  }
465 
466  if (objectCacheOffset == 0) {
467  DEBUG_PRINTF("objectCacheOffset == invalidEntryOffset\n");
468  continue; // invalid offset
469  }
470 
471  if (class_infos && idx < max_class_infos)
472  {
473  class_infos[idx].isa = (Class)((uint8_t *)shared_cache_base_ptr + objectCacheOffset);
474 
475  // Lookup the class name.
476  const char *name = class_name_lookup_func(class_infos[idx].isa);
477  DEBUG_PRINTF("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
478 
479  // Hash the class name so we don't have to read it.
480  const char *s = name;
481  uint32_t h = 5381;
482  for (unsigned char c = *s; c; c = *++s)
483  {
484  // class_getName demangles swift names and the hash must
485  // be calculated on the mangled name. hash==0 means lldb
486  // will fetch the mangled name and compute the hash in
487  // ParseClassInfoArray.
488  if (c == '.')
489  {
490  h = 0;
491  break;
492  }
493  h = ((h << 5) + h) + c;
494  }
495  class_infos[idx].hash = h;
496  }
497  }
498  }
499  else if (objc_opt->version >= 12 && objc_opt->version <= 15)
500  {
501  const objc_clsopt_t* clsopt = NULL;
502  if (objc_opt->version >= 14)
503  clsopt = (const objc_clsopt_t*)((uint8_t *)objc_opt_v14 + objc_opt_v14->clsopt_offset);
504  else
505  clsopt = (const objc_clsopt_t*)((uint8_t *)objc_opt + objc_opt->clsopt_offset);
506  const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
507  DEBUG_PRINTF("max_class_infos = %llu\n", (uint64_t)max_class_infos);
508  ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
509  int32_t invalidEntryOffset = 0;
510  // this is safe to do because the version field order is invariant
511  if (objc_opt->version == 12)
512  invalidEntryOffset = 16;
513  const uint8_t *checkbytes = &clsopt->tab[clsopt->mask+1];
514  const int32_t *offsets = (const int32_t *)(checkbytes + clsopt->capacity);
515  const objc_classheader_t *classOffsets = (const objc_classheader_t *)(offsets + clsopt->capacity);
516  DEBUG_PRINTF ("clsopt->capacity = %u\n", clsopt->capacity);
517  DEBUG_PRINTF ("clsopt->mask = 0x%8.8x\n", clsopt->mask);
518  DEBUG_PRINTF ("classOffsets = %p\n", classOffsets);
519  DEBUG_PRINTF("invalidEntryOffset = %d\n", invalidEntryOffset);
520  for (uint32_t i=0; i<clsopt->capacity; ++i)
521  {
522  const int32_t clsOffset = classOffsets[i].clsOffset;
523  DEBUG_PRINTF("clsOffset[%u] = %u\n", i, clsOffset);
524  if (clsOffset & 1)
525  {
526  DEBUG_PRINTF("clsOffset & 1\n");
527  continue; // duplicate
528  }
529  else if (clsOffset == invalidEntryOffset)
530  {
531  DEBUG_PRINTF("clsOffset == invalidEntryOffset\n");
532  continue; // invalid offset
533  }
534 
535  if (class_infos && idx < max_class_infos)
536  {
537  class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);
538  const char *name = class_name_lookup_func (class_infos[idx].isa);
539  DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
540  // Hash the class name so we don't have to read it
541  const char *s = name;
542  uint32_t h = 5381;
543  for (unsigned char c = *s; c; c = *++s)
544  {
545  // class_getName demangles swift names and the hash must
546  // be calculated on the mangled name. hash==0 means lldb
547  // will fetch the mangled name and compute the hash in
548  // ParseClassInfoArray.
549  if (c == '.')
550  {
551  h = 0;
552  break;
553  }
554  h = ((h << 5) + h) + c;
555  }
556  class_infos[idx].hash = h;
557  }
558  else
559  {
560  DEBUG_PRINTF("not(class_infos && idx < max_class_infos)\n");
561  }
562  ++idx;
563  }
564 
565  const uint32_t *duplicate_count_ptr = (uint32_t *)&classOffsets[clsopt->capacity];
566  const uint32_t duplicate_count = *duplicate_count_ptr;
567  const objc_classheader_t *duplicateClassOffsets = (const objc_classheader_t *)(&duplicate_count_ptr[1]);
568  DEBUG_PRINTF ("duplicate_count = %u\n", duplicate_count);
569  DEBUG_PRINTF ("duplicateClassOffsets = %p\n", duplicateClassOffsets);
570  for (uint32_t i=0; i<duplicate_count; ++i)
571  {
572  const int32_t clsOffset = duplicateClassOffsets[i].clsOffset;
573  if (clsOffset & 1)
574  continue; // duplicate
575  else if (clsOffset == invalidEntryOffset)
576  continue; // invalid offset
577 
578  if (class_infos && idx < max_class_infos)
579  {
580  class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);
581  const char *name = class_name_lookup_func (class_infos[idx].isa);
582  DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
583  // Hash the class name so we don't have to read it
584  const char *s = name;
585  uint32_t h = 5381;
586  for (unsigned char c = *s; c; c = *++s)
587  {
588  // class_getName demangles swift names and the hash must
589  // be calculated on the mangled name. hash==0 means lldb
590  // will fetch the mangled name and compute the hash in
591  // ParseClassInfoArray.
592  if (c == '.')
593  {
594  h = 0;
595  break;
596  }
597  h = ((h << 5) + h) + c;
598  }
599  class_infos[idx].hash = h;
600  }
601  ++idx;
602  }
603  }
604  DEBUG_PRINTF ("%u class_infos\n", idx);
605  DEBUG_PRINTF ("done\n");
606  }
607  return idx;
608 }
609 
610 
611 )";
612 
613 static uint64_t
615  const ModuleSP &module_sp, Status &error,
616  bool read_value = true, uint8_t byte_size = 0,
617  uint64_t default_value = LLDB_INVALID_ADDRESS,
618  SymbolType sym_type = lldb::eSymbolTypeData) {
619  if (!process) {
620  error.SetErrorString("no process");
621  return default_value;
622  }
623 
624  if (!module_sp) {
625  error.SetErrorString("no module");
626  return default_value;
627  }
628 
629  if (!byte_size)
630  byte_size = process->GetAddressByteSize();
631  const Symbol *symbol =
632  module_sp->FindFirstSymbolWithNameAndType(name, lldb::eSymbolTypeData);
633 
634  if (!symbol || !symbol->ValueIsAddress()) {
635  error.SetErrorString("no symbol");
636  return default_value;
637  }
638 
639  lldb::addr_t symbol_load_addr =
640  symbol->GetAddressRef().GetLoadAddress(&process->GetTarget());
641  if (symbol_load_addr == LLDB_INVALID_ADDRESS) {
642  error.SetErrorString("symbol address invalid");
643  return default_value;
644  }
645 
646  if (read_value)
647  return process->ReadUnsignedIntegerFromMemory(symbol_load_addr, byte_size,
648  default_value, error);
649  return symbol_load_addr;
650 }
651 
652 static void RegisterObjCExceptionRecognizer(Process *process);
653 
654 AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process,
655  const ModuleSP &objc_module_sp)
656  : AppleObjCRuntime(process), m_objc_module_sp(objc_module_sp),
657  m_dynamic_class_info_extractor(*this),
658  m_shared_cache_class_info_extractor(*this), m_decl_vendor_up(),
659  m_tagged_pointer_obfuscator(LLDB_INVALID_ADDRESS),
660  m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS),
661  m_relative_selector_base(LLDB_INVALID_ADDRESS), m_hash_signature(),
662  m_has_object_getClass(false), m_has_objc_copyRealizedClassList(false),
663  m_loaded_objc_opt(false), m_non_pointer_isa_cache_up(),
664  m_tagged_pointer_vendor_up(
665  TaggedPointerVendorV2::CreateInstance(*this, objc_module_sp)),
666  m_encoding_to_type_sp(), m_noclasses_warning_emitted(false),
667  m_CFBoolean_values(), m_realized_class_generation_count(0) {
668  static const ConstString g_gdb_object_getClass("gdb_object_getClass");
669  m_has_object_getClass = HasSymbol(g_gdb_object_getClass);
670  static const ConstString g_objc_copyRealizedClassList(
671  "_ZL33objc_copyRealizedClassList_nolockPj");
672  m_has_objc_copyRealizedClassList = HasSymbol(g_objc_copyRealizedClassList);
673 
675 }
676 
678  ValueObject &in_value, lldb::DynamicValueType use_dynamic,
679  TypeAndOrName &class_type_or_name, Address &address,
680  Value::ValueType &value_type) {
681  // We should never get here with a null process...
682  assert(m_process != nullptr);
683 
684  // The Runtime is attached to a particular process, you shouldn't pass in a
685  // value from another process. Note, however, the process might be NULL (e.g.
686  // if the value was made with SBTarget::EvaluateExpression...) in which case
687  // it is sufficient if the target's match:
688 
689  Process *process = in_value.GetProcessSP().get();
690  if (process)
691  assert(process == m_process);
692  else
693  assert(in_value.GetTargetSP().get() == m_process->CalculateTarget().get());
694 
695  class_type_or_name.Clear();
696  value_type = Value::ValueType::Scalar;
697 
698  // Make sure we can have a dynamic value before starting...
699  if (CouldHaveDynamicValue(in_value)) {
700  // First job, pull out the address at 0 offset from the object That will
701  // be the ISA pointer.
702  ClassDescriptorSP objc_class_sp(GetNonKVOClassDescriptor(in_value));
703  if (objc_class_sp) {
704  const addr_t object_ptr = in_value.GetPointerValue();
705  address.SetRawAddress(object_ptr);
706 
707  ConstString class_name(objc_class_sp->GetClassName());
708  class_type_or_name.SetName(class_name);
709  TypeSP type_sp(objc_class_sp->GetType());
710  if (type_sp)
711  class_type_or_name.SetTypeSP(type_sp);
712  else {
713  type_sp = LookupInCompleteClassCache(class_name);
714  if (type_sp) {
715  objc_class_sp->SetType(type_sp);
716  class_type_or_name.SetTypeSP(type_sp);
717  } else {
718  // try to go for a CompilerType at least
719  if (auto *vendor = GetDeclVendor()) {
720  auto types = vendor->FindTypes(class_name, /*max_matches*/ 1);
721  if (!types.empty())
722  class_type_or_name.SetCompilerType(types.front());
723  }
724  }
725  }
726  }
727  }
728  return !class_type_or_name.IsEmpty();
729 }
730 
731 // Static Functions
733  LanguageType language) {
734  // FIXME: This should be a MacOS or iOS process, and we need to look for the
735  // OBJC section to make
736  // sure we aren't using the V1 runtime.
737  if (language == eLanguageTypeObjC) {
738  ModuleSP objc_module_sp;
739 
740  if (AppleObjCRuntime::GetObjCVersion(process, objc_module_sp) ==
742  return new AppleObjCRuntimeV2(process, objc_module_sp);
743  return nullptr;
744  }
745  return nullptr;
746 }
747 
750  false,
751  "verbose",
752  'v',
754  nullptr,
755  {},
756  0,
757  eArgTypeNone,
758  "Print ivar and method information in detail"}};
759 
761 public:
762  class CommandOptions : public Options {
763  public:
764  CommandOptions() : Options(), m_verbose(false, false) {}
765 
766  ~CommandOptions() override = default;
767 
768  Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
769  ExecutionContext *execution_context) override {
770  Status error;
771  const int short_option = m_getopt_table[option_idx].val;
772  switch (short_option) {
773  case 'v':
774  m_verbose.SetCurrentValue(true);
775  m_verbose.SetOptionWasSet();
776  break;
777 
778  default:
779  error.SetErrorStringWithFormat("unrecognized short option '%c'",
780  short_option);
781  break;
782  }
783 
784  return error;
785  }
786 
787  void OptionParsingStarting(ExecutionContext *execution_context) override {
788  m_verbose.Clear();
789  }
790 
791  llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
792  return llvm::makeArrayRef(g_objc_classtable_dump_options);
793  }
794 
796  };
797 
799  : CommandObjectParsed(interpreter, "dump",
800  "Dump information on Objective-C classes "
801  "known to the current process.",
802  "language objc class-table dump",
803  eCommandRequiresProcess |
804  eCommandProcessMustBeLaunched |
805  eCommandProcessMustBePaused),
806  m_options() {
808  CommandArgumentData index_arg;
809 
810  // Define the first (and only) variant of this arg.
813 
814  // There is only one variant this argument could be; put it into the
815  // argument entry.
816  arg.push_back(index_arg);
817 
818  // Push the data for the first argument into the m_arguments vector.
819  m_arguments.push_back(arg);
820  }
821 
822  ~CommandObjectObjC_ClassTable_Dump() override = default;
823 
824  Options *GetOptions() override { return &m_options; }
825 
826 protected:
827  bool DoExecute(Args &command, CommandReturnObject &result) override {
828  std::unique_ptr<RegularExpression> regex_up;
829  switch (command.GetArgumentCount()) {
830  case 0:
831  break;
832  case 1: {
833  regex_up =
834  std::make_unique<RegularExpression>(command.GetArgumentAtIndex(0));
835  if (!regex_up->IsValid()) {
836  result.AppendError(
837  "invalid argument - please provide a valid regular expression");
839  return false;
840  }
841  break;
842  }
843  default: {
844  result.AppendError("please provide 0 or 1 arguments");
846  return false;
847  }
848  }
849 
850  Process *process = m_exe_ctx.GetProcessPtr();
851  ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
852  if (objc_runtime) {
853  auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
854  auto iterator = iterators_pair.first;
855  auto &std_out = result.GetOutputStream();
856  for (; iterator != iterators_pair.second; iterator++) {
857  if (iterator->second) {
858  const char *class_name =
859  iterator->second->GetClassName().AsCString("<unknown>");
860  if (regex_up && class_name &&
861  !regex_up->Execute(llvm::StringRef(class_name)))
862  continue;
863  std_out.Printf("isa = 0x%" PRIx64, iterator->first);
864  std_out.Printf(" name = %s", class_name);
865  std_out.Printf(" instance size = %" PRIu64,
866  iterator->second->GetInstanceSize());
867  std_out.Printf(" num ivars = %" PRIuPTR,
868  (uintptr_t)iterator->second->GetNumIVars());
869  if (auto superclass = iterator->second->GetSuperclass()) {
870  std_out.Printf(" superclass = %s",
871  superclass->GetClassName().AsCString("<unknown>"));
872  }
873  std_out.Printf("\n");
874  if (m_options.m_verbose) {
875  for (size_t i = 0; i < iterator->second->GetNumIVars(); i++) {
876  auto ivar = iterator->second->GetIVarAtIndex(i);
877  std_out.Printf(
878  " ivar name = %s type = %s size = %" PRIu64
879  " offset = %" PRId32 "\n",
880  ivar.m_name.AsCString("<unknown>"),
881  ivar.m_type.GetDisplayTypeName().AsCString("<unknown>"),
882  ivar.m_size, ivar.m_offset);
883  }
884 
885  iterator->second->Describe(
886  nullptr,
887  [&std_out](const char *name, const char *type) -> bool {
888  std_out.Printf(" instance method name = %s type = %s\n",
889  name, type);
890  return false;
891  },
892  [&std_out](const char *name, const char *type) -> bool {
893  std_out.Printf(" class method name = %s type = %s\n", name,
894  type);
895  return false;
896  },
897  nullptr);
898  }
899  } else {
900  if (regex_up && !regex_up->Execute(llvm::StringRef()))
901  continue;
902  std_out.Printf("isa = 0x%" PRIx64 " has no associated class.\n",
903  iterator->first);
904  }
905  }
907  return true;
908  }
909  result.AppendError("current process has no Objective-C runtime loaded");
911  return false;
912  }
913 
915 };
916 
918  : public CommandObjectParsed {
919 public:
922  interpreter, "info", "Dump information on a tagged pointer.",
923  "language objc tagged-pointer info",
924  eCommandRequiresProcess | eCommandProcessMustBeLaunched |
925  eCommandProcessMustBePaused) {
927  CommandArgumentData index_arg;
928 
929  // Define the first (and only) variant of this arg.
930  index_arg.arg_type = eArgTypeAddress;
931  index_arg.arg_repetition = eArgRepeatPlus;
932 
933  // There is only one variant this argument could be; put it into the
934  // argument entry.
935  arg.push_back(index_arg);
936 
937  // Push the data for the first argument into the m_arguments vector.
938  m_arguments.push_back(arg);
939  }
940 
941  ~CommandObjectMultiwordObjC_TaggedPointer_Info() override = default;
942 
943 protected:
944  bool DoExecute(Args &command, CommandReturnObject &result) override {
945  if (command.GetArgumentCount() == 0) {
946  result.AppendError("this command requires arguments");
948  return false;
949  }
950 
951  Process *process = m_exe_ctx.GetProcessPtr();
952  ExecutionContext exe_ctx(process);
953  ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
954  if (objc_runtime) {
955  ObjCLanguageRuntime::TaggedPointerVendor *tagged_ptr_vendor =
956  objc_runtime->GetTaggedPointerVendor();
957  if (tagged_ptr_vendor) {
958  for (size_t i = 0; i < command.GetArgumentCount(); i++) {
959  const char *arg_str = command.GetArgumentAtIndex(i);
960  if (!arg_str)
961  continue;
962  Status error;
964  &exe_ctx, arg_str, LLDB_INVALID_ADDRESS, &error);
965  if (arg_addr == 0 || arg_addr == LLDB_INVALID_ADDRESS || error.Fail())
966  continue;
967  auto descriptor_sp = tagged_ptr_vendor->GetClassDescriptor(arg_addr);
968  if (!descriptor_sp)
969  continue;
970  uint64_t info_bits = 0;
971  uint64_t value_bits = 0;
972  uint64_t payload = 0;
973  if (descriptor_sp->GetTaggedPointerInfo(&info_bits, &value_bits,
974  &payload)) {
975  result.GetOutputStream().Printf(
976  "0x%" PRIx64 " is tagged.\n\tpayload = 0x%" PRIx64
977  "\n\tvalue = 0x%" PRIx64 "\n\tinfo bits = 0x%" PRIx64
978  "\n\tclass = %s\n",
979  (uint64_t)arg_addr, payload, value_bits, info_bits,
980  descriptor_sp->GetClassName().AsCString("<unknown>"));
981  } else {
982  result.GetOutputStream().Printf("0x%" PRIx64 " is not tagged.\n",
983  (uint64_t)arg_addr);
984  }
985  }
986  } else {
987  result.AppendError("current process has no tagged pointer support");
989  return false;
990  }
992  return true;
993  }
994  result.AppendError("current process has no Objective-C runtime loaded");
996  return false;
997  }
998 };
999 
1001 public:
1004  interpreter, "class-table",
1005  "Commands for operating on the Objective-C class table.",
1006  "class-table <subcommand> [<subcommand-options>]") {
1007  LoadSubCommand(
1008  "dump",
1009  CommandObjectSP(new CommandObjectObjC_ClassTable_Dump(interpreter)));
1010  }
1011 
1012  ~CommandObjectMultiwordObjC_ClassTable() override = default;
1013 };
1014 
1016 public:
1019  interpreter, "tagged-pointer",
1020  "Commands for operating on Objective-C tagged pointers.",
1021  "class-table <subcommand> [<subcommand-options>]") {
1022  LoadSubCommand(
1023  "info",
1024  CommandObjectSP(
1026  }
1027 
1028  ~CommandObjectMultiwordObjC_TaggedPointer() override = default;
1029 };
1030 
1032 public:
1035  interpreter, "objc",
1036  "Commands for operating on the Objective-C language runtime.",
1037  "objc <subcommand> [<subcommand-options>]") {
1038  LoadSubCommand("class-table",
1039  CommandObjectSP(
1040  new CommandObjectMultiwordObjC_ClassTable(interpreter)));
1041  LoadSubCommand("tagged-pointer",
1042  CommandObjectSP(new CommandObjectMultiwordObjC_TaggedPointer(
1043  interpreter)));
1044  }
1045 
1046  ~CommandObjectMultiwordObjC() override = default;
1047 };
1048 
1051  GetPluginNameStatic(), "Apple Objective-C Language Runtime - Version 2",
1053  [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {
1054  return CommandObjectSP(new CommandObjectMultiwordObjC(interpreter));
1055  },
1057 }
1058 
1061 }
1062 
1064  static ConstString g_name("apple-objc-v2");
1065  return g_name;
1066 }
1067 
1068 // PluginInterface protocol
1070  return GetPluginNameStatic();
1071 }
1072 
1073 BreakpointResolverSP
1075  bool catch_bp, bool throw_bp) {
1076  BreakpointResolverSP resolver_sp;
1077 
1078  if (throw_bp)
1079  resolver_sp = std::make_shared<BreakpointResolverName>(
1080  bkpt, std::get<1>(GetExceptionThrowLocation()).AsCString(),
1081  eFunctionNameTypeBase, eLanguageTypeUnknown, Breakpoint::Exact, 0,
1082  eLazyBoolNo);
1083  // FIXME: We don't do catch breakpoints for ObjC yet.
1084  // Should there be some way for the runtime to specify what it can do in this
1085  // regard?
1086  return resolver_sp;
1087 }
1088 
1089 llvm::Expected<std::unique_ptr<UtilityFunction>>
1091  ExecutionContext &exe_ctx) {
1092  char check_function_code[2048];
1093 
1094  int len = 0;
1095  if (m_has_object_getClass) {
1096  len = ::snprintf(check_function_code, sizeof(check_function_code), R"(
1097  extern "C" void *gdb_object_getClass(void *);
1098  extern "C" int printf(const char *format, ...);
1099  extern "C" void
1100  %s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {
1101  if ($__lldb_arg_obj == (void *)0)
1102  return; // nil is ok
1103  if (!gdb_object_getClass($__lldb_arg_obj)) {
1104  *((volatile int *)0) = 'ocgc';
1105  } else if ($__lldb_arg_selector != (void *)0) {
1106  signed char $responds = (signed char)
1107  [(id)$__lldb_arg_obj respondsToSelector:
1108  (void *) $__lldb_arg_selector];
1109  if ($responds == (signed char) 0)
1110  *((volatile int *)0) = 'ocgc';
1111  }
1112  })",
1113  name.c_str());
1114  } else {
1115  len = ::snprintf(check_function_code, sizeof(check_function_code), R"(
1116  extern "C" void *gdb_class_getClass(void *);
1117  extern "C" int printf(const char *format, ...);
1118  extern "C" void
1119  %s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {
1120  if ($__lldb_arg_obj == (void *)0)
1121  return; // nil is ok
1122  void **$isa_ptr = (void **)$__lldb_arg_obj;
1123  if (*$isa_ptr == (void *)0 ||
1124  !gdb_class_getClass(*$isa_ptr))
1125  *((volatile int *)0) = 'ocgc';
1126  else if ($__lldb_arg_selector != (void *)0) {
1127  signed char $responds = (signed char)
1128  [(id)$__lldb_arg_obj respondsToSelector:
1129  (void *) $__lldb_arg_selector];
1130  if ($responds == (signed char) 0)
1131  *((volatile int *)0) = 'ocgc';
1132  }
1133  })",
1134  name.c_str());
1135  }
1136 
1137  assert(len < (int)sizeof(check_function_code));
1139 
1140  return GetTargetRef().CreateUtilityFunction(check_function_code, name,
1141  eLanguageTypeC, exe_ctx);
1142 }
1143 
1145  const char *ivar_name) {
1146  uint32_t ivar_offset = LLDB_INVALID_IVAR_OFFSET;
1147 
1148  ConstString class_name = parent_ast_type.GetTypeName();
1149  if (!class_name.IsEmpty() && ivar_name && ivar_name[0]) {
1150  // Make the objective C V2 mangled name for the ivar offset from the class
1151  // name and ivar name
1152  std::string buffer("OBJC_IVAR_$_");
1153  buffer.append(class_name.AsCString());
1154  buffer.push_back('.');
1155  buffer.append(ivar_name);
1156  ConstString ivar_const_str(buffer.c_str());
1157 
1158  // Try to get the ivar offset address from the symbol table first using the
1159  // name we created above
1160  SymbolContextList sc_list;
1161  Target &target = m_process->GetTarget();
1162  target.GetImages().FindSymbolsWithNameAndType(ivar_const_str,
1163  eSymbolTypeObjCIVar, sc_list);
1164 
1165  addr_t ivar_offset_address = LLDB_INVALID_ADDRESS;
1166 
1167  Status error;
1168  SymbolContext ivar_offset_symbol;
1169  if (sc_list.GetSize() == 1 &&
1170  sc_list.GetContextAtIndex(0, ivar_offset_symbol)) {
1171  if (ivar_offset_symbol.symbol)
1172  ivar_offset_address =
1173  ivar_offset_symbol.symbol->GetLoadAddress(&target);
1174  }
1175 
1176  // If we didn't get the ivar offset address from the symbol table, fall
1177  // back to getting it from the runtime
1178  if (ivar_offset_address == LLDB_INVALID_ADDRESS)
1179  ivar_offset_address = LookupRuntimeSymbol(ivar_const_str);
1180 
1181  if (ivar_offset_address != LLDB_INVALID_ADDRESS)
1183  ivar_offset_address, 4, LLDB_INVALID_IVAR_OFFSET, error);
1184  }
1185  return ivar_offset;
1186 }
1187 
1188 // tagged pointers are special not-a-real-pointer values that contain both type
1189 // and value information this routine attempts to check with as little
1190 // computational effort as possible whether something could possibly be a
1191 // tagged pointer - false positives are possible but false negatives shouldn't
1194  return false;
1195  return m_tagged_pointer_vendor_up->IsPossibleTaggedPointer(ptr);
1196 }
1197 
1199 public:
1200  RemoteNXMapTable() : m_end_iterator(*this, -1) {}
1201 
1202  void Dump() {
1203  printf("RemoteNXMapTable.m_load_addr = 0x%" PRIx64 "\n", m_load_addr);
1204  printf("RemoteNXMapTable.m_count = %u\n", m_count);
1205  printf("RemoteNXMapTable.m_num_buckets_minus_one = %u\n",
1206  m_num_buckets_minus_one);
1207  printf("RemoteNXMapTable.m_buckets_ptr = 0x%" PRIX64 "\n", m_buckets_ptr);
1208  }
1209 
1210  bool ParseHeader(Process *process, lldb::addr_t load_addr) {
1211  m_process = process;
1212  m_load_addr = load_addr;
1213  m_map_pair_size = m_process->GetAddressByteSize() * 2;
1214  m_invalid_key =
1215  m_process->GetAddressByteSize() == 8 ? UINT64_MAX : UINT32_MAX;
1216  Status err;
1217 
1218  // This currently holds true for all platforms we support, but we might
1219  // need to change this to use get the actually byte size of "unsigned" from
1220  // the target AST...
1221  const uint32_t unsigned_byte_size = sizeof(uint32_t);
1222  // Skip the prototype as we don't need it (const struct
1223  // +NXMapTablePrototype *prototype)
1224 
1225  bool success = true;
1226  if (load_addr == LLDB_INVALID_ADDRESS)
1227  success = false;
1228  else {
1229  lldb::addr_t cursor = load_addr + m_process->GetAddressByteSize();
1230 
1231  // unsigned count;
1232  m_count = m_process->ReadUnsignedIntegerFromMemory(
1233  cursor, unsigned_byte_size, 0, err);
1234  if (m_count) {
1235  cursor += unsigned_byte_size;
1236 
1237  // unsigned nbBucketsMinusOne;
1238  m_num_buckets_minus_one = m_process->ReadUnsignedIntegerFromMemory(
1239  cursor, unsigned_byte_size, 0, err);
1240  cursor += unsigned_byte_size;
1241 
1242  // void *buckets;
1243  m_buckets_ptr = m_process->ReadPointerFromMemory(cursor, err);
1244 
1245  success = m_count > 0 && m_buckets_ptr != LLDB_INVALID_ADDRESS;
1246  }
1247  }
1248 
1249  if (!success) {
1250  m_count = 0;
1251  m_num_buckets_minus_one = 0;
1252  m_buckets_ptr = LLDB_INVALID_ADDRESS;
1253  }
1254  return success;
1255  }
1256 
1257  // const_iterator mimics NXMapState and its code comes from NXInitMapState
1258  // and NXNextMapState.
1259  typedef std::pair<ConstString, ObjCLanguageRuntime::ObjCISA> element;
1260 
1261  friend class const_iterator;
1263  public:
1264  const_iterator(RemoteNXMapTable &parent, int index)
1265  : m_parent(parent), m_index(index) {
1266  AdvanceToValidIndex();
1267  }
1268 
1270  : m_parent(rhs.m_parent), m_index(rhs.m_index) {
1271  // AdvanceToValidIndex() has been called by rhs already.
1272  }
1273 
1275  // AdvanceToValidIndex() has been called by rhs already.
1276  assert(&m_parent == &rhs.m_parent);
1277  m_index = rhs.m_index;
1278  return *this;
1279  }
1280 
1281  bool operator==(const const_iterator &rhs) const {
1282  if (&m_parent != &rhs.m_parent)
1283  return false;
1284  if (m_index != rhs.m_index)
1285  return false;
1286 
1287  return true;
1288  }
1289 
1290  bool operator!=(const const_iterator &rhs) const {
1291  return !(operator==(rhs));
1292  }
1293 
1295  AdvanceToValidIndex();
1296  return *this;
1297  }
1298 
1299  const element operator*() const {
1300  if (m_index == -1) {
1301  // TODO find a way to make this an error, but not an assert
1302  return element();
1303  }
1304 
1305  lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
1306  size_t map_pair_size = m_parent.m_map_pair_size;
1307  lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
1308 
1309  Status err;
1310 
1311  lldb::addr_t key =
1312  m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
1313  if (!err.Success())
1314  return element();
1315  lldb::addr_t value = m_parent.m_process->ReadPointerFromMemory(
1316  pair_ptr + m_parent.m_process->GetAddressByteSize(), err);
1317  if (!err.Success())
1318  return element();
1319 
1320  std::string key_string;
1321 
1322  m_parent.m_process->ReadCStringFromMemory(key, key_string, err);
1323  if (!err.Success())
1324  return element();
1325 
1326  return element(ConstString(key_string.c_str()),
1328  }
1329 
1330  private:
1332  if (m_index == -1)
1333  return;
1334 
1335  const lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
1336  const size_t map_pair_size = m_parent.m_map_pair_size;
1337  const lldb::addr_t invalid_key = m_parent.m_invalid_key;
1338  Status err;
1339 
1340  while (m_index--) {
1341  lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
1342  lldb::addr_t key =
1343  m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
1344 
1345  if (!err.Success()) {
1346  m_index = -1;
1347  return;
1348  }
1349 
1350  if (key != invalid_key)
1351  return;
1352  }
1353  }
1355  int m_index;
1356  };
1357 
1359  return const_iterator(*this, m_num_buckets_minus_one + 1);
1360  }
1361 
1362  const_iterator end() { return m_end_iterator; }
1363 
1364  uint32_t GetCount() const { return m_count; }
1365 
1366  uint32_t GetBucketCount() const { return m_num_buckets_minus_one; }
1367 
1368  lldb::addr_t GetBucketDataPointer() const { return m_buckets_ptr; }
1369 
1370  lldb::addr_t GetTableLoadAddress() const { return m_load_addr; }
1371 
1372 private:
1373  // contents of _NXMapTable struct
1374  uint32_t m_count = 0;
1375  uint32_t m_num_buckets_minus_one = 0;
1377  lldb_private::Process *m_process = nullptr;
1380  size_t m_map_pair_size = 0;
1381  lldb::addr_t m_invalid_key = 0;
1382 };
1383 
1385 
1387  const RemoteNXMapTable &hash_table) {
1388  m_count = hash_table.GetCount();
1389  m_num_buckets = hash_table.GetBucketCount();
1390  m_buckets_ptr = hash_table.GetBucketDataPointer();
1391 }
1392 
1394  Process *process, AppleObjCRuntimeV2 *runtime,
1395  RemoteNXMapTable &hash_table) {
1396  if (!hash_table.ParseHeader(process, runtime->GetISAHashTablePointer())) {
1397  return false; // Failed to parse the header, no need to update anything
1398  }
1399 
1400  // Check with out current signature and return true if the count, number of
1401  // buckets or the hash table address changes.
1402  if (m_count == hash_table.GetCount() &&
1403  m_num_buckets == hash_table.GetBucketCount() &&
1404  m_buckets_ptr == hash_table.GetBucketDataPointer()) {
1405  // Hash table hasn't changed
1406  return false;
1407  }
1408  // Hash table data has changed, we need to update
1409  return true;
1410 }
1411 
1414  ObjCLanguageRuntime::ClassDescriptorSP class_descriptor_sp;
1415  if (auto *non_pointer_isa_cache = GetNonPointerIsaCache())
1416  class_descriptor_sp = non_pointer_isa_cache->GetClassDescriptor(isa);
1417  if (!class_descriptor_sp)
1418  class_descriptor_sp = ObjCLanguageRuntime::GetClassDescriptorFromISA(isa);
1419  return class_descriptor_sp;
1420 }
1421 
1424  ClassDescriptorSP objc_class_sp;
1425  if (valobj.IsBaseClass()) {
1426  ValueObject *parent = valobj.GetParent();
1427  // if I am my own parent, bail out of here fast..
1428  if (parent && parent != &valobj) {
1429  ClassDescriptorSP parent_descriptor_sp = GetClassDescriptor(*parent);
1430  if (parent_descriptor_sp)
1431  return parent_descriptor_sp->GetSuperclass();
1432  }
1433  return nullptr;
1434  }
1435  // if we get an invalid VO (which might still happen when playing around with
1436  // pointers returned by the expression parser, don't consider this a valid
1437  // ObjC object)
1438  if (!valobj.GetCompilerType().IsValid())
1439  return objc_class_sp;
1440  addr_t isa_pointer = valobj.GetPointerValue();
1441 
1442  // tagged pointer
1443  if (IsTaggedPointer(isa_pointer))
1444  return m_tagged_pointer_vendor_up->GetClassDescriptor(isa_pointer);
1445  ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
1446 
1447  Process *process = exe_ctx.GetProcessPtr();
1448  if (!process)
1449  return objc_class_sp;
1450 
1451  Status error;
1452  ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
1453  if (isa == LLDB_INVALID_ADDRESS)
1454  return objc_class_sp;
1455 
1456  objc_class_sp = GetClassDescriptorFromISA(isa);
1457  if (isa && !objc_class_sp) {
1459  LLDB_LOGF(log,
1460  "0x%" PRIx64 ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
1461  "not in class descriptor cache 0x%" PRIx64,
1462  isa_pointer, isa);
1463  }
1464  return objc_class_sp;
1465 }
1466 
1470 
1471  Process *process = GetProcess();
1472  ModuleSP objc_module_sp(GetObjCModule());
1473 
1474  if (!objc_module_sp)
1475  return LLDB_INVALID_ADDRESS;
1476 
1477  static ConstString g_gdb_objc_obfuscator(
1478  "objc_debug_taggedpointer_obfuscator");
1479 
1480  const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
1481  g_gdb_objc_obfuscator, lldb::eSymbolTypeAny);
1482  if (symbol) {
1483  lldb::addr_t g_gdb_obj_obfuscator_ptr =
1484  symbol->GetLoadAddress(&process->GetTarget());
1485 
1486  if (g_gdb_obj_obfuscator_ptr != LLDB_INVALID_ADDRESS) {
1487  Status error;
1489  process->ReadPointerFromMemory(g_gdb_obj_obfuscator_ptr, error);
1490  }
1491  }
1492  // If we don't have a correct value at this point, there must be no
1493  // obfuscation.
1496 
1498 }
1499 
1502  Process *process = GetProcess();
1503 
1504  ModuleSP objc_module_sp(GetObjCModule());
1505 
1506  if (!objc_module_sp)
1507  return LLDB_INVALID_ADDRESS;
1508 
1509  static ConstString g_gdb_objc_realized_classes("gdb_objc_realized_classes");
1510 
1511  const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
1512  g_gdb_objc_realized_classes, lldb::eSymbolTypeAny);
1513  if (symbol) {
1514  lldb::addr_t gdb_objc_realized_classes_ptr =
1515  symbol->GetLoadAddress(&process->GetTarget());
1516 
1517  if (gdb_objc_realized_classes_ptr != LLDB_INVALID_ADDRESS) {
1518  Status error;
1520  gdb_objc_realized_classes_ptr, error);
1521  }
1522  }
1523  }
1524  return m_isa_hash_table_ptr;
1525 }
1526 
1527 std::unique_ptr<UtilityFunction>
1529  ExecutionContext &exe_ctx, std::string code, std::string name) {
1531 
1532  LLDB_LOG(log, "Creating utility function {0}", name);
1533 
1534  TypeSystemClang *ast =
1536  if (!ast)
1537  return {};
1538 
1539  auto utility_fn_or_error = exe_ctx.GetTargetRef().CreateUtilityFunction(
1540  std::move(code), std::move(name), eLanguageTypeC, exe_ctx);
1541  if (!utility_fn_or_error) {
1543  log, utility_fn_or_error.takeError(),
1544  "Failed to get utility function for implementation lookup: {0}");
1545  return {};
1546  }
1547 
1548  // Make some types for our arguments.
1549  CompilerType clang_uint32_t_type =
1551  CompilerType clang_void_pointer_type =
1553 
1554  // Make the runner function for our implementation utility function.
1555  ValueList arguments;
1556  Value value;
1558  value.SetCompilerType(clang_void_pointer_type);
1559  arguments.PushValue(value);
1560  arguments.PushValue(value);
1562  value.SetCompilerType(clang_uint32_t_type);
1563  arguments.PushValue(value);
1564  arguments.PushValue(value);
1565 
1566  std::unique_ptr<UtilityFunction> utility_fn = std::move(*utility_fn_or_error);
1567 
1568  Status error;
1569  utility_fn->MakeFunctionCaller(clang_uint32_t_type, arguments,
1570  exe_ctx.GetThreadSP(), error);
1571 
1572  if (error.Fail()) {
1573  LLDB_LOG(log,
1574  "Failed to make function caller for implementation lookup: {0}.",
1575  error.AsCString());
1576  return {};
1577  }
1578 
1579  return utility_fn;
1580 }
1581 
1584  ExecutionContext &exe_ctx, Helper helper) {
1585  switch (helper) {
1586  case gdb_objc_realized_classes: {
1587  if (!m_gdb_objc_realized_classes_helper.utility_function)
1588  m_gdb_objc_realized_classes_helper.utility_function =
1589  GetClassInfoUtilityFunctionImpl(exe_ctx,
1592  return m_gdb_objc_realized_classes_helper.utility_function.get();
1593  }
1594  case objc_copyRealizedClassList: {
1595  if (!m_objc_copyRealizedClassList_helper.utility_function)
1596  m_objc_copyRealizedClassList_helper.utility_function =
1597  GetClassInfoUtilityFunctionImpl(exe_ctx,
1600  return m_objc_copyRealizedClassList_helper.utility_function.get();
1601  }
1602  }
1603  llvm_unreachable("Unexpected helper");
1604 }
1605 
1606 lldb::addr_t &
1608  switch (helper) {
1609  case gdb_objc_realized_classes:
1610  return m_gdb_objc_realized_classes_helper.args;
1611  case objc_copyRealizedClassList:
1612  return m_objc_copyRealizedClassList_helper.args;
1613  }
1614  llvm_unreachable("Unexpected helper");
1615 }
1616 
1619  if (!m_runtime.m_has_objc_copyRealizedClassList)
1621 
1622  if (Process *process = m_runtime.GetProcess()) {
1623  if (DynamicLoader *loader = process->GetDynamicLoader()) {
1624  if (loader->IsFullyInitialized())
1626  }
1627  }
1628 
1630 }
1631 
1632 std::unique_ptr<UtilityFunction>
1636 
1637  LLDB_LOG(log, "Creating utility function {0}",
1639 
1640  TypeSystemClang *ast =
1642  if (!ast)
1643  return {};
1644 
1645  // If the inferior objc.dylib has the class_getNameRaw function, use that in
1646  // our jitted expression. Else fall back to the old class_getName.
1647  static ConstString g_class_getName_symbol_name("class_getName");
1648  static ConstString g_class_getNameRaw_symbol_name(
1649  "objc_debug_class_getNameRaw");
1650 
1651  ConstString class_name_getter_function_name =
1652  m_runtime.HasSymbol(g_class_getNameRaw_symbol_name)
1653  ? g_class_getNameRaw_symbol_name
1654  : g_class_getName_symbol_name;
1655 
1656  // Substitute in the correct class_getName / class_getNameRaw function name,
1657  // concatenate the two parts of our expression text. The format string has
1658  // two %s's, so provide the name twice.
1659  std::string shared_class_expression;
1660  llvm::raw_string_ostream(shared_class_expression)
1661  << llvm::format(g_shared_cache_class_name_funcptr,
1662  class_name_getter_function_name.AsCString(),
1663  class_name_getter_function_name.AsCString());
1664 
1665  shared_class_expression += g_get_shared_cache_class_info_body;
1666 
1667  auto utility_fn_or_error = exe_ctx.GetTargetRef().CreateUtilityFunction(
1668  std::move(shared_class_expression), g_get_shared_cache_class_info_name,
1669  eLanguageTypeC, exe_ctx);
1670 
1671  if (!utility_fn_or_error) {
1673  log, utility_fn_or_error.takeError(),
1674  "Failed to get utility function for implementation lookup: {0}");
1675  return nullptr;
1676  }
1677 
1678  // Make some types for our arguments.
1679  CompilerType clang_uint32_t_type =
1681  CompilerType clang_void_pointer_type =
1683  CompilerType clang_uint64_t_pointer_type =
1685  .GetPointerType();
1686 
1687  // Next make the function caller for our implementation utility function.
1688  ValueList arguments;
1689  Value value;
1691  value.SetCompilerType(clang_void_pointer_type);
1692  arguments.PushValue(value);
1693  arguments.PushValue(value);
1694  arguments.PushValue(value);
1695 
1697  value.SetCompilerType(clang_uint64_t_pointer_type);
1698  arguments.PushValue(value);
1699 
1701  value.SetCompilerType(clang_uint32_t_type);
1702  arguments.PushValue(value);
1703  arguments.PushValue(value);
1704 
1705  std::unique_ptr<UtilityFunction> utility_fn = std::move(*utility_fn_or_error);
1706 
1707  Status error;
1708  utility_fn->MakeFunctionCaller(clang_uint32_t_type, arguments,
1709  exe_ctx.GetThreadSP(), error);
1710 
1711  if (error.Fail()) {
1712  LLDB_LOG(log,
1713  "Failed to make function caller for implementation lookup: {0}.",
1714  error.AsCString());
1715  return {};
1716  }
1717 
1718  return utility_fn;
1719 }
1720 
1723  ExecutionContext &exe_ctx) {
1724  if (!m_utility_function)
1725  m_utility_function = GetClassInfoUtilityFunctionImpl(exe_ctx);
1726  return m_utility_function.get();
1727 }
1728 
1731  RemoteNXMapTable &hash_table) {
1732  Process *process = m_runtime.GetProcess();
1733  if (process == nullptr)
1735 
1736  uint32_t num_class_infos = 0;
1737 
1739 
1740  ExecutionContext exe_ctx;
1741 
1742  ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
1743 
1744  if (!thread_sp)
1746 
1747  thread_sp->CalculateExecutionContext(exe_ctx);
1748  TypeSystemClang *ast =
1750 
1751  if (!ast)
1753 
1754  Address function_address;
1755 
1756  const uint32_t addr_size = process->GetAddressByteSize();
1757 
1758  Status err;
1759 
1760  // Compute which helper we're going to use for this update.
1761  const DynamicClassInfoExtractor::Helper helper = ComputeHelper();
1762 
1763  // Read the total number of classes from the hash table
1764  const uint32_t num_classes =
1766  ? hash_table.GetCount()
1767  : m_runtime.m_realized_class_generation_count;
1768  if (num_classes == 0) {
1769  LLDB_LOGF(log, "No dynamic classes found.");
1771  }
1772 
1773  UtilityFunction *get_class_info_code =
1774  GetClassInfoUtilityFunction(exe_ctx, helper);
1775  if (!get_class_info_code) {
1776  // The callee will have already logged a useful error message.
1778  }
1779 
1780  FunctionCaller *get_class_info_function =
1781  get_class_info_code->GetFunctionCaller();
1782 
1783  if (!get_class_info_function) {
1784  LLDB_LOGF(log, "Failed to get implementation lookup function caller.");
1786  }
1787 
1788  ValueList arguments = get_class_info_function->GetArgumentValues();
1789 
1790  DiagnosticManager diagnostics;
1791 
1792  const uint32_t class_info_byte_size = addr_size + 4;
1793  const uint32_t class_infos_byte_size = num_classes * class_info_byte_size;
1794  lldb::addr_t class_infos_addr = process->AllocateMemory(
1795  class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
1796 
1797  if (class_infos_addr == LLDB_INVALID_ADDRESS) {
1798  LLDB_LOGF(log,
1799  "unable to allocate %" PRIu32
1800  " bytes in process for shared cache read",
1801  class_infos_byte_size);
1803  }
1804 
1805  std::lock_guard<std::mutex> guard(m_mutex);
1806 
1807  // Fill in our function argument values
1808  arguments.GetValueAtIndex(0)->GetScalar() = hash_table.GetTableLoadAddress();
1809  arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
1810  arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
1811 
1812  // Only dump the runtime classes from the expression evaluation if the log is
1813  // verbose:
1815  bool dump_log = type_log && type_log->GetVerbose();
1816 
1817  arguments.GetValueAtIndex(3)->GetScalar() = dump_log ? 1 : 0;
1818 
1819  bool success = false;
1820 
1821  diagnostics.Clear();
1822 
1823  // Write our function arguments into the process so we can run our function
1824  if (get_class_info_function->WriteFunctionArguments(
1825  exe_ctx, GetClassInfoArgs(helper), arguments, diagnostics)) {
1826  EvaluateExpressionOptions options;
1827  options.SetUnwindOnError(true);
1828  options.SetTryAllThreads(false);
1829  options.SetStopOthers(true);
1830  options.SetIgnoreBreakpoints(true);
1831  options.SetTimeout(process->GetUtilityExpressionTimeout());
1832  options.SetIsForUtilityExpr(true);
1833 
1834  CompilerType clang_uint32_t_type =
1836 
1837  Value return_value;
1838  return_value.SetValueType(Value::ValueType::Scalar);
1839  return_value.SetCompilerType(clang_uint32_t_type);
1840  return_value.GetScalar() = 0;
1841 
1842  diagnostics.Clear();
1843 
1844  // Run the function
1845  ExpressionResults results = get_class_info_function->ExecuteFunction(
1846  exe_ctx, &GetClassInfoArgs(helper), options, diagnostics, return_value);
1847 
1848  if (results == eExpressionCompleted) {
1849  // The result is the number of ClassInfo structures that were filled in
1850  num_class_infos = return_value.GetScalar().ULong();
1851  LLDB_LOG(log, "Discovered {0} Objective-C classes", num_class_infos);
1852  if (num_class_infos > 0) {
1853  // Read the ClassInfo structures
1854  DataBufferHeap buffer(num_class_infos * class_info_byte_size, 0);
1855  if (process->ReadMemory(class_infos_addr, buffer.GetBytes(),
1856  buffer.GetByteSize(),
1857  err) == buffer.GetByteSize()) {
1858  DataExtractor class_infos_data(buffer.GetBytes(),
1859  buffer.GetByteSize(),
1860  process->GetByteOrder(), addr_size);
1861  m_runtime.ParseClassInfoArray(class_infos_data, num_class_infos);
1862  }
1863  }
1864  success = true;
1865  } else {
1866  if (log) {
1867  LLDB_LOGF(log, "Error evaluating our find class name function.");
1868  diagnostics.Dump(log);
1869  }
1870  }
1871  } else {
1872  if (log) {
1873  LLDB_LOGF(log, "Error writing function arguments.");
1874  diagnostics.Dump(log);
1875  }
1876  }
1877 
1878  // Deallocate the memory we allocated for the ClassInfo array
1879  process->DeallocateMemory(class_infos_addr);
1880 
1881  return DescriptorMapUpdateResult(success, num_class_infos);
1882 }
1883 
1885  uint32_t num_class_infos) {
1886  // Parses an array of "num_class_infos" packed ClassInfo structures:
1887  //
1888  // struct ClassInfo
1889  // {
1890  // Class isa;
1891  // uint32_t hash;
1892  // } __attribute__((__packed__));
1893 
1895  bool should_log = log && log->GetVerbose();
1896 
1897  uint32_t num_parsed = 0;
1898 
1899  // Iterate through all ClassInfo structures
1900  lldb::offset_t offset = 0;
1901  for (uint32_t i = 0; i < num_class_infos; ++i) {
1902  ObjCISA isa = data.GetAddress(&offset);
1903 
1904  if (isa == 0) {
1905  if (should_log)
1906  LLDB_LOGF(
1907  log, "AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
1908  continue;
1909  }
1910  // Check if we already know about this ISA, if we do, the info will never
1911  // change, so we can just skip it.
1912  if (ISAIsCached(isa)) {
1913  if (should_log)
1914  LLDB_LOGF(log,
1915  "AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
1916  ", ignoring this class info",
1917  isa);
1918  offset += 4;
1919  } else {
1920  // Read the 32 bit hash for the class name
1921  const uint32_t name_hash = data.GetU32(&offset);
1922  ClassDescriptorSP descriptor_sp(
1923  new ClassDescriptorV2(*this, isa, nullptr));
1924 
1925  // The code in g_get_shared_cache_class_info_body sets the value of the
1926  // hash to 0 to signal a demangled symbol. We use class_getName() in that
1927  // code to find the class name, but this returns a demangled name for
1928  // Swift symbols. For those symbols, recompute the hash here by reading
1929  // their name from the runtime.
1930  if (name_hash)
1931  AddClass(isa, descriptor_sp, name_hash);
1932  else
1933  AddClass(isa, descriptor_sp,
1934  descriptor_sp->GetClassName().AsCString(nullptr));
1935  num_parsed++;
1936  if (should_log)
1937  LLDB_LOGF(log,
1938  "AppleObjCRuntimeV2 added isa=0x%" PRIx64
1939  ", hash=0x%8.8x, name=%s",
1940  isa, name_hash,
1941  descriptor_sp->GetClassName().AsCString("<unknown>"));
1942  }
1943  }
1944  if (should_log)
1945  LLDB_LOGF(log, "AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
1946  num_parsed);
1947  return num_parsed;
1948 }
1949 
1951  if (!m_objc_module_sp)
1952  return false;
1953  if (const Symbol *symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType(
1954  Name, lldb::eSymbolTypeCode)) {
1955  if (symbol->ValueIsAddress() || symbol->GetAddressRef().IsValid())
1956  return true;
1957  }
1958  return false;
1959 }
1960 
1963  Process *process = m_runtime.GetProcess();
1964  if (process == nullptr)
1966 
1968 
1969  ExecutionContext exe_ctx;
1970 
1971  ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
1972 
1973  if (!thread_sp)
1975 
1976  thread_sp->CalculateExecutionContext(exe_ctx);
1977  TypeSystemClang *ast =
1979 
1980  if (!ast)
1982 
1983  Address function_address;
1984 
1985  const uint32_t addr_size = process->GetAddressByteSize();
1986 
1987  Status err;
1988 
1989  uint32_t num_class_infos = 0;
1990 
1991  const lldb::addr_t objc_opt_ptr = m_runtime.GetSharedCacheReadOnlyAddress();
1992  const lldb::addr_t shared_cache_base_addr =
1993  m_runtime.GetSharedCacheBaseAddress();
1994 
1995  if (objc_opt_ptr == LLDB_INVALID_ADDRESS ||
1996  shared_cache_base_addr == LLDB_INVALID_ADDRESS)
1998 
1999  const uint32_t num_classes = 128 * 1024;
2000 
2001  UtilityFunction *get_class_info_code = GetClassInfoUtilityFunction(exe_ctx);
2002  FunctionCaller *get_shared_cache_class_info_function =
2003  get_class_info_code->GetFunctionCaller();
2004 
2005  if (!get_shared_cache_class_info_function) {
2006  LLDB_LOGF(log, "Failed to get implementation lookup function caller.");
2008  }
2009 
2010  ValueList arguments =
2011  get_shared_cache_class_info_function->GetArgumentValues();
2012 
2013  DiagnosticManager diagnostics;
2014 
2015  const uint32_t class_info_byte_size = addr_size + 4;
2016  const uint32_t class_infos_byte_size = num_classes * class_info_byte_size;
2017  lldb::addr_t class_infos_addr = process->AllocateMemory(
2018  class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
2019  const uint32_t relative_selector_offset_addr_size = 64;
2020  lldb::addr_t relative_selector_offset_addr =
2021  process->AllocateMemory(relative_selector_offset_addr_size,
2022  ePermissionsReadable | ePermissionsWritable, err);
2023 
2024  if (class_infos_addr == LLDB_INVALID_ADDRESS) {
2025  LLDB_LOGF(log,
2026  "unable to allocate %" PRIu32
2027  " bytes in process for shared cache read",
2028  class_infos_byte_size);
2030  }
2031 
2032  std::lock_guard<std::mutex> guard(m_mutex);
2033 
2034  // Fill in our function argument values
2035  arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
2036  arguments.GetValueAtIndex(1)->GetScalar() = shared_cache_base_addr;
2037  arguments.GetValueAtIndex(2)->GetScalar() = class_infos_addr;
2038  arguments.GetValueAtIndex(3)->GetScalar() = relative_selector_offset_addr;
2039  arguments.GetValueAtIndex(4)->GetScalar() = class_infos_byte_size;
2040  // Only dump the runtime classes from the expression evaluation if the log is
2041  // verbose:
2043  bool dump_log = type_log && type_log->GetVerbose();
2044 
2045  arguments.GetValueAtIndex(5)->GetScalar() = dump_log ? 1 : 0;
2046 
2047  bool success = false;
2048 
2049  diagnostics.Clear();
2050 
2051  // Write our function arguments into the process so we can run our function
2052  if (get_shared_cache_class_info_function->WriteFunctionArguments(
2053  exe_ctx, m_args, arguments, diagnostics)) {
2054  EvaluateExpressionOptions options;
2055  options.SetUnwindOnError(true);
2056  options.SetTryAllThreads(false);
2057  options.SetStopOthers(true);
2058  options.SetIgnoreBreakpoints(true);
2059  options.SetTimeout(process->GetUtilityExpressionTimeout());
2060  options.SetIsForUtilityExpr(true);
2061 
2062  CompilerType clang_uint32_t_type =
2064 
2065  Value return_value;
2066  return_value.SetValueType(Value::ValueType::Scalar);
2067  return_value.SetCompilerType(clang_uint32_t_type);
2068  return_value.GetScalar() = 0;
2069 
2070  diagnostics.Clear();
2071 
2072  // Run the function
2073  ExpressionResults results =
2074  get_shared_cache_class_info_function->ExecuteFunction(
2075  exe_ctx, &m_args, options, diagnostics, return_value);
2076 
2077  if (results == eExpressionCompleted) {
2078  // The result is the number of ClassInfo structures that were filled in
2079  num_class_infos = return_value.GetScalar().ULong();
2080  LLDB_LOG(log, "Discovered {0} Objective-C classes in the shared cache",
2081  num_class_infos);
2082  assert(num_class_infos <= num_classes);
2083  if (num_class_infos > 0) {
2084  if (num_class_infos > num_classes) {
2085  num_class_infos = num_classes;
2086 
2087  success = false;
2088  } else {
2089  success = true;
2090  }
2091 
2092  // Read the relative selector offset.
2093  DataBufferHeap relative_selector_offset_buffer(64, 0);
2094  if (process->ReadMemory(relative_selector_offset_addr,
2095  relative_selector_offset_buffer.GetBytes(),
2096  relative_selector_offset_buffer.GetByteSize(),
2097  err) ==
2098  relative_selector_offset_buffer.GetByteSize()) {
2099  DataExtractor relative_selector_offset_data(
2100  relative_selector_offset_buffer.GetBytes(),
2101  relative_selector_offset_buffer.GetByteSize(),
2102  process->GetByteOrder(), addr_size);
2103  lldb::offset_t offset = 0;
2104  uint64_t relative_selector_offset =
2105  relative_selector_offset_data.GetU64(&offset);
2106  if (relative_selector_offset > 0) {
2107  // The offset is relative to the objc_opt struct.
2108  m_runtime.SetRelativeSelectorBaseAddr(objc_opt_ptr +
2109  relative_selector_offset);
2110  }
2111  }
2112 
2113  // Read the ClassInfo structures
2114  DataBufferHeap class_infos_buffer(
2115  num_class_infos * class_info_byte_size, 0);
2116  if (process->ReadMemory(class_infos_addr, class_infos_buffer.GetBytes(),
2117  class_infos_buffer.GetByteSize(),
2118  err) == class_infos_buffer.GetByteSize()) {
2119  DataExtractor class_infos_data(class_infos_buffer.GetBytes(),
2120  class_infos_buffer.GetByteSize(),
2121  process->GetByteOrder(), addr_size);
2122 
2123  m_runtime.ParseClassInfoArray(class_infos_data, num_class_infos);
2124  }
2125  } else {
2126  success = true;
2127  }
2128  } else {
2129  if (log) {
2130  LLDB_LOGF(log, "Error evaluating our find class name function.");
2131  diagnostics.Dump(log);
2132  }
2133  }
2134  } else {
2135  if (log) {
2136  LLDB_LOGF(log, "Error writing function arguments.");
2137  diagnostics.Dump(log);
2138  }
2139  }
2140 
2141  // Deallocate the memory we allocated for the ClassInfo array
2142  process->DeallocateMemory(class_infos_addr);
2143 
2144  return DescriptorMapUpdateResult(success, num_class_infos);
2145 }
2146 
2148  Process *process = GetProcess();
2149 
2150  if (process) {
2151  ModuleSP objc_module_sp(GetObjCModule());
2152 
2153  if (objc_module_sp) {
2154  ObjectFile *objc_object = objc_module_sp->GetObjectFile();
2155 
2156  if (objc_object) {
2157  SectionList *section_list = objc_module_sp->GetSectionList();
2158 
2159  if (section_list) {
2160  SectionSP text_segment_sp(
2161  section_list->FindSectionByName(ConstString("__TEXT")));
2162 
2163  if (text_segment_sp) {
2164  SectionSP objc_opt_section_sp(
2165  text_segment_sp->GetChildren().FindSectionByName(
2166  ConstString("__objc_opt_ro")));
2167 
2168  if (objc_opt_section_sp) {
2169  return objc_opt_section_sp->GetLoadBaseAddress(
2170  &process->GetTarget());
2171  }
2172  }
2173  }
2174  }
2175  }
2176  }
2177  return LLDB_INVALID_ADDRESS;
2178 }
2179 
2182  if (!info)
2183  return LLDB_INVALID_ADDRESS;
2184 
2185  StructuredData::Dictionary *info_dict = info->GetAsDictionary();
2186  if (!info_dict)
2187  return LLDB_INVALID_ADDRESS;
2188 
2189  StructuredData::ObjectSP value =
2190  info_dict->GetValueForKey("shared_cache_base_address");
2191  if (!value)
2192  return LLDB_INVALID_ADDRESS;
2193 
2194  return value->GetIntegerValue(LLDB_INVALID_ADDRESS);
2195 }
2196 
2199 
2201 
2202  // Else we need to check with our process to see when the map was updated.
2203  Process *process = GetProcess();
2204 
2205  if (process) {
2206  RemoteNXMapTable hash_table;
2207 
2208  // Update the process stop ID that indicates the last time we updated the
2209  // map, whether it was successful or not.
2211 
2212  // Ask the runtime is the realized class generation count changed. Unlike
2213  // the hash table, this accounts for lazily named classes.
2214  const bool class_count_changed = RealizedClassGenerationCountChanged();
2215 
2216  if (!m_hash_signature.NeedsUpdate(process, this, hash_table) &&
2217  !class_count_changed)
2218  return;
2219 
2220  m_hash_signature.UpdateSignature(hash_table);
2221 
2222  // Grab the dynamically loaded Objective-C classes from memory.
2223  DescriptorMapUpdateResult dynamic_update_result =
2225 
2226  // Now get the objc classes that are baked into the Objective-C runtime in
2227  // the shared cache, but only once per process as this data never changes
2228  if (!m_loaded_objc_opt) {
2229  // it is legitimately possible for the shared cache to be empty - in that
2230  // case, the dynamic hash table will contain all the class information we
2231  // need; the situation we're trying to detect is one where we aren't
2232  // seeing class information from the runtime - in order to detect that
2233  // vs. just the shared cache being empty or sparsely populated, we set an
2234  // arbitrary (very low) threshold for the number of classes that we want
2235  // to see in a "good" scenario - anything below that is suspicious
2236  // (Foundation alone has thousands of classes)
2237  const uint32_t num_classes_to_warn_at = 500;
2238 
2239  DescriptorMapUpdateResult shared_cache_update_result =
2241 
2242  LLDB_LOGF(log,
2243  "attempted to read objc class data - results: "
2244  "[dynamic_update]: ran: %s, count: %" PRIu32
2245  " [shared_cache_update]: ran: %s, count: %" PRIu32,
2246  dynamic_update_result.m_update_ran ? "yes" : "no",
2247  dynamic_update_result.m_num_found,
2248  shared_cache_update_result.m_update_ran ? "yes" : "no",
2249  shared_cache_update_result.m_num_found);
2250 
2251  // warn if:
2252  // - we could not run either expression
2253  // - we found fewer than num_classes_to_warn_at classes total
2254  if ((!shared_cache_update_result.m_update_ran) ||
2255  (!dynamic_update_result.m_update_ran))
2258  else if (dynamic_update_result.m_num_found +
2259  shared_cache_update_result.m_num_found <
2260  num_classes_to_warn_at)
2262  else
2263  m_loaded_objc_opt = true;
2264  }
2265  } else {
2267  }
2268 }
2269 
2271  Process *process = GetProcess();
2272  if (!process)
2273  return false;
2274 
2275  Status error;
2276  uint64_t objc_debug_realized_class_generation_count =
2278  process, ConstString("objc_debug_realized_class_generation_count"),
2279  GetObjCModule(), error);
2280  if (error.Fail())
2281  return false;
2282 
2284  objc_debug_realized_class_generation_count)
2285  return false;
2286 
2288  LLDB_LOG(log,
2289  "objc_debug_realized_class_generation_count changed from {0} to {1}",
2291  objc_debug_realized_class_generation_count);
2292 
2294  objc_debug_realized_class_generation_count;
2295 
2296  return true;
2297 }
2298 
2299 static bool DoesProcessHaveSharedCache(Process &process) {
2300  PlatformSP platform_sp = process.GetTarget().GetPlatform();
2301  if (!platform_sp)
2302  return true; // this should not happen
2303 
2304  ConstString platform_plugin_name = platform_sp->GetPluginName();
2305  if (platform_plugin_name) {
2306  llvm::StringRef platform_plugin_name_sr =
2307  platform_plugin_name.GetStringRef();
2308  if (platform_plugin_name_sr.endswith("-simulator"))
2309  return false;
2310  }
2311 
2312  return true;
2313 }
2314 
2316  SharedCacheWarningReason reason) {
2318  return;
2319 
2321  // Simulators do not have the objc_opt_ro class table so don't actually
2322  // complain to the user
2324  return;
2325  }
2326 
2327  Debugger &debugger(GetProcess()->GetTarget().GetDebugger());
2328  if (auto stream = debugger.GetAsyncOutputStream()) {
2329  switch (reason) {
2331  stream->PutCString("warning: could not find Objective-C class data in "
2332  "the process. This may reduce the quality of type "
2333  "information available.\n");
2335  break;
2337  stream->PutCString("warning: could not execute support code to read "
2338  "Objective-C class data in the process. This may "
2339  "reduce the quality of type information available.\n");
2341  break;
2342  }
2343  }
2344 }
2345 
2347  if (!m_decl_vendor_up)
2348  m_decl_vendor_up = std::make_unique<AppleObjCDeclVendor>(*this);
2349 
2350  return m_decl_vendor_up.get();
2351 }
2352 
2355 
2356  const char *name_cstr = name.AsCString();
2357 
2358  if (name_cstr) {
2359  llvm::StringRef name_strref(name_cstr);
2360 
2361  llvm::StringRef ivar_prefix("OBJC_IVAR_$_");
2362  llvm::StringRef class_prefix("OBJC_CLASS_$_");
2363 
2364  if (name_strref.startswith(ivar_prefix)) {
2365  llvm::StringRef ivar_skipped_prefix =
2366  name_strref.substr(ivar_prefix.size());
2367  std::pair<llvm::StringRef, llvm::StringRef> class_and_ivar =
2368  ivar_skipped_prefix.split('.');
2369 
2370  if (class_and_ivar.first.size() && class_and_ivar.second.size()) {
2371  const ConstString class_name_cs(class_and_ivar.first);
2372  ClassDescriptorSP descriptor =
2374 
2375  if (descriptor) {
2376  const ConstString ivar_name_cs(class_and_ivar.second);
2377  const char *ivar_name_cstr = ivar_name_cs.AsCString();
2378 
2379  auto ivar_func = [&ret,
2380  ivar_name_cstr](const char *name, const char *type,
2381  lldb::addr_t offset_addr,
2382  uint64_t size) -> lldb::addr_t {
2383  if (!strcmp(name, ivar_name_cstr)) {
2384  ret = offset_addr;
2385  return true;
2386  }
2387  return false;
2388  };
2389 
2390  descriptor->Describe(
2391  std::function<void(ObjCISA)>(nullptr),
2392  std::function<bool(const char *, const char *)>(nullptr),
2393  std::function<bool(const char *, const char *)>(nullptr),
2394  ivar_func);
2395  }
2396  }
2397  } else if (name_strref.startswith(class_prefix)) {
2398  llvm::StringRef class_skipped_prefix =
2399  name_strref.substr(class_prefix.size());
2400  const ConstString class_name_cs(class_skipped_prefix);
2401  ClassDescriptorSP descriptor =
2402  GetClassDescriptorFromClassName(class_name_cs);
2403 
2404  if (descriptor)
2405  ret = descriptor->GetISA();
2406  }
2407  }
2408 
2409  return ret;
2410 }
2411 
2414  AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp) {
2415  Process *process(runtime.GetProcess());
2416 
2417  Status error;
2418 
2420 
2421  auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol(
2422  process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error);
2423  if (error.Fail())
2424  return nullptr;
2425 
2426  auto objc_debug_isa_magic_value = ExtractRuntimeGlobalSymbol(
2427  process, ConstString("objc_debug_isa_magic_value"), objc_module_sp,
2428  error);
2429  if (error.Fail())
2430  return nullptr;
2431 
2432  auto objc_debug_isa_class_mask = ExtractRuntimeGlobalSymbol(
2433  process, ConstString("objc_debug_isa_class_mask"), objc_module_sp, error);
2434  if (error.Fail())
2435  return nullptr;
2436 
2437  if (log)
2438  log->PutCString("AOCRT::NPI: Found all the non-indexed ISA masks");
2439 
2440  bool foundError = false;
2441  auto objc_debug_indexed_isa_magic_mask = ExtractRuntimeGlobalSymbol(
2442  process, ConstString("objc_debug_indexed_isa_magic_mask"), objc_module_sp,
2443  error);
2444  foundError |= error.Fail();
2445 
2446  auto objc_debug_indexed_isa_magic_value = ExtractRuntimeGlobalSymbol(
2447  process, ConstString("objc_debug_indexed_isa_magic_value"),
2448  objc_module_sp, error);
2449  foundError |= error.Fail();
2450 
2451  auto objc_debug_indexed_isa_index_mask = ExtractRuntimeGlobalSymbol(
2452  process, ConstString("objc_debug_indexed_isa_index_mask"), objc_module_sp,
2453  error);
2454  foundError |= error.Fail();
2455 
2456  auto objc_debug_indexed_isa_index_shift = ExtractRuntimeGlobalSymbol(
2457  process, ConstString("objc_debug_indexed_isa_index_shift"),
2458  objc_module_sp, error);
2459  foundError |= error.Fail();
2460 
2461  auto objc_indexed_classes =
2462  ExtractRuntimeGlobalSymbol(process, ConstString("objc_indexed_classes"),
2463  objc_module_sp, error, false);
2464  foundError |= error.Fail();
2465 
2466  if (log)
2467  log->PutCString("AOCRT::NPI: Found all the indexed ISA masks");
2468 
2469  // we might want to have some rules to outlaw these other values (e.g if the
2470  // mask is zero but the value is non-zero, ...)
2471 
2472  return new NonPointerISACache(
2473  runtime, objc_module_sp, objc_debug_isa_class_mask,
2474  objc_debug_isa_magic_mask, objc_debug_isa_magic_value,
2475  objc_debug_indexed_isa_magic_mask, objc_debug_indexed_isa_magic_value,
2476  objc_debug_indexed_isa_index_mask, objc_debug_indexed_isa_index_shift,
2477  foundError ? 0 : objc_indexed_classes);
2478 }
2479 
2482  AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp) {
2483  Process *process(runtime.GetProcess());
2484 
2485  Status error;
2486 
2487  auto objc_debug_taggedpointer_mask = ExtractRuntimeGlobalSymbol(
2488  process, ConstString("objc_debug_taggedpointer_mask"), objc_module_sp,
2489  error);
2490  if (error.Fail())
2491  return new TaggedPointerVendorLegacy(runtime);
2492 
2493  auto objc_debug_taggedpointer_slot_shift = ExtractRuntimeGlobalSymbol(
2494  process, ConstString("objc_debug_taggedpointer_slot_shift"),
2495  objc_module_sp, error, true, 4);
2496  if (error.Fail())
2497  return new TaggedPointerVendorLegacy(runtime);
2498 
2499  auto objc_debug_taggedpointer_slot_mask = ExtractRuntimeGlobalSymbol(
2500  process, ConstString("objc_debug_taggedpointer_slot_mask"),
2501  objc_module_sp, error, true, 4);
2502  if (error.Fail())
2503  return new TaggedPointerVendorLegacy(runtime);
2504 
2505  auto objc_debug_taggedpointer_payload_lshift = ExtractRuntimeGlobalSymbol(
2506  process, ConstString("objc_debug_taggedpointer_payload_lshift"),
2507  objc_module_sp, error, true, 4);
2508  if (error.Fail())
2509  return new TaggedPointerVendorLegacy(runtime);
2510 
2511  auto objc_debug_taggedpointer_payload_rshift = ExtractRuntimeGlobalSymbol(
2512  process, ConstString("objc_debug_taggedpointer_payload_rshift"),
2513  objc_module_sp, error, true, 4);
2514  if (error.Fail())
2515  return new TaggedPointerVendorLegacy(runtime);
2516 
2517  auto objc_debug_taggedpointer_classes = ExtractRuntimeGlobalSymbol(
2518  process, ConstString("objc_debug_taggedpointer_classes"), objc_module_sp,
2519  error, false);
2520  if (error.Fail())
2521  return new TaggedPointerVendorLegacy(runtime);
2522 
2523  // try to detect the "extended tagged pointer" variables - if any are
2524  // missing, use the non-extended vendor
2525  do {
2526  auto objc_debug_taggedpointer_ext_mask = ExtractRuntimeGlobalSymbol(
2527  process, ConstString("objc_debug_taggedpointer_ext_mask"),
2528  objc_module_sp, error);
2529  if (error.Fail())
2530  break;
2531 
2532  auto objc_debug_taggedpointer_ext_slot_shift = ExtractRuntimeGlobalSymbol(
2533  process, ConstString("objc_debug_taggedpointer_ext_slot_shift"),
2534  objc_module_sp, error, true, 4);
2535  if (error.Fail())
2536  break;
2537 
2538  auto objc_debug_taggedpointer_ext_slot_mask = ExtractRuntimeGlobalSymbol(
2539  process, ConstString("objc_debug_taggedpointer_ext_slot_mask"),
2540  objc_module_sp, error, true, 4);
2541  if (error.Fail())
2542  break;
2543 
2544  auto objc_debug_taggedpointer_ext_classes = ExtractRuntimeGlobalSymbol(
2545  process, ConstString("objc_debug_taggedpointer_ext_classes"),
2546  objc_module_sp, error, false);
2547  if (error.Fail())
2548  break;
2549 
2550  auto objc_debug_taggedpointer_ext_payload_lshift =
2552  process, ConstString("objc_debug_taggedpointer_ext_payload_lshift"),
2553  objc_module_sp, error, true, 4);
2554  if (error.Fail())
2555  break;
2556 
2557  auto objc_debug_taggedpointer_ext_payload_rshift =
2559  process, ConstString("objc_debug_taggedpointer_ext_payload_rshift"),
2560  objc_module_sp, error, true, 4);
2561  if (error.Fail())
2562  break;
2563 
2564  return new TaggedPointerVendorExtended(
2565  runtime, objc_debug_taggedpointer_mask,
2566  objc_debug_taggedpointer_ext_mask, objc_debug_taggedpointer_slot_shift,
2567  objc_debug_taggedpointer_ext_slot_shift,
2568  objc_debug_taggedpointer_slot_mask,
2569  objc_debug_taggedpointer_ext_slot_mask,
2570  objc_debug_taggedpointer_payload_lshift,
2571  objc_debug_taggedpointer_payload_rshift,
2572  objc_debug_taggedpointer_ext_payload_lshift,
2573  objc_debug_taggedpointer_ext_payload_rshift,
2574  objc_debug_taggedpointer_classes, objc_debug_taggedpointer_ext_classes);
2575  } while (false);
2576 
2577  // we might want to have some rules to outlaw these values (e.g if the
2578  // table's address is zero)
2579 
2581  runtime, objc_debug_taggedpointer_mask,
2582  objc_debug_taggedpointer_slot_shift, objc_debug_taggedpointer_slot_mask,
2583  objc_debug_taggedpointer_payload_lshift,
2584  objc_debug_taggedpointer_payload_rshift,
2585  objc_debug_taggedpointer_classes);
2586 }
2587 
2589  lldb::addr_t ptr) {
2590  return (ptr & 1);
2591 }
2592 
2595  lldb::addr_t ptr) {
2596  if (!IsPossibleTaggedPointer(ptr))
2598 
2599  uint32_t foundation_version = m_runtime.GetFoundationVersion();
2600 
2601  if (foundation_version == LLDB_INVALID_MODULE_VERSION)
2603 
2604  uint64_t class_bits = (ptr & 0xE) >> 1;
2605  ConstString name;
2606 
2607  static ConstString g_NSAtom("NSAtom");
2608  static ConstString g_NSNumber("NSNumber");
2609  static ConstString g_NSDateTS("NSDateTS");
2610  static ConstString g_NSManagedObject("NSManagedObject");
2611  static ConstString g_NSDate("NSDate");
2612 
2613  if (foundation_version >= 900) {
2614  switch (class_bits) {
2615  case 0:
2616  name = g_NSAtom;
2617  break;
2618  case 3:
2619  name = g_NSNumber;
2620  break;
2621  case 4:
2622  name = g_NSDateTS;
2623  break;
2624  case 5:
2625  name = g_NSManagedObject;
2626  break;
2627  case 6:
2628  name = g_NSDate;
2629  break;
2630  default:
2632  }
2633  } else {
2634  switch (class_bits) {
2635  case 1:
2636  name = g_NSNumber;
2637  break;
2638  case 5:
2639  name = g_NSManagedObject;
2640  break;
2641  case 6:
2642  name = g_NSDate;
2643  break;
2644  case 7:
2645  name = g_NSDateTS;
2646  break;
2647  default:
2649  }
2650  }
2651 
2652  lldb::addr_t unobfuscated = ptr ^ m_runtime.GetTaggedPointerObfuscator();
2653  return ClassDescriptorSP(new ClassDescriptorV2Tagged(name, unobfuscated));
2654 }
2655 
2658  AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask,
2659  uint32_t objc_debug_taggedpointer_slot_shift,
2660  uint32_t objc_debug_taggedpointer_slot_mask,
2661  uint32_t objc_debug_taggedpointer_payload_lshift,
2662  uint32_t objc_debug_taggedpointer_payload_rshift,
2663  lldb::addr_t objc_debug_taggedpointer_classes)
2664  : TaggedPointerVendorV2(runtime), m_cache(),
2665  m_objc_debug_taggedpointer_mask(objc_debug_taggedpointer_mask),
2666  m_objc_debug_taggedpointer_slot_shift(
2667  objc_debug_taggedpointer_slot_shift),
2668  m_objc_debug_taggedpointer_slot_mask(objc_debug_taggedpointer_slot_mask),
2669  m_objc_debug_taggedpointer_payload_lshift(
2670  objc_debug_taggedpointer_payload_lshift),
2671  m_objc_debug_taggedpointer_payload_rshift(
2672  objc_debug_taggedpointer_payload_rshift),
2673  m_objc_debug_taggedpointer_classes(objc_debug_taggedpointer_classes) {}
2674 
2677  return (ptr & m_objc_debug_taggedpointer_mask) != 0;
2678 }
2679 
2682  lldb::addr_t ptr) {
2683  ClassDescriptorSP actual_class_descriptor_sp;
2684  uint64_t unobfuscated = (ptr) ^ m_runtime.GetTaggedPointerObfuscator();
2685 
2686  if (!IsPossibleTaggedPointer(unobfuscated))
2688 
2689  uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_slot_shift) &
2690  m_objc_debug_taggedpointer_slot_mask;
2691 
2692  CacheIterator iterator = m_cache.find(slot), end = m_cache.end();
2693  if (iterator != end) {
2694  actual_class_descriptor_sp = iterator->second;
2695  } else {
2696  Process *process(m_runtime.GetProcess());
2697  uintptr_t slot_ptr = slot * process->GetAddressByteSize() +
2698  m_objc_debug_taggedpointer_classes;
2699  Status error;
2700  uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error);
2701  if (error.Fail() || slot_data == 0 ||
2702  slot_data == uintptr_t(LLDB_INVALID_ADDRESS))
2703  return nullptr;
2704  actual_class_descriptor_sp =
2705  m_runtime.GetClassDescriptorFromISA((ObjCISA)slot_data);
2706  if (!actual_class_descriptor_sp)
2708  m_cache[slot] = actual_class_descriptor_sp;
2709  }
2710 
2711  uint64_t data_payload =
2712  (((uint64_t)unobfuscated << m_objc_debug_taggedpointer_payload_lshift) >>
2713  m_objc_debug_taggedpointer_payload_rshift);
2714  int64_t data_payload_signed =
2715  ((int64_t)((int64_t)unobfuscated
2716  << m_objc_debug_taggedpointer_payload_lshift) >>
2717  m_objc_debug_taggedpointer_payload_rshift);
2719  actual_class_descriptor_sp, data_payload, data_payload_signed));
2720 }
2721 
2723  AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask,
2724  uint64_t objc_debug_taggedpointer_ext_mask,
2725  uint32_t objc_debug_taggedpointer_slot_shift,
2726  uint32_t objc_debug_taggedpointer_ext_slot_shift,
2727  uint32_t objc_debug_taggedpointer_slot_mask,
2728  uint32_t objc_debug_taggedpointer_ext_slot_mask,
2729  uint32_t objc_debug_taggedpointer_payload_lshift,
2730  uint32_t objc_debug_taggedpointer_payload_rshift,
2731  uint32_t objc_debug_taggedpointer_ext_payload_lshift,
2732  uint32_t objc_debug_taggedpointer_ext_payload_rshift,
2733  lldb::addr_t objc_debug_taggedpointer_classes,
2734  lldb::addr_t objc_debug_taggedpointer_ext_classes)
2736  runtime, objc_debug_taggedpointer_mask,
2737  objc_debug_taggedpointer_slot_shift,
2738  objc_debug_taggedpointer_slot_mask,
2739  objc_debug_taggedpointer_payload_lshift,
2740  objc_debug_taggedpointer_payload_rshift,
2741  objc_debug_taggedpointer_classes),
2742  m_ext_cache(),
2743  m_objc_debug_taggedpointer_ext_mask(objc_debug_taggedpointer_ext_mask),
2744  m_objc_debug_taggedpointer_ext_slot_shift(
2745  objc_debug_taggedpointer_ext_slot_shift),
2746  m_objc_debug_taggedpointer_ext_slot_mask(
2747  objc_debug_taggedpointer_ext_slot_mask),
2748  m_objc_debug_taggedpointer_ext_payload_lshift(
2749  objc_debug_taggedpointer_ext_payload_lshift),
2750  m_objc_debug_taggedpointer_ext_payload_rshift(
2751  objc_debug_taggedpointer_ext_payload_rshift),
2752  m_objc_debug_taggedpointer_ext_classes(
2753  objc_debug_taggedpointer_ext_classes) {}
2754 
2757  if (!IsPossibleTaggedPointer(ptr))
2758  return false;
2759 
2760  if (m_objc_debug_taggedpointer_ext_mask == 0)
2761  return false;
2762 
2763  return ((ptr & m_objc_debug_taggedpointer_ext_mask) ==
2764  m_objc_debug_taggedpointer_ext_mask);
2765 }
2766 
2769  lldb::addr_t ptr) {
2770  ClassDescriptorSP actual_class_descriptor_sp;
2771  uint64_t unobfuscated = (ptr) ^ m_runtime.GetTaggedPointerObfuscator();
2772 
2773  if (!IsPossibleTaggedPointer(unobfuscated))
2775 
2776  if (!IsPossibleExtendedTaggedPointer(unobfuscated))
2778 
2779  uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_ext_slot_shift) &
2780  m_objc_debug_taggedpointer_ext_slot_mask;
2781 
2782  CacheIterator iterator = m_ext_cache.find(slot), end = m_ext_cache.end();
2783  if (iterator != end) {
2784  actual_class_descriptor_sp = iterator->second;
2785  } else {
2786  Process *process(m_runtime.GetProcess());
2787  uintptr_t slot_ptr = slot * process->GetAddressByteSize() +
2788  m_objc_debug_taggedpointer_ext_classes;
2789  Status error;
2790  uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error);
2791  if (error.Fail() || slot_data == 0 ||
2792  slot_data == uintptr_t(LLDB_INVALID_ADDRESS))
2793  return nullptr;
2794  actual_class_descriptor_sp =
2795  m_runtime.GetClassDescriptorFromISA((ObjCISA)slot_data);
2796  if (!actual_class_descriptor_sp)
2798  m_ext_cache[slot] = actual_class_descriptor_sp;
2799  }
2800 
2801  uint64_t data_payload = (((uint64_t)unobfuscated
2802  << m_objc_debug_taggedpointer_ext_payload_lshift) >>
2803  m_objc_debug_taggedpointer_ext_payload_rshift);
2804  int64_t data_payload_signed =
2805  ((int64_t)((int64_t)unobfuscated
2806  << m_objc_debug_taggedpointer_ext_payload_lshift) >>
2807  m_objc_debug_taggedpointer_ext_payload_rshift);
2808 
2810  actual_class_descriptor_sp, data_payload, data_payload_signed));
2811 }
2812 
2814  AppleObjCRuntimeV2 &runtime, const ModuleSP &objc_module_sp,
2815  uint64_t objc_debug_isa_class_mask, uint64_t objc_debug_isa_magic_mask,
2816  uint64_t objc_debug_isa_magic_value,
2817  uint64_t objc_debug_indexed_isa_magic_mask,
2818  uint64_t objc_debug_indexed_isa_magic_value,
2819  uint64_t objc_debug_indexed_isa_index_mask,
2820  uint64_t objc_debug_indexed_isa_index_shift,
2821  lldb::addr_t objc_indexed_classes)
2822  : m_runtime(runtime), m_cache(), m_objc_module_wp(objc_module_sp),
2823  m_objc_debug_isa_class_mask(objc_debug_isa_class_mask),
2824  m_objc_debug_isa_magic_mask(objc_debug_isa_magic_mask),
2825  m_objc_debug_isa_magic_value(objc_debug_isa_magic_value),
2826  m_objc_debug_indexed_isa_magic_mask(objc_debug_indexed_isa_magic_mask),
2827  m_objc_debug_indexed_isa_magic_value(objc_debug_indexed_isa_magic_value),
2828  m_objc_debug_indexed_isa_index_mask(objc_debug_indexed_isa_index_mask),
2829  m_objc_debug_indexed_isa_index_shift(objc_debug_indexed_isa_index_shift),
2830  m_objc_indexed_classes(objc_indexed_classes), m_indexed_isa_cache() {}
2831 
2834  ObjCISA real_isa = 0;
2835  if (!EvaluateNonPointerISA(isa, real_isa))
2837  auto cache_iter = m_cache.find(real_isa);
2838  if (cache_iter != m_cache.end())
2839  return cache_iter->second;
2840  auto descriptor_sp =
2841  m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(real_isa);
2842  if (descriptor_sp) // cache only positive matches since the table might grow
2843  m_cache[real_isa] = descriptor_sp;
2844  return descriptor_sp;
2845 }
2846 
2848  ObjCISA isa, ObjCISA &ret_isa) {
2850 
2851  LLDB_LOGF(log, "AOCRT::NPI Evaluate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
2852 
2853  if ((isa & ~m_objc_debug_isa_class_mask) == 0)
2854  return false;
2855 
2856  // If all of the indexed ISA variables are set, then its possible that this
2857  // ISA is indexed, and we should first try to get its value using the index.
2858  // Note, we check these variables first as the ObjC runtime will set at least
2859  // one of their values to 0 if they aren't needed.
2860  if (m_objc_debug_indexed_isa_magic_mask &&
2861  m_objc_debug_indexed_isa_magic_value &&
2862  m_objc_debug_indexed_isa_index_mask &&
2863  m_objc_debug_indexed_isa_index_shift && m_objc_indexed_classes) {
2864  if ((isa & ~m_objc_debug_indexed_isa_index_mask) == 0)
2865  return false;
2866 
2867  if ((isa & m_objc_debug_indexed_isa_magic_mask) ==
2868  m_objc_debug_indexed_isa_magic_value) {
2869  // Magic bits are correct, so try extract the index.
2870  uintptr_t index = (isa & m_objc_debug_indexed_isa_index_mask) >>
2871  m_objc_debug_indexed_isa_index_shift;
2872  // If the index is out of bounds of the length of the array then check if
2873  // the array has been updated. If that is the case then we should try
2874  // read the count again, and update the cache if the count has been
2875  // updated.
2876  if (index > m_indexed_isa_cache.size()) {
2877  LLDB_LOGF(log,
2878  "AOCRT::NPI (index = %" PRIu64
2879  ") exceeds cache (size = %" PRIu64 ")",
2880  (uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
2881 
2882  Process *process(m_runtime.GetProcess());
2883 
2884  ModuleSP objc_module_sp(m_objc_module_wp.lock());
2885  if (!objc_module_sp)
2886  return false;
2887 
2888  Status error;
2889  auto objc_indexed_classes_count = ExtractRuntimeGlobalSymbol(
2890  process, ConstString("objc_indexed_classes_count"), objc_module_sp,
2891  error);
2892  if (error.Fail())
2893  return false;
2894 
2895  LLDB_LOGF(log, "AOCRT::NPI (new class count = %" PRIu64 ")",
2896  (uint64_t)objc_indexed_classes_count);
2897 
2898  if (objc_indexed_classes_count > m_indexed_isa_cache.size()) {
2899  // Read the class entries we don't have. We should just read all of
2900  // them instead of just the one we need as then we can cache those we
2901  // may need later.
2902  auto num_new_classes =
2903  objc_indexed_classes_count - m_indexed_isa_cache.size();
2904  const uint32_t addr_size = process->GetAddressByteSize();
2905  DataBufferHeap buffer(num_new_classes * addr_size, 0);
2906 
2907  lldb::addr_t last_read_class =
2908  m_objc_indexed_classes + (m_indexed_isa_cache.size() * addr_size);
2909  size_t bytes_read = process->ReadMemory(
2910  last_read_class, buffer.GetBytes(), buffer.GetByteSize(), error);
2911  if (error.Fail() || bytes_read != buffer.GetByteSize())
2912  return false;
2913 
2914  LLDB_LOGF(log, "AOCRT::NPI (read new classes count = %" PRIu64 ")",
2915  (uint64_t)num_new_classes);
2916 
2917  // Append the new entries to the existing cache.
2918  DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(),
2919  process->GetByteOrder(),
2920  process->GetAddressByteSize());
2921 
2922  lldb::offset_t offset = 0;
2923  for (unsigned i = 0; i != num_new_classes; ++i)
2924  m_indexed_isa_cache.push_back(data.GetAddress(&offset));
2925  }
2926  }
2927 
2928  // If the index is still out of range then this isn't a pointer.
2929  if (index > m_indexed_isa_cache.size())
2930  return false;
2931 
2932  LLDB_LOGF(log, "AOCRT::NPI Evaluate(ret_isa = 0x%" PRIx64 ")",
2933  (uint64_t)m_indexed_isa_cache[index]);
2934 
2935  ret_isa = m_indexed_isa_cache[index];
2936  return (ret_isa != 0); // this is a pointer so 0 is not a valid value
2937  }
2938 
2939  return false;
2940  }
2941 
2942  // Definitely not an indexed ISA, so try to use a mask to extract the pointer
2943  // from the ISA.
2944  if ((isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value) {
2945  ret_isa = isa & m_objc_debug_isa_class_mask;
2946  return (ret_isa != 0); // this is a pointer so 0 is not a valid value
2947  }
2948  return false;
2949 }
2950 
2952  if (!m_encoding_to_type_sp)
2954  std::make_shared<AppleObjCTypeEncodingParser>(*this);
2955  return m_encoding_to_type_sp;
2956 }
2957 
2960  ObjCISA ret = isa;
2961 
2962  if (auto *non_pointer_isa_cache = GetNonPointerIsaCache())
2963  non_pointer_isa_cache->EvaluateNonPointerISA(isa, ret);
2964 
2965  return ret;
2966 }
2967 
2969  if (m_CFBoolean_values)
2970  return true;
2971 
2972  static ConstString g___kCFBooleanFalse("__kCFBooleanFalse");
2973  static ConstString g___kCFBooleanTrue("__kCFBooleanTrue");
2974  static ConstString g_kCFBooleanFalse("kCFBooleanFalse");
2975  static ConstString g_kCFBooleanTrue("kCFBooleanTrue");
2976 
2977  std::function<lldb::addr_t(ConstString, ConstString)> get_symbol =
2978  [this](ConstString sym, ConstString real_sym) -> lldb::addr_t {
2979  SymbolContextList sc_list;
2981  sym, lldb::eSymbolTypeData, sc_list);
2982  if (sc_list.GetSize() == 1) {
2983  SymbolContext sc;
2984  sc_list.GetContextAtIndex(0, sc);
2985  if (sc.symbol)
2986  return sc.symbol->GetLoadAddress(&GetProcess()->GetTarget());
2987  }
2989  real_sym, lldb::eSymbolTypeData, sc_list);
2990  if (sc_list.GetSize() != 1)
2991  return LLDB_INVALID_ADDRESS;
2992 
2993  SymbolContext sc;
2994  sc_list.GetContextAtIndex(0, sc);
2995  if (!sc.symbol)
2996  return LLDB_INVALID_ADDRESS;
2997 
2998  lldb::addr_t addr = sc.symbol->GetLoadAddress(&GetProcess()->GetTarget());
2999  Status error;
3000  addr = GetProcess()->ReadPointerFromMemory(addr, error);
3001  if (error.Fail())
3002  return LLDB_INVALID_ADDRESS;
3003  return addr;
3004  };
3005 
3006  lldb::addr_t false_addr = get_symbol(g___kCFBooleanFalse, g_kCFBooleanFalse);
3007  lldb::addr_t true_addr = get_symbol(g___kCFBooleanTrue, g_kCFBooleanTrue);
3008 
3009  return (m_CFBoolean_values = {false_addr, true_addr}).operator bool();
3010 }
3011 
3013  lldb::addr_t &cf_false) {
3015  cf_true = m_CFBoolean_values->second;
3016  cf_false = m_CFBoolean_values->first;
3017  } else
3018  this->AppleObjCRuntime::GetValuesForGlobalCFBooleans(cf_true, cf_false);
3019 }
3020 
3021 #pragma mark Frame recognizers
3022 
3024 public:
3025  ObjCExceptionRecognizedStackFrame(StackFrameSP frame_sp) {
3026  ThreadSP thread_sp = frame_sp->GetThread();
3027  ProcessSP process_sp = thread_sp->GetProcess();
3028 
3029  const lldb::ABISP &abi = process_sp->GetABI();
3030  if (!abi)
3031  return;
3032 
3033  TypeSystemClang *clang_ast_context =
3034  ScratchTypeSystemClang::GetForTarget(process_sp->GetTarget());
3035  if (!clang_ast_context)
3036  return;
3037  CompilerType voidstar =
3038  clang_ast_context->GetBasicType(lldb::eBasicTypeVoid).GetPointerType();
3039 
3040  ValueList args;
3041  Value input_value;
3042  input_value.SetCompilerType(voidstar);
3043  args.PushValue(input_value);
3044 
3045  if (!abi->GetArgumentValues(*thread_sp, args))
3046  return;
3047 
3048  addr_t exception_addr = args.GetValueAtIndex(0)->GetScalar().ULongLong();
3049 
3050  Value value(exception_addr);
3051  value.SetCompilerType(voidstar);
3052  exception = ValueObjectConstResult::Create(frame_sp.get(), value,
3053  ConstString("exception"));
3055  *exception, eValueTypeVariableArgument);
3056  exception = exception->GetDynamicValue(eDynamicDontRunTarget);
3057 
3058  m_arguments = ValueObjectListSP(new ValueObjectList());
3059  m_arguments->Append(exception);
3060 
3061  m_stop_desc = "hit Objective-C exception";
3062  }
3063 
3064  ValueObjectSP exception;
3065 
3066  lldb::ValueObjectSP GetExceptionObject() override { return exception; }
3067 };
3068 
3070  lldb::RecognizedStackFrameSP
3071  RecognizeFrame(lldb::StackFrameSP frame) override {
3072  return lldb::RecognizedStackFrameSP(
3074  };
3075  std::string GetName() override {
3076  return "ObjC Exception Throw StackFrame Recognizer";
3077  }
3078 };
3079 
3081  FileSpec module;
3082  ConstString function;
3083  std::tie(module, function) = AppleObjCRuntime::GetExceptionThrowLocation();
3084  std::vector<ConstString> symbols = {function};
3085 
3087  StackFrameRecognizerSP(new ObjCExceptionThrowFrameRecognizer()),
3088  module.GetFilename(), symbols,
3089  /*first_instruction_only*/ true);
3090 }
lldb_private::StackFrameRecognizer
Definition: StackFrameRecognizer.h:55
RemoteNXMapTable::const_iterator::operator=
const_iterator & operator=(const const_iterator &rhs)
Definition: AppleObjCRuntimeV2.cpp:1274
RemoteNXMapTable::const_iterator::const_iterator
const_iterator(const const_iterator &rhs)
Definition: AppleObjCRuntimeV2.cpp:1269
lldb_private::Scalar::ULong
unsigned long ULong(unsigned long fail_value=0) const
Definition: Scalar.cpp:326
lldb_private::eArgRepeatOptional
@ eArgRepeatOptional
Definition: lldb-private-enumerations.h:96
lldb_private::UtilityFunction::GetFunctionCaller
FunctionCaller * GetFunctionCaller()
Definition: UtilityFunction.h:111
lldb_private::Target::GetFrameRecognizerManager
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition: Target.h:1369
lldb_private::CommandObjectParsed
Definition: CommandObject.h:378
lldb_private::ValueObjectList
A collection of ValueObject values that.
Definition: ValueObjectList.h:23
CommandObjectObjC_ClassTable_Dump::m_options
CommandOptions m_options
Definition: AppleObjCRuntimeV2.cpp:914
lldb_private::Value::ValueType::Scalar
@ Scalar
A raw scalar value.
lldb_private::TypeAndOrName::IsEmpty
bool IsEmpty() const
Definition: Type.cpp:792
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::AppleObjCRuntimeV2::GetClassDescriptorFromISA
ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa) override
Definition: AppleObjCRuntimeV2.cpp:1413
CommandObjectObjC_ClassTable_Dump::CommandOptions::OptionParsingStarting
void OptionParsingStarting(ExecutionContext *execution_context) override
Definition: AppleObjCRuntimeV2.cpp:787
lldb::eSymbolTypeObjCIVar
@ eSymbolTypeObjCIVar
Definition: lldb-enumerations.h:642
lldb_private::AppleObjCRuntimeV2::HashTableSignature::m_buckets_ptr
lldb::addr_t m_buckets_ptr
Definition: AppleObjCRuntimeV2.h:128
lldb_private::DataBufferHeap::GetBytes
uint8_t * GetBytes() override
Definition: DataBufferHeap.cpp:34
lldb_private::DataBufferHeap::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferHeap.cpp:45
lldb_private::SectionList::FindSectionByName
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
Definition: Section.cpp:484
lldb_private::AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache
NonPointerISACache(AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp, uint64_t objc_debug_isa_class_mask, uint64_t objc_debug_isa_magic_mask, uint64_t objc_debug_isa_magic_value, uint64_t objc_debug_indexed_isa_magic_mask, uint64_t objc_debug_indexed_isa_magic_value, uint64_t objc_debug_indexed_isa_index_mask, uint64_t objc_debug_indexed_isa_index_shift, lldb::addr_t objc_indexed_classes)
ObjCExceptionRecognizedStackFrame
Definition: AppleObjCRuntimeV2.cpp:3023
lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::GetClassInfoUtilityFunctionImpl
std::unique_ptr< UtilityFunction > GetClassInfoUtilityFunctionImpl(ExecutionContext &exe_ctx)
Definition: AppleObjCRuntimeV2.cpp:1634
lldb_private::AppleObjCRuntimeV2::GetTaggedPointerObfuscator
lldb::addr_t GetTaggedPointerObfuscator()
Definition: AppleObjCRuntimeV2.cpp:1467
Scalar.h
lldb_private::StructuredData::Dictionary
Definition: StructuredData.h:352
lldb_private::ExecutionContext::GetThreadSP
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
Definition: ExecutionContext.h:464
lldb::eArgTypeAddress
@ eArgTypeAddress
Definition: lldb-enumerations.h:516
lldb_private::Process::AllocateMemory
lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error)
The public interface to allocating memory in the process.
Definition: Process.cpp:2297
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor
Definition: ObjCLanguageRuntime.h:184
lldb_private::Process::DeallocateMemory
Status DeallocateMemory(lldb::addr_t ptr)
The public interface to deallocating memory in the process.
Definition: Process.cpp:2368
lldb_private::DataExtractor::GetAddress
uint64_t GetAddress(lldb::offset_t *offset_ptr) const
Extract an address from *offset_ptr.
Definition: DataExtractor.cpp:651
UNUSED_IF_ASSERT_DISABLED
#define UNUSED_IF_ASSERT_DISABLED(x)
Definition: lldb-defines.h:137
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoUtilityFunctionImpl
std::unique_ptr< UtilityFunction > GetClassInfoUtilityFunctionImpl(ExecutionContext &exe_ctx, std::string code, std::string name)
Definition: AppleObjCRuntimeV2.cpp:1528
lldb_private::Log::GetVerbose
bool GetVerbose() const
Definition: Log.cpp:276
lldb_private::ObjCLanguageRuntime::GetNonKVOClassDescriptor
ClassDescriptorSP GetNonKVOClassDescriptor(ValueObject &in_value)
Definition: ObjCLanguageRuntime.cpp:258
lldb::eSymbolTypeCode
@ eSymbolTypeCode
Definition: lldb-enumerations.h:616
lldb_private::Process::ReadMemory
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:1914
lldb_private::AppleObjCRuntimeV2::GetPointerISA
ObjCISA GetPointerISA(ObjCISA isa)
Definition: AppleObjCRuntimeV2.cpp:2959
FunctionCaller.h
lldb_private::EvaluateExpressionOptions::SetTimeout
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:330
lldb_private::AppleObjCRuntimeV2::GetClassDescriptor
ClassDescriptorSP GetClassDescriptor(ValueObject &in_value) override
Definition: AppleObjCRuntimeV2.cpp:1423
CommandObjectMultiwordObjC::CommandObjectMultiwordObjC
CommandObjectMultiwordObjC(CommandInterpreter &interpreter)
Definition: AppleObjCRuntimeV2.cpp:1033
lldb_private::AppleObjCRuntimeV2::SharedCacheWarningReason
SharedCacheWarningReason
Definition: AppleObjCRuntimeV2.h:396
lldb_private::AppleObjCRuntimeV2::HashTableSignature::m_num_buckets
uint32_t m_num_buckets
Definition: AppleObjCRuntimeV2.h:127
lldb_private::AppleObjCRuntimeV2::DescriptorMapUpdateResult
Definition: AppleObjCRuntimeV2.h:287
lldb_private::ObjCLanguageRuntime::GetTaggedPointerVendor
virtual TaggedPointerVendor * GetTaggedPointerVendor()
Definition: ObjCLanguageRuntime.h:218
lldb_private::ObjCLanguageRuntime
Definition: ObjCLanguageRuntime.h:34
lldb_private::StructuredData::Dictionary::GetValueForKey
ObjectSP GetValueForKey(llvm::StringRef key) const
Definition: StructuredData.h:379
lldb_private::TypeAndOrName::SetName
void SetName(ConstString type_name)
Definition: Type.cpp:770
CommandObjectMultiwordObjC_TaggedPointer_Info
Definition: AppleObjCRuntimeV2.cpp:917
RemoteNXMapTable::begin
const_iterator begin()
Definition: AppleObjCRuntimeV2.cpp:1358
lldb_private::Value
Definition: Value.h:38
lldb_private::ObjCLanguageRuntime::ClassDescriptorSP
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
Definition: ObjCLanguageRuntime.h:44
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::Value::SetValueType
void SetValueType(ValueType value_type)
Definition: Value.h:89
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap
DescriptorMapUpdateResult UpdateISAToDescriptorMap(RemoteNXMapTable &hash_table)
Definition: AppleObjCRuntimeV2.cpp:1730
lldb_private::Symbol::ValueIsAddress
bool ValueIsAddress() const
Definition: Symbol.cpp:117
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:208
lldb_private::DiagnosticManager::Dump
void Dump(Log *log)
Definition: DiagnosticManager.cpp:18
CommandObjectMultiwordObjC_TaggedPointer_Info::DoExecute
bool DoExecute(Args &command, CommandReturnObject &result) override
Definition: AppleObjCRuntimeV2.cpp:944
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::CacheIterator
Cache::iterator CacheIterator
Definition: AppleObjCRuntimeV2.h:212
lldb_private::AppleObjCRuntimeV2::GetValuesForGlobalCFBooleans
void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false) override
Definition: AppleObjCRuntimeV2.cpp:3012
ObjCExceptionThrowFrameRecognizer
Definition: AppleObjCRuntimeV2.cpp:3069
lldb::ExpressionResults
ExpressionResults
The results of expression evaluation.
Definition: lldb-enumerations.h:270
lldb_private::OptionParser::eNoArgument
@ eNoArgument
Definition: OptionParser.h:35
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorLegacy::GetClassDescriptor
ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(lldb::addr_t ptr) override
Definition: AppleObjCRuntimeV2.cpp:2594
lldb_private::AppleObjCRuntimeV2::NonPointerISACache::CreateInstance
static NonPointerISACache * CreateInstance(AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp)
Definition: AppleObjCRuntimeV2.cpp:2413
lldb_private::OptionValueBoolean
Definition: OptionValueBoolean.h:16
lldb_private::AppleObjCRuntimeV2::m_tagged_pointer_obfuscator
lldb::addr_t m_tagged_pointer_obfuscator
Definition: AppleObjCRuntimeV2.h:425
lldb_private::TypeAndOrName::SetCompilerType
void SetCompilerType(CompilerType compiler_type)
Definition: Type.cpp:786
lldb_private::ValueObjectRecognizerSynthesizedValue::Create
static lldb::ValueObjectSP Create(ValueObject &parent, lldb::ValueType type)
Definition: StackFrameRecognizer.h:148
lldb_private::AppleObjCRuntimeV2::GetSharedCacheReadOnlyAddress
lldb::addr_t GetSharedCacheReadOnlyAddress()
Definition: AppleObjCRuntimeV2.cpp:2147
lldb_private::ObjCLanguageRuntime::GetClassDescriptorFromClassName
virtual ClassDescriptorSP GetClassDescriptorFromClassName(ConstString class_name)
Definition: ObjCLanguageRuntime.cpp:226
lldb_private::ObjCLanguageRuntime::Get
static ObjCLanguageRuntime * Get(Process &process)
Definition: ObjCLanguageRuntime.h:213
lldb_private::ValueList::GetValueAtIndex
Value * GetValueAtIndex(size_t idx)
Definition: Value.cpp:679
RemoteNXMapTable::element
std::pair< ConstString, ObjCLanguageRuntime::ObjCISA > element
Definition: AppleObjCRuntimeV2.cpp:1259
RemoteNXMapTable::const_iterator
Definition: AppleObjCRuntimeV2.cpp:1262
lldb_private::AppleObjCRuntimeV2::m_objc_module_sp
lldb::ModuleSP m_objc_module_sp
Definition: AppleObjCRuntimeV2.h:419
RemoteNXMapTable::const_iterator::operator==
bool operator==(const const_iterator &rhs) const
Definition: AppleObjCRuntimeV2.cpp:1281
lldb_private::ObjCLanguageRuntime::GetClassDescriptorFromISA
virtual ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa)
Definition: ObjCLanguageRuntime.cpp:273
lldb_private::ProcessProperties::GetUtilityExpressionTimeout
std::chrono::seconds GetUtilityExpressionTimeout() const
Definition: Process.cpp:307
lldb_private::AppleObjCRuntimeV2::IsTaggedPointer
bool IsTaggedPointer(lldb::addr_t ptr) override
Definition: AppleObjCRuntimeV2.cpp:1192
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
lldb_private::ClassDescriptorV2Tagged
Definition: AppleObjCClassDescriptorV2.h:245
lldb_private::Process
Definition: Process.h:342
lldb_private::ObjCLanguageRuntime::EncodingToTypeSP
std::shared_ptr< EncodingToType > EncodingToTypeSP
Definition: ObjCLanguageRuntime.h:220
CommandObjectObjC_ClassTable_Dump::GetOptions
Options * GetOptions() override
Definition: AppleObjCRuntimeV2.cpp:824
CommandObjectObjC_ClassTable_Dump::DoExecute
bool DoExecute(Args &command, CommandReturnObject &result) override
Definition: AppleObjCRuntimeV2.cpp:827
lldb_private::TypeSystemClang::GetBuiltinTypeForEncodingAndBitSize
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
Definition: TypeSystemClang.cpp:803
lldb_private::AppleObjCRuntimeV2::DescriptorMapUpdateResult::Success
static DescriptorMapUpdateResult Success(uint32_t found)
Definition: AppleObjCRuntimeV2.h:298
lldb_private::EvaluateExpressionOptions::SetIsForUtilityExpr
void SetIsForUtilityExpr(bool b)
Definition: Target.h:417
Module.h
lldb_private::Process::GetThreadList
ThreadList & GetThreadList()
Definition: Process.h:2116
lldb_private::CommandObject::CommandArgumentData
Definition: CommandObject.h:89
lldb_private::AppleObjCRuntimeV2::HashTableSignature::UpdateSignature
void UpdateSignature(const RemoteNXMapTable &hash_table)
Definition: AppleObjCRuntimeV2.cpp:1386
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1214
lldb_private::AppleObjCRuntimeV2
Definition: AppleObjCRuntimeV2.h:25
lldb_private::EvaluateExpressionOptions
Definition: Target.h:262
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::gdb_objc_realized_classes
@ gdb_objc_realized_classes
Definition: AppleObjCRuntimeV2.h:332
lldb_private::ValueObject::GetPointerValue
lldb::addr_t GetPointerValue(AddressType *address_type=nullptr)
Definition: ValueObject.cpp:1433
RemoteNXMapTable::Dump
void Dump()
Definition: AppleObjCRuntimeV2.cpp:1202
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::ObjCLanguageRuntime::GetBreakpointExceptionPrecondition
static lldb::BreakpointPreconditionSP GetBreakpointExceptionPrecondition(lldb::LanguageType language, bool throw_bp)
Definition: ObjCLanguageRuntime.cpp:349
lldb::eSymbolTypeData
@ eSymbolTypeData
Definition: lldb-enumerations.h:618
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::AppleObjCRuntimeV2::m_isa_hash_table_ptr
lldb::addr_t m_isa_hash_table_ptr
Definition: AppleObjCRuntimeV2.h:426
lldb_private::SymbolContextList::GetContextAtIndex
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Definition: SymbolContext.cpp:1265
OptionArgParser.h
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:193
lldb_private::SectionList
Definition: Section.h:34
lldb_private::AppleObjCRuntimeV2::CreateInstance
static lldb_private::LanguageRuntime * CreateInstance(Process *process, lldb::LanguageType language)
Definition: AppleObjCRuntimeV2.cpp:732
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::ValueList
Definition: Value.h:157
CommandObjectMultiwordObjC_TaggedPointer
Definition: AppleObjCRuntimeV2.cpp:1015
lldb_private::CommandObject::CommandArgumentData::arg_repetition
ArgumentRepetitionType arg_repetition
Definition: CommandObject.h:92
RemoteNXMapTable
Definition: AppleObjCRuntimeV2.cpp:1198
g_get_shared_cache_class_info_body
static const char * g_get_shared_cache_class_info_body
Definition: AppleObjCRuntimeV2.cpp:249
lldb_private::Args
Definition: Args.h:33
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoUtilityFunction
UtilityFunction * GetClassInfoUtilityFunction(ExecutionContext &exe_ctx, Helper helper)
Definition: AppleObjCRuntimeV2.cpp:1583
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2
@ eAppleObjC_V2
lldb_private::AppleObjCRuntimeV2::m_shared_cache_class_info_extractor
SharedCacheClassInfoExtractor m_shared_cache_class_info_extractor
Definition: AppleObjCRuntimeV2.h:422
lldb_private::TypeAndOrName::Clear
void Clear()
Definition: Type.cpp:796
lldb_private::eArgRepeatPlus
@ eArgRepeatPlus
Definition: lldb-private-enumerations.h:97
CommandReturnObject.h
Debugger.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:454
Section.h
lldb_private::DataExtractor::GetU64
uint64_t GetU64(lldb::offset_t *offset_ptr) const
Extract a uint64_t value from *offset_ptr.
Definition: DataExtractor.cpp:476
lldb_private::AppleObjCRuntimeV2::Terminate
static void Terminate()
Definition: AppleObjCRuntimeV2.cpp:1059
ABI.h
lldb_private::AppleObjCRuntimeV2::m_CFBoolean_values
llvm::Optional< std::pair< lldb::addr_t, lldb::addr_t > > m_CFBoolean_values
Definition: AppleObjCRuntimeV2.h:436
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:928
lldb_private::AppleObjCRuntimeV2::LookupRuntimeSymbol
lldb::addr_t LookupRuntimeSymbol(ConstString name) override
Definition: AppleObjCRuntimeV2.cpp:2353
RemoteNXMapTable::GetCount
uint32_t GetCount() const
Definition: AppleObjCRuntimeV2.cpp:1364
RemoteNXMapTable::const_iterator::operator*
const element operator*() const
Definition: AppleObjCRuntimeV2.cpp:1299
Process.h
RemoteNXMapTable::const_iterator::m_parent
RemoteNXMapTable & m_parent
Definition: AppleObjCRuntimeV2.cpp:1354
lldb_private::PluginManager::RegisterPlugin
static bool RegisterPlugin(ConstString name, const char *description, ABICreateInstance create_callback)
Definition: PluginManager.cpp:288
lldb_private::Value::SetCompilerType
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:254
lldb_private::AppleObjCRuntimeV2::m_has_object_getClass
bool m_has_object_getClass
Definition: AppleObjCRuntimeV2.h:429
lldb_private::AppleObjCRuntime::m_objc_module_wp
lldb::ModuleWP m_objc_module_wp
Definition: AppleObjCRuntime.h:127
AppleObjCDeclVendor.h
lldb_private::ModuleList::FindSymbolsWithNameAndType
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:462
lldb_private::AppleObjCRuntimeV2::NonPointerISACache
Definition: AppleObjCRuntimeV2.h:131
Target.h
lldb_private::AppleObjCRuntimeV2::SharedCacheWarningReason::eNotEnoughClassesRead
@ eNotEnoughClassesRead
lldb_private::ValueObject::GetProcessSP
lldb::ProcessSP GetProcessSP() const
Definition: ValueObject.h:338
lldb_private::Value::GetScalar
const Scalar & GetScalar() const
Definition: Value.h:112
lldb_private::Target::GetPlatform
lldb::PlatformSP GetPlatform()
Definition: Target.h:1345
ObjCExceptionThrowFrameRecognizer::RecognizeFrame
lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame) override
Definition: AppleObjCRuntimeV2.cpp:3071
lldb_private::operator==
bool operator==(const Address &lhs, const Address &rhs)
Definition: Address.cpp:999
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::CommandObjectMultiword
Definition: CommandObjectMultiword.h:19
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ObjCLanguageRuntime::LookupInCompleteClassCache
lldb::TypeSP LookupInCompleteClassCache(ConstString &name)
Definition: ObjCLanguageRuntime.cpp:86
lldb::eSymbolTypeAny
@ eSymbolTypeAny
Definition: lldb-enumerations.h:613
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
lldb_private::Status::Success
bool Success() const
Test for success condition.
Definition: Status.cpp:288
ObjCExceptionRecognizedStackFrame::GetExceptionObject
lldb::ValueObjectSP GetExceptionObject() override
Definition: AppleObjCRuntimeV2.cpp:3066
lldb_private::ValueList::PushValue
void PushValue(const Value &value)
Definition: Value.cpp:675
lldb_private::AppleObjCRuntimeV2::m_encoding_to_type_sp
EncodingToTypeSP m_encoding_to_type_sp
Definition: AppleObjCRuntimeV2.h:434
lldb_private::AppleObjCRuntimeV2::ClassDescriptorV2
friend class ClassDescriptorV2
Definition: AppleObjCRuntimeV2.h:417
lldb::eDynamicDontRunTarget
@ eDynamicDontRunTarget
Definition: lldb-enumerations.h:497
lldb_private::Options
Definition: Options.h:57
ID
static char ID
Definition: IRDynamicChecks.cpp:32
ObjCExceptionThrowFrameRecognizer::GetName
std::string GetName() override
Definition: AppleObjCRuntimeV2.cpp:3075
lldb_private::PluginManager::UnregisterPlugin
static bool UnregisterPlugin(ABICreateInstance create_callback)
Definition: PluginManager.cpp:293
lldb_private::FunctionCaller::WriteFunctionArguments
bool WriteFunctionArguments(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, DiagnosticManager &diagnostic_manager)
Insert the default function argument struct.
Definition: FunctionCaller.cpp:115
lldb_private::AppleObjCRuntimeV2::m_has_objc_copyRealizedClassList
bool m_has_objc_copyRealizedClassList
Definition: AppleObjCRuntimeV2.h:430
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ConstString::GetStringRef
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:202
lldb_private::Scalar::ULongLong
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:334
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::TaggedPointerVendorRuntimeAssisted
TaggedPointerVendorRuntimeAssisted(AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask, uint32_t objc_debug_taggedpointer_slot_shift, uint32_t objc_debug_taggedpointer_slot_mask, uint32_t objc_debug_taggedpointer_payload_lshift, uint32_t objc_debug_taggedpointer_payload_rshift, lldb::addr_t objc_debug_taggedpointer_classes)
Definition: AppleObjCRuntimeV2.cpp:2657
Log.h
lldb_private::AppleObjCRuntimeV2::m_loaded_objc_opt
bool m_loaded_objc_opt
Definition: AppleObjCRuntimeV2.h:431
lldb_private::AppleObjCRuntimeV2::GetISAHashTablePointer
lldb::addr_t GetISAHashTablePointer()
Definition: AppleObjCRuntimeV2.cpp:1500
lldb_private::AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA
bool EvaluateNonPointerISA(ObjCISA isa, ObjCISA &ret_isa)
Definition: AppleObjCRuntimeV2.cpp:2847
RemoteNXMapTable::const_iterator::operator!=
bool operator!=(const const_iterator &rhs) const
Definition: AppleObjCRuntimeV2.cpp:1290
TypeSystemClang.h
lldb_private::ConstString::IsEmpty
bool IsEmpty() const
Test for empty string.
Definition: ConstString.h:304
lldb_private::ValueObject::IsBaseClass
virtual bool IsBaseClass()
Definition: ValueObject.h:398
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorExtended::IsPossibleExtendedTaggedPointer
bool IsPossibleExtendedTaggedPointer(lldb::addr_t ptr)
Definition: AppleObjCRuntimeV2.cpp:2756
lldb_private::AppleObjCRuntime::GetObjCVersion
static ObjCRuntimeVersions GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp)
Definition: AppleObjCRuntime.cpp:371
lldb_private::AppleObjCRuntimeV2::HashTableSignature::NeedsUpdate
bool NeedsUpdate(Process *process, AppleObjCRuntimeV2 *runtime, RemoteNXMapTable &hash_table)
Definition: AppleObjCRuntimeV2.cpp:1393
lldb_private::Runtime::m_process
Process * m_process
Definition: Runtime.h:29
lldb_private::CommandReturnObject::SetStatus
void SetStatus(lldb::ReturnStatus status)
Definition: CommandReturnObject.cpp:121
CommandObjectObjC_ClassTable_Dump::CommandOptions::m_verbose
OptionValueBoolean m_verbose
Definition: AppleObjCRuntimeV2.cpp:795
RemoteNXMapTable::const_iterator::const_iterator
const_iterator(RemoteNXMapTable &parent, int index)
Definition: AppleObjCRuntimeV2.cpp:1264
lldb_private::Debugger::GetAsyncOutputStream
lldb::StreamSP GetAsyncOutputStream()
Definition: Debugger.cpp:1061
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb::eExpressionCompleted
@ eExpressionCompleted
Definition: lldb-enumerations.h:271
lldb_private::AppleObjCRuntime::CouldHaveDynamicValue
bool CouldHaveDynamicValue(ValueObject &in_value) override
Definition: AppleObjCRuntime.cpp:261
StreamString.h
lldb_private::Symbol::GetAddressRef
Address & GetAddressRef()
Definition: Symbol.h:57
lldb_private::Breakpoint::Exact
@ Exact
Definition: Breakpoint.h:86
lldb_private::CommandReturnObject::GetOutputStream
Stream & GetOutputStream()
Definition: CommandReturnObject.h:45
lldb_private::FunctionCaller::GetArgumentValues
ValueList GetArgumentValues() const
Definition: FunctionCaller.h:286
lldb_private::ObjCLanguageRuntime::GetDescriptorIteratorPair
std::pair< ISAToDescriptorIterator, ISAToDescriptorIterator > GetDescriptorIteratorPair(bool update_if_needed=true)
Definition: ObjCLanguageRuntime.cpp:205
LLDB_OPT_SET_ALL
#define LLDB_OPT_SET_ALL
Definition: lldb-defines.h:112
RemoteNXMapTable::GetTableLoadAddress
lldb::addr_t GetTableLoadAddress() const
Definition: AppleObjCRuntimeV2.cpp:1370
lldb_private::Target::CreateUtilityFunction
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateUtilityFunction(std::string expression, std::string name, lldb::LanguageType language, ExecutionContext &exe_ctx)
Creates and installs a UtilityFunction for the given language.
Definition: Target.cpp:2319
ExtractRuntimeGlobalSymbol
static uint64_t ExtractRuntimeGlobalSymbol(Process *process, ConstString name, const ModuleSP &module_sp, Status &error, bool read_value=true, uint8_t byte_size=0, uint64_t default_value=LLDB_INVALID_ADDRESS, SymbolType sym_type=lldb::eSymbolTypeData)
Definition: AppleObjCRuntimeV2.cpp:614
lldb_private::AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor
ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(ObjCISA isa)
Definition: AppleObjCRuntimeV2.cpp:2833
lldb_private::Process::GetAddressByteSize
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3340
lldb::eEncodingUint
@ eEncodingUint
unsigned integer
Definition: lldb-enumerations.h:148
lldb_private::SymbolContextList::GetSize
uint32_t GetSize() const
Get accessor for a symbol context list size.
Definition: SymbolContext.cpp:1281
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::AppleObjCRuntimeV2::HashTableSignature::m_count
uint32_t m_count
Definition: AppleObjCRuntimeV2.h:126
LIBLLDB_LOG_TYPES
#define LIBLLDB_LOG_TYPES
Definition: Logging.h:33
lldb-enumerations.h
Timer.h
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted
Definition: AppleObjCRuntimeV2.h:195
ObjCExceptionRecognizedStackFrame::ObjCExceptionRecognizedStackFrame
ObjCExceptionRecognizedStackFrame(StackFrameSP frame_sp)
Definition: AppleObjCRuntimeV2.cpp:3025
lldb_private::AppleObjCRuntimeV2::GetNonPointerIsaCache
NonPointerISACache * GetNonPointerIsaCache()
Definition: AppleObjCRuntimeV2.h:410
lldb_private::AppleObjCRuntimeV2::CreateExceptionResolver
lldb::BreakpointResolverSP CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp) override
Definition: AppleObjCRuntimeV2.cpp:1074
lldb_private::EvaluateExpressionOptions::SetTryAllThreads
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:342
lldb_private::GetLogIfAllCategoriesSet
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:58
lldb_private::AppleObjCRuntimeV2::WarnIfNoClassesCached
void WarnIfNoClassesCached(SharedCacheWarningReason reason)
Definition: AppleObjCRuntimeV2.cpp:2315
CommandObjectObjC_ClassTable_Dump
Definition: AppleObjCRuntimeV2.cpp:760
lldb::eArgTypeRegularExpression
@ eArgTypeRegularExpression
Definition: lldb-enumerations.h:569
lldb_private::Value::ValueType
ValueType
Type that describes Value::m_value.
Definition: Value.h:41
lldb_private::AppleObjCRuntimeV2::m_decl_vendor_up
std::unique_ptr< DeclVendor > m_decl_vendor_up
Definition: AppleObjCRuntimeV2.h:424
CommandObjectObjC_ClassTable_Dump::CommandOptions::SetOptionValue
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
Definition: AppleObjCRuntimeV2.cpp:768
lldb_private::AppleObjCRuntime
Definition: AppleObjCRuntime.h:23
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
lldb_private::DynamicLoader
Definition: DynamicLoader.h:52
LLDB_SCOPED_TIMER
#define LLDB_SCOPED_TIMER()
Definition: Timer.h:90
lldb::eBasicTypeVoid
@ eBasicTypeVoid
Definition: lldb-enumerations.h:743
CommandObjectMultiword.h
CommandObjectObjC_ClassTable_Dump::CommandObjectObjC_ClassTable_Dump
CommandObjectObjC_ClassTable_Dump(CommandInterpreter &interpreter)
Definition: AppleObjCRuntimeV2.cpp:798
lldb::eReturnStatusFailed
@ eReturnStatusFailed
Definition: lldb-enumerations.h:265
lldb_private::AppleObjCRuntime::GetObjCModule
lldb::ModuleSP GetObjCModule()
Definition: AppleObjCRuntime.cpp:217
lldb_private::ValueObject::GetParent
virtual ValueObject * GetParent()
Definition: ValueObject.h:753
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
lldb_private::Debugger
Definition: Debugger.h:70
CommandObjectMultiwordObjC_TaggedPointer::CommandObjectMultiwordObjC_TaggedPointer
CommandObjectMultiwordObjC_TaggedPointer(CommandInterpreter &interpreter)
Definition: AppleObjCRuntimeV2.cpp:1017
lldb_private::ValueObject::GetExecutionContextRef
const ExecutionContextRef & GetExecutionContextRef() const
Definition: ValueObject.h:330
lldb_private::LanguageRuntime
Definition: LanguageRuntime.h:60
lldb::eValueTypeVariableArgument
@ eValueTypeVariableArgument
function argument variables
Definition: lldb-enumerations.h:319
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::ComputeHelper
Helper ComputeHelper() const
Compute which helper to use.
Definition: AppleObjCRuntimeV2.cpp:1618
lldb_private::CommandObject::CommandArgumentData::arg_type
lldb::CommandArgumentType arg_type
Definition: CommandObject.h:91
lldb_private::AppleObjCRuntimeV2::m_realized_class_generation_count
uint64_t m_realized_class_generation_count
Definition: AppleObjCRuntimeV2.h:437
lldb::eLanguageTypeObjC
@ eLanguageTypeObjC
Objective-C.
Definition: lldb-enumerations.h:453
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:39
CommandObjectMultiwordObjC
Definition: AppleObjCRuntimeV2.cpp:1031
lldb_private::Runtime::GetTargetRef
Target & GetTargetRef()
Definition: Runtime.h:23
LLDB_INVALID_IVAR_OFFSET
#define LLDB_INVALID_IVAR_OFFSET
Definition: lldb-defines.h:88
lldb_private::ObjCLanguageRuntime::ISAIsCached
bool ISAIsCached(ObjCISA isa) const
Definition: ObjCLanguageRuntime.h:320
lldb_private::ObjCLanguageRuntime::AddClass
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp)
Definition: ObjCLanguageRuntime.h:324
lldb_private::EvaluateExpressionOptions::SetUnwindOnError
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:309
Thread.h
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorLegacy::IsPossibleTaggedPointer
bool IsPossibleTaggedPointer(lldb::addr_t ptr) override
Definition: AppleObjCRuntimeV2.cpp:2588
lldb_private::AppleObjCRuntime::GetExceptionThrowLocation
static std::tuple< FileSpec, ConstString > GetExceptionThrowLocation()
Definition: AppleObjCRuntime.cpp:603
lldb::SymbolType
SymbolType
Symbol types.
Definition: lldb-enumerations.h:612
CompilerType.h
RemoteNXMapTable::m_end_iterator
const_iterator m_end_iterator
Definition: AppleObjCRuntimeV2.cpp:1378
VariableList.h
lldb_private::CompilerType::IsValid
bool IsValid() const
Definition: CompilerType.h:72
lldb_private::AppleObjCRuntime::GetValuesForGlobalCFBooleans
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false)
Definition: AppleObjCRuntime.cpp:338
lldb_private::ObjCLanguageRuntime::m_isa_to_descriptor_stop_id
uint32_t m_isa_to_descriptor_stop_id
Definition: ObjCLanguageRuntime.h:400
DoesProcessHaveSharedCache
static bool DoesProcessHaveSharedCache(Process &process)
Definition: AppleObjCRuntimeV2.cpp:2299
ObjCExceptionRecognizedStackFrame::exception
ValueObjectSP exception
Definition: AppleObjCRuntimeV2.cpp:3064
ObjectFile.h
lldb_private::StackFrameRecognizerManager::AddRecognizer
void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, ConstString module, llvm::ArrayRef< ConstString > symbols, bool first_instruction_only=true)
UtilityFunction.h
lldb_private::Address::SetRawAddress
void SetRawAddress(lldb::addr_t addr)
Definition: Address.h:435
g_shared_cache_class_name_funcptr
static const char * g_shared_cache_class_name_funcptr
Definition: AppleObjCRuntimeV2.cpp:238
RegisterObjCExceptionRecognizer
static void RegisterObjCExceptionRecognizer(Process *process)
Definition: AppleObjCRuntimeV2.cpp:3080
g_get_dynamic_class_info_name
static const char * g_get_dynamic_class_info_name
Definition: AppleObjCRuntimeV2.cpp:77
lldb_private::AppleObjCRuntimeV2::HashTableSignature::HashTableSignature
HashTableSignature()
ValueObjectConstResult.h
AppleObjCRuntimeV2.h
lldb_private::Process::CalculateTarget
lldb::TargetSP CalculateTarget() override
Definition: Process.cpp:4196
TypeList.h
lldb_private::EvaluateExpressionOptions::SetIgnoreBreakpoints
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:313
Symbol.h
RemoteNXMapTable::GetBucketCount
uint32_t GetBucketCount() const
Definition: AppleObjCRuntimeV2.cpp:1366
lldb_private::AppleObjCRuntimeV2::m_noclasses_warning_emitted
bool m_noclasses_warning_emitted
Definition: AppleObjCRuntimeV2.h:435
lldb_private::ObjCLanguageRuntime::TaggedPointerVendor::GetClassDescriptor
virtual ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(lldb::addr_t ptr)=0
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorExtended::GetClassDescriptor
ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(lldb::addr_t ptr) override
Definition: AppleObjCRuntimeV2.cpp:2768
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::Helper
Helper
Definition: AppleObjCRuntimeV2.h:332
lldb_private::AppleObjCRuntimeV2::GetPluginName
ConstString GetPluginName() override
Definition: AppleObjCRuntimeV2.cpp:1069
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::CompilerType::GetPointerType
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
Definition: CompilerType.cpp:407
lldb_private::Args::GetArgumentAtIndex
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
Definition: Args.cpp:259
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::IsPossibleTaggedPointer
bool IsPossibleTaggedPointer(lldb::addr_t ptr) override
Definition: AppleObjCRuntimeV2.cpp:2676
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:437
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:25
uint32_t
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
g_get_dynamic_class_info2_body
static const char * g_get_dynamic_class_info2_body
Definition: AppleObjCRuntimeV2.cpp:170
CommandObject.h
lldb::eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishResult
Definition: lldb-enumerations.h:261
lldb_private::DeclVendor
Definition: DeclVendor.h:20
AppleObjCTypeEncodingParser.h
lldb_private::Runtime::GetProcess
Process * GetProcess()
Definition: Runtime.h:22
lldb_private::Address
Definition: Address.h:59
CommandObjectObjC_ClassTable_Dump::CommandOptions::GetDefinitions
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Definition: AppleObjCRuntimeV2.cpp:791
lldb::eArgTypeNone
@ eArgTypeNone
Definition: lldb-enumerations.h:595
lldb_private::TypeAndOrName::SetTypeSP
void SetTypeSP(lldb::TypeSP type_sp)
Definition: Type.cpp:778
lldb_private::StructuredData::Object::GetAsDictionary
Dictionary * GetAsDictionary()
Definition: StructuredData.h:91
g_get_shared_cache_class_info_name
static const char * g_get_shared_cache_class_info_name
Definition: AppleObjCRuntimeV2.cpp:246
lldb_private::ObjCLanguageRuntime::ObjCISA
lldb::addr_t ObjCISA
Definition: ObjCLanguageRuntime.h:42
lldb_private::CompilerType::GetTypeName
ConstString GetTypeName() const
Definition: CompilerType.cpp:277
lldb_private::Address::GetLoadAddress
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:310
lldb_private::DiagnosticManager
Definition: DiagnosticManager.h:93
lldb_private::AppleObjCRuntimeV2::CreateObjectChecker
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateObjectChecker(std::string name, ExecutionContext &exe_ctx) override
Definition: AppleObjCRuntimeV2.cpp:1090
lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::GetClassInfoUtilityFunction
UtilityFunction * GetClassInfoUtilityFunction(ExecutionContext &exe_ctx)
Definition: AppleObjCRuntimeV2.cpp:1722
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::ValueObject::GetCompilerType
CompilerType GetCompilerType()
Definition: ValueObject.h:352
ObjCLanguageRuntime.h
CommandObjectMultiwordObjC_TaggedPointer_Info::CommandObjectMultiwordObjC_TaggedPointer_Info
CommandObjectMultiwordObjC_TaggedPointer_Info(CommandInterpreter &interpreter)
Definition: AppleObjCRuntimeV2.cpp:920
lldb_private::RecognizedStackFrame
Definition: StackFrameRecognizer.h:30
lldb_private::AppleObjCRuntimeV2::SharedCacheWarningReason::eExpressionExecutionFailure
@ eExpressionExecutionFailure
lldb_private::ScratchTypeSystemClang::GetForTarget
static TypeSystemClang * GetForTarget(Target &target, llvm::Optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
Definition: TypeSystemClang.cpp:9738
lldb_private::AppleObjCRuntimeV2::GetByteOffsetForIvar
size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name) override
Definition: AppleObjCRuntimeV2.cpp:1144
lldb_private::DataExtractor::GetU32
uint32_t GetU32(lldb::offset_t *offset_ptr) const
Extract a uint32_t value from *offset_ptr.
Definition: DataExtractor.cpp:427
PluginManager.h
lldb_private::AppleObjCRuntimeV2::m_tagged_pointer_vendor_up
std::unique_ptr< TaggedPointerVendor > m_tagged_pointer_vendor_up
Definition: AppleObjCRuntimeV2.h:433
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorV2
Definition: AppleObjCRuntimeV2.h:174
RemoteNXMapTable::ParseHeader
bool ParseHeader(Process *process, lldb::addr_t load_addr)
Definition: AppleObjCRuntimeV2.cpp:1210
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:242
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::ValueObjectConstResult::Create
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
Definition: ValueObjectConstResult.cpp:28
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::AppleObjCRuntimeV2::GetEncodingToType
EncodingToTypeSP GetEncodingToType() override
Definition: AppleObjCRuntimeV2.cpp:2951
DiagnosticManager.h
RemoteNXMapTable::const_iterator::m_index
int m_index
Definition: AppleObjCRuntimeV2.cpp:1355
lldb_private::DiagnosticManager::Clear
void Clear()
Definition: DiagnosticManager.h:95
lldb_private::ExecutionContext::GetTargetRef
Target & GetTargetRef() const
Returns a reference to the target object.
Definition: ExecutionContext.cpp:226
Status.h
lldb_private::AppleObjCRuntimeV2::DescriptorMapUpdateResult::Fail
static DescriptorMapUpdateResult Fail()
Definition: AppleObjCRuntimeV2.h:296
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoArgs
lldb::addr_t & GetClassInfoArgs(Helper helper)
Definition: AppleObjCRuntimeV2.cpp:1607
OptionParser.h
lldb_private::AppleObjCRuntimeV2::m_hash_signature
HashTableSignature m_hash_signature
Definition: AppleObjCRuntimeV2.h:428
lldb::eLanguageTypeC
@ eLanguageTypeC
Non-standardized C, such as K&R.
Definition: lldb-enumerations.h:439
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorV2::CreateInstance
static TaggedPointerVendorV2 * CreateInstance(AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp)
Definition: AppleObjCRuntimeV2.cpp:2481
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::AppleObjCRuntimeV2::m_dynamic_class_info_extractor
DynamicClassInfoExtractor m_dynamic_class_info_extractor
Definition: AppleObjCRuntimeV2.h:421
lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::objc_copyRealizedClassList
@ objc_copyRealizedClassList
Definition: AppleObjCRuntimeV2.h:332
lldb_private::OptionDefinition
Definition: OptionDefinition.h:20
lldb_private::FunctionCaller::ExecuteFunction
lldb::ExpressionResults ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager, Value &results)
Run the function this FunctionCaller was created with.
Definition: FunctionCaller.cpp:313
g_get_dynamic_class_info_body
static const char * g_get_dynamic_class_info_body
Definition: AppleObjCRuntimeV2.cpp:80
lldb_private::TypeSystemClang::GetBasicType
CompilerType GetBasicType(lldb::BasicType type)
Definition: TypeSystemClang.cpp:938
RemoteNXMapTable::GetBucketDataPointer
lldb::addr_t GetBucketDataPointer() const
Definition: AppleObjCRuntimeV2.cpp:1368
lldb_private::AppleObjCRuntimeV2::GetSharedCacheBaseAddress
lldb::addr_t GetSharedCacheBaseAddress()
Definition: AppleObjCRuntimeV2.cpp:2180
lldb_private::TypeSystemClang
A TypeSystem implementation based on Clang.
Definition: TypeSystemClang.h:106
ConstString.h
lldb_private::ValueObject::GetTargetSP
lldb::TargetSP GetTargetSP() const
Definition: ValueObject.h:334
CommandObjectObjC_ClassTable_Dump::CommandOptions
Definition: AppleObjCRuntimeV2.cpp:762
CommandObjectMultiwordObjC_ClassTable
Definition: AppleObjCRuntimeV2.cpp:1000
ValueObjectVariable.h
g_objc_classtable_dump_options
static constexpr OptionDefinition g_objc_classtable_dump_options[]
Definition: AppleObjCRuntimeV2.cpp:748
CommandObjectMultiwordObjC_ClassTable::CommandObjectMultiwordObjC_ClassTable
CommandObjectMultiwordObjC_ClassTable(CommandInterpreter &interpreter)
Definition: AppleObjCRuntimeV2.cpp:1002
AppleObjCClassDescriptorV2.h
lldb_private::Process::ReadUnsignedIntegerFromMemory
uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Status &error)
Reads an unsigned integer of the specified byte size from process memory.
Definition: Process.cpp:2100
Stream.h
lldb_private::Process::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Definition: Process.cpp:3336
lldb_private::Process::GetSharedCacheInfo
virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo()
Definition: Process.h:1315
lldb_private::Log
Definition: Log.h:49
g_get_dynamic_class_info2_name
static const char * g_get_dynamic_class_info2_name
Definition: AppleObjCRuntimeV2.cpp:167
OptionValueBoolean.h
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorLegacy
Definition: AppleObjCRuntimeV2.h:269
lldb_private::Process::ReadPointerFromMemory
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2122
lldb_private::EvaluateExpressionOptions::SetStopOthers
void SetStopOthers(bool stop_others=true)
Definition: Target.h:346
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:394
lldb_private::AppleObjCRuntimeV2::AppleObjCRuntimeV2
AppleObjCRuntimeV2(Process *process, const lldb::ModuleSP &objc_module_sp)
Definition: AppleObjCRuntimeV2.cpp:654
lldb_private::GetLogIfAnyCategoriesSet
Log * GetLogIfAnyCategoriesSet(uint32_t mask)
Definition: Logging.cpp:62
lldb_private::Symbol::GetLoadAddress
lldb::addr_t GetLoadAddress(Target *target) const
Definition: Symbol.cpp:493
lldb_private::AppleObjCRuntimeV2::DescriptorMapUpdateResult::m_update_ran
bool m_update_ran
Definition: AppleObjCRuntimeV2.h:288
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorExtended::TaggedPointerVendorExtended
TaggedPointerVendorExtended(AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask, uint64_t objc_debug_taggedpointer_ext_mask, uint32_t objc_debug_taggedpointer_slot_shift, uint32_t objc_debug_taggedpointer_ext_slot_shift, uint32_t objc_debug_taggedpointer_slot_mask, uint32_t objc_debug_taggedpointer_ext_slot_mask, uint32_t objc_debug_taggedpointer_payload_lshift, uint32_t objc_debug_taggedpointer_payload_rshift, uint32_t objc_debug_taggedpointer_ext_payload_lshift, uint32_t objc_debug_taggedpointer_ext_payload_rshift, lldb::addr_t objc_debug_taggedpointer_classes, lldb::addr_t objc_debug_taggedpointer_ext_classes)
Definition: AppleObjCRuntimeV2.cpp:2722
lldb_private::CommandObject::CommandArgumentEntry
std::vector< CommandArgumentData > CommandArgumentEntry
Definition: CommandObject.h:105
lldb_private::AppleObjCRuntimeV2::GetCFBooleanValuesIfNeeded
bool GetCFBooleanValuesIfNeeded()
Definition: AppleObjCRuntimeV2.cpp:2968
lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap
DescriptorMapUpdateResult UpdateISAToDescriptorMap()
Definition: AppleObjCRuntimeV2.cpp:1962
lldb_private::Process::GetStopID
uint32_t GetStopID() const
Definition: Process.h:1373
lldb_private::CommandReturnObject::AppendError
void void AppendError(llvm::StringRef in_string)
Definition: CommandReturnObject.cpp:100
lldb_private::AppleObjCRuntimeV2::GetDeclVendor
DeclVendor * GetDeclVendor() override
Definition: AppleObjCRuntimeV2.cpp:2346
lldb_private::Args::GetArgumentCount
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
Definition: Args.h:118
DynamicLoader.h
lldb_private::DataBufferHeap
Definition: DataBufferHeap.h:30
lldb_private::AppleObjCRuntimeV2::GetPluginNameStatic
static lldb_private::ConstString GetPluginNameStatic()
Definition: AppleObjCRuntimeV2.cpp:1063
lldb_private::AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded
void UpdateISAToDescriptorMapIfNeeded() override
Definition: AppleObjCRuntimeV2.cpp:2197
lldb
Definition: SBAddress.h:15
LIBLLDB_LOG_PROCESS
#define LIBLLDB_LOG_PROCESS
Definition: Logging.h:15
lldb_private::ThreadList::GetExpressionExecutionThread
lldb::ThreadSP GetExpressionExecutionThread()
Definition: ThreadList.cpp:59
StackFrameRecognizer.h
RegisterContext.h
LLDB_LOG_ERROR
#define LLDB_LOG_ERROR(log, error,...)
Definition: Log.h:265
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::GetClassDescriptor
ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(lldb::addr_t ptr) override
Definition: AppleObjCRuntimeV2.cpp:2681
lldb_private::FileSpec::GetFilename
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:341
lldb_private::AppleObjCRuntimeV2::RealizedClassGenerationCountChanged
bool RealizedClassGenerationCountChanged()
Update the generation count of realized classes.
Definition: AppleObjCRuntimeV2.cpp:2270
lldb_private::AppleObjCRuntimeV2::DescriptorMapUpdateResult::m_num_found
uint32_t m_num_found
Definition: AppleObjCRuntimeV2.h:289
lldb_private::ObjectFile
Definition: ObjectFile.h:58
ExecutionContext.h
LLDB_INVALID_MODULE_VERSION
#define LLDB_INVALID_MODULE_VERSION
Definition: lldb-defines.h:90
CommandObjectObjC_ClassTable_Dump::CommandOptions::CommandOptions
CommandOptions()
Definition: AppleObjCRuntimeV2.cpp:764
UINT64_MAX
#define UINT64_MAX
Definition: lldb-defines.h:35
lldb_private::AppleObjCRuntimeV2::TaggedPointerVendorExtended
Definition: AppleObjCRuntimeV2.h:229
lldb_private::UtilityFunction
Definition: UtilityFunction.h:30
lldb_private::AppleObjCRuntimeV2::HasSymbol
bool HasSymbol(ConstString Name)
Definition: AppleObjCRuntimeV2.cpp:1950
lldb_private::AppleObjCRuntimeV2::GetDynamicTypeAndAddress
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type) override
Definition: AppleObjCRuntimeV2.cpp:677
RemoteNXMapTable::RemoteNXMapTable
RemoteNXMapTable()
Definition: AppleObjCRuntimeV2.cpp:1200
AppleObjCTrampolineHandler.h
RemoteNXMapTable::end
const_iterator end()
Definition: AppleObjCRuntimeV2.cpp:1362
lldb_private::FunctionCaller
Definition: FunctionCaller.h:56
lldb_private::AppleObjCRuntimeV2::ParseClassInfoArray
uint32_t ParseClassInfoArray(const lldb_private::DataExtractor &data, uint32_t num_class_infos)
Definition: AppleObjCRuntimeV2.cpp:1884
lldb_private::Log::PutCString
void PutCString(const char *cstr)
Definition: Log.cpp:118
RemoteNXMapTable::const_iterator::AdvanceToValidIndex
void AdvanceToValidIndex()
Definition: AppleObjCRuntimeV2.cpp:1331
lldb_private::AppleObjCRuntimeV2::Initialize
static void Initialize()
Definition: AppleObjCRuntimeV2.cpp:1049
RemoteNXMapTable::const_iterator::operator++
const_iterator & operator++()
Definition: AppleObjCRuntimeV2.cpp:1294
lldb_private::OptionArgParser::ToAddress
static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, Status *error)
Definition: OptionArgParser.cpp:142