60#include "clang/AST/ASTContext.h"
61#include "clang/AST/DeclObjC.h"
62#include "clang/Basic/TargetInfo.h"
63#include "llvm/ADT/STLExtras.h"
64#include "llvm/ADT/ScopeExit.h"
65#include "llvm/ADT/Sequence.h"
76struct RuntimeGlobalSymbolSpec {
80 bool read_value =
true;
83 uint8_t byte_size = 0;
86struct RuntimeGlobalSymbolResult {
95 "__lldb_apple_objc_v2_get_dynamic_class_info";
101 size_t strlen(const char *);
102 char *strncpy (char * s1, const char * s2, size_t n);
103 int printf(const char * format, ...);
105#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
107typedef struct _NXMapTable {
109 unsigned num_classes;
110 unsigned num_buckets_minus_one;
114#define NX_MAPNOTAKEY ((void *)(-1))
116typedef struct BucketInfo
118 const char *name_ptr;
126} __attribute__((__packed__));
129__lldb_apple_objc_v2_get_dynamic_class_info (void *gdb_objc_realized_classes_ptr,
130 void *class_infos_ptr,
131 uint32_t class_infos_byte_size,
134 DEBUG_PRINTF ("gdb_objc_realized_classes_ptr = %p\n", gdb_objc_realized_classes_ptr);
135 DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
136 DEBUG_PRINTF ("class_infos_byte_size = %u\n", class_infos_byte_size);
137 const NXMapTable *grc = (const NXMapTable *)gdb_objc_realized_classes_ptr;
140 const unsigned num_classes = grc->num_classes;
141 DEBUG_PRINTF ("num_classes = %u\n", grc->num_classes);
144 const unsigned num_buckets_minus_one = grc->num_buckets_minus_one;
145 DEBUG_PRINTF ("num_buckets_minus_one = %u\n", num_buckets_minus_one);
147 const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
148 DEBUG_PRINTF ("max_class_infos = %u\n", max_class_infos);
150 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
151 BucketInfo *buckets = (BucketInfo *)grc->buckets;
154 for (unsigned i=0; i<=num_buckets_minus_one; ++i)
156 if (buckets[i].name_ptr != NX_MAPNOTAKEY)
158 if (idx < max_class_infos)
160 const char *s = buckets[i].name_ptr;
162 for (unsigned char c = *s; c; c = *++s)
163 h = ((h << 5) + h) + c;
164 class_infos[idx].hash = h;
165 class_infos[idx].isa = buckets[i].isa;
166 DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, buckets[i].name_ptr);
171 if (idx < max_class_infos)
173 class_infos[idx].isa = NULL;
174 class_infos[idx].hash = 0;
185 "__lldb_apple_objc_v2_get_dynamic_class_info2";
190 int printf(const char * format, ...);
191 void free(void *ptr);
192 Class* objc_copyRealizedClassList_nolock(unsigned int *outCount);
193 const char* objc_debug_class_getNameRaw(Class cls);
196#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
202} __attribute__((__packed__));
205__lldb_apple_objc_v2_get_dynamic_class_info2(void *gdb_objc_realized_classes_ptr,
206 void *class_infos_ptr,
207 uint32_t class_infos_byte_size,
210 DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
211 DEBUG_PRINTF ("class_infos_byte_size = %u\n", class_infos_byte_size);
213 const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
214 DEBUG_PRINTF ("max_class_infos = %u\n", max_class_infos);
216 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
219 Class* realized_class_list = objc_copyRealizedClassList_nolock(&count);
220 DEBUG_PRINTF ("count = %u\n", count);
223 for (uint32_t i=0; i<count; ++i)
225 if (idx < max_class_infos)
227 Class isa = realized_class_list[i];
228 const char *name_ptr = objc_debug_class_getNameRaw(isa);
231 const char *s = name_ptr;
233 for (unsigned char c = *s; c; c = *++s)
234 h = ((h << 5) + h) + c;
235 class_infos[idx].hash = h;
236 class_infos[idx].isa = isa;
237 DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name_ptr);
242 if (idx < max_class_infos)
244 class_infos[idx].isa = NULL;
245 class_infos[idx].hash = 0;
248 free(realized_class_list);
254 "__lldb_apple_objc_v2_get_dynamic_class_info3";
259 int printf(const char * format, ...);
260 void free(void *ptr);
261 size_t objc_getRealizedClassList_trylock(Class *buffer, size_t len);
262 const char* objc_debug_class_getNameRaw(Class cls);
263 const char* class_getName(Class cls);
266#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
272} __attribute__((__packed__));
275__lldb_apple_objc_v2_get_dynamic_class_info3(void *gdb_objc_realized_classes_ptr,
276 void *class_infos_ptr,
277 uint32_t class_infos_byte_size,
279 uint32_t class_buffer_len,
282 DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
283 DEBUG_PRINTF ("class_infos_byte_size = %u\n", class_infos_byte_size);
285 const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
286 DEBUG_PRINTF ("max_class_infos = %u\n", max_class_infos);
288 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
290 Class *realized_class_list = (Class*)class_buffer;
292 uint32_t count = objc_getRealizedClassList_trylock(realized_class_list,
294 DEBUG_PRINTF ("count = %u\n", count);
297 for (uint32_t i=0; i<count; ++i)
299 if (idx < max_class_infos)
301 Class isa = realized_class_list[i];
302 const char *name_ptr = objc_debug_class_getNameRaw(isa);
304 class_getName(isa); // Realize name of lazy classes.
305 name_ptr = objc_debug_class_getNameRaw(isa);
309 const char *s = name_ptr;
311 for (unsigned char c = *s; c; c = *++s)
312 h = ((h << 5) + h) + c;
313 class_infos[idx].hash = h;
314 class_infos[idx].isa = isa;
315 DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name_ptr);
320 if (idx < max_class_infos)
322 class_infos[idx].isa = NULL;
323 class_infos[idx].hash = 0;
335 const char *{0}(void *objc_class);
336 const char *(*class_name_lookup_func)(void *) = {1};
341 "__lldb_apple_objc_v2_get_shared_cache_class_info";
347 size_t strlen(const char *);
348 char *strncpy (char * s1, const char * s2, size_t n);
349 int printf(const char * format, ...);
352#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
355struct objc_classheader_t {
360struct objc_classheader_v16_t {
361 uint64_t isDuplicate : 1,
362 objectCacheOffset : 47, // Offset from the shared cache base
366struct objc_clsopt_t {
374 uint32_t scramble[256];
375 uint8_t tab[0]; // tab[mask+1]
376 // uint8_t checkbytes[capacity];
377 // int32_t offset[capacity];
378 // objc_classheader_t clsOffsets[capacity];
379 // uint32_t duplicateCount;
380 // objc_classheader_t duplicateOffsets[duplicateCount];
383struct objc_clsopt_v16_t {
391 uint32_t scramble[256];
392 uint8_t tab[0]; // tab[mask+1]
393 // uint8_t checkbytes[capacity];
394 // int32_t offset[capacity];
395 // objc_classheader_t clsOffsets[capacity];
396 // uint32_t duplicateCount;
397 // objc_classheader_t duplicateOffsets[duplicateCount];
402 int32_t selopt_offset;
403 int32_t headeropt_offset;
404 int32_t clsopt_offset;
407struct objc_opt_v14_t {
410 int32_t selopt_offset;
411 int32_t headeropt_offset;
412 int32_t clsopt_offset;
415struct objc_opt_v16_t {
418 int32_t selopt_offset;
419 int32_t headeropt_ro_offset;
420 int32_t unused_clsopt_offset;
421 int32_t unused_protocolopt_offset;
422 int32_t headeropt_rw_offset;
423 int32_t unused_protocolopt2_offset;
424 int32_t largeSharedCachesClassOffset;
425 int32_t largeSharedCachesProtocolOffset;
426 uint64_t relativeMethodSelectorBaseAddressCacheOffset;
433} __attribute__((__packed__));
439__lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr,
440 void *shared_cache_base_ptr,
441 void *class_infos_ptr,
442 uint64_t *relative_selector_offset,
443 uint32_t class_infos_byte_size,
447 *relative_selector_offset = 0;
449 DEBUG_PRINTF ("objc_opt_ro_ptr = %p\n", objc_opt_ro_ptr);
450 DEBUG_PRINTF ("shared_cache_base_ptr = %p\n", shared_cache_base_ptr);
451 DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
452 DEBUG_PRINTF ("class_infos_byte_size = %u (%llu class infos)\n", class_infos_byte_size, (uint64_t)(class_infos_byte_size/sizeof(ClassInfo)));
453 DEBUG_PRINTF ("start_idx = %u\n", *start_idx);
456 const objc_opt_t *objc_opt = (objc_opt_t *)objc_opt_ro_ptr;
457 const objc_opt_v14_t* objc_opt_v14 = (objc_opt_v14_t*)objc_opt_ro_ptr;
458 const objc_opt_v16_t* objc_opt_v16 = (objc_opt_v16_t*)objc_opt_ro_ptr;
459 if (objc_opt->version >= 16)
461 *relative_selector_offset = objc_opt_v16->relativeMethodSelectorBaseAddressCacheOffset;
462 DEBUG_PRINTF ("objc_opt->version = %u\n", objc_opt_v16->version);
463 DEBUG_PRINTF ("objc_opt->flags = %u\n", objc_opt_v16->flags);
464 DEBUG_PRINTF ("objc_opt->selopt_offset = %d\n", objc_opt_v16->selopt_offset);
465 DEBUG_PRINTF ("objc_opt->headeropt_ro_offset = %d\n", objc_opt_v16->headeropt_ro_offset);
466 DEBUG_PRINTF ("objc_opt->relativeMethodSelectorBaseAddressCacheOffset = %d\n", *relative_selector_offset);
468 else if (objc_opt->version >= 14)
470 DEBUG_PRINTF ("objc_opt->version = %u\n", objc_opt_v14->version);
471 DEBUG_PRINTF ("objc_opt->flags = %u\n", objc_opt_v14->flags);
472 DEBUG_PRINTF ("objc_opt->selopt_offset = %d\n", objc_opt_v14->selopt_offset);
473 DEBUG_PRINTF ("objc_opt->headeropt_offset = %d\n", objc_opt_v14->headeropt_offset);
474 DEBUG_PRINTF ("objc_opt->clsopt_offset = %d\n", objc_opt_v14->clsopt_offset);
478 DEBUG_PRINTF ("objc_opt->version = %u\n", objc_opt->version);
479 DEBUG_PRINTF ("objc_opt->selopt_offset = %d\n", objc_opt->selopt_offset);
480 DEBUG_PRINTF ("objc_opt->headeropt_offset = %d\n", objc_opt->headeropt_offset);
481 DEBUG_PRINTF ("objc_opt->clsopt_offset = %d\n", objc_opt->clsopt_offset);
484 if (objc_opt->version == 16)
486 int32_t large_offset = objc_opt_v16->largeSharedCachesClassOffset;
487 const objc_clsopt_v16_t* clsopt = (const objc_clsopt_v16_t*)((uint8_t *)objc_opt + large_offset);
488 // Work around a bug in some version shared cache builder where the offset overflows 2GiB (rdar://146432183).
489 uint32_t unsigned_offset = (uint32_t)large_offset;
490 if (unsigned_offset > 0x7fffffff && unsigned_offset < 0x82000000) {
491 clsopt = (const objc_clsopt_v16_t*)((uint8_t *)objc_opt + unsigned_offset);
492 DEBUG_PRINTF("warning: applying largeSharedCachesClassOffset overflow workaround!\n");
494 const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
496 DEBUG_PRINTF("max_class_infos = %llu\n", (uint64_t)max_class_infos);
498 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
500 const uint8_t *checkbytes = &clsopt->tab[clsopt->mask+1];
501 const int32_t *offsets = (const int32_t *)(checkbytes + clsopt->capacity);
502 const objc_classheader_v16_t *classOffsets = (const objc_classheader_v16_t *)(offsets + clsopt->capacity);
504 DEBUG_PRINTF ("clsopt->capacity = %u\n", clsopt->capacity);
505 DEBUG_PRINTF ("clsopt->mask = 0x%8.8x\n", clsopt->mask);
506 DEBUG_PRINTF ("classOffsets = %p\n", classOffsets);
508 const uint32_t original_start_idx = *start_idx;
510 // Always start at the start_idx here. If it's greater than the capacity,
511 // it will skip the loop entirely and go to the duplicate handling below.
512 for (uint32_t i=*start_idx; i<clsopt->capacity; ++i)
514 const uint64_t objectCacheOffset = classOffsets[i].objectCacheOffset;
515 DEBUG_PRINTF("objectCacheOffset[%u] = %u\n", i, objectCacheOffset);
517 if (classOffsets[i].isDuplicate) {
518 DEBUG_PRINTF("isDuplicate = true\n");
519 continue; // duplicate
522 if (objectCacheOffset == 0) {
523 DEBUG_PRINTF("objectCacheOffset == invalidEntryOffset\n");
524 continue; // invalid offset
527 if (class_infos && idx < max_class_infos)
529 class_infos[idx].isa = (Class)((uint8_t *)shared_cache_base_ptr + objectCacheOffset);
531 // Lookup the class name.
532 const char *name = class_name_lookup_func(class_infos[idx].isa);
533 DEBUG_PRINTF("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
535 // Hash the class name so we don't have to read it.
536 const char *s = name;
538 for (unsigned char c = *s; c; c = *++s)
540 // class_getName demangles swift names and the hash must
541 // be calculated on the mangled name. hash==0 means lldb
542 // will fetch the mangled name and compute the hash in
543 // ParseClassInfoArray.
549 h = ((h << 5) + h) + c;
551 class_infos[idx].hash = h;
555 DEBUG_PRINTF("not(class_infos && idx < max_class_infos)\n");
562 if (idx < max_class_infos) {
563 const uint32_t *duplicate_count_ptr = (uint32_t *)&classOffsets[clsopt->capacity];
564 const uint32_t duplicate_count = *duplicate_count_ptr;
565 const objc_classheader_v16_t *duplicateClassOffsets = (const objc_classheader_v16_t *)(&duplicate_count_ptr[1]);
567 DEBUG_PRINTF ("duplicate_count = %u\n", duplicate_count);
568 DEBUG_PRINTF ("duplicateClassOffsets = %p\n", duplicateClassOffsets);
570 const uint32_t duplicate_start_idx =
571 *start_idx < clsopt->capacity ?
573 *start_idx - clsopt->capacity;
575 for (uint32_t i=duplicate_start_idx; i<duplicate_count; ++i)
577 const uint64_t objectCacheOffset = duplicateClassOffsets[i].objectCacheOffset;
578 DEBUG_PRINTF("objectCacheOffset[%u] = %u\n", i, objectCacheOffset);
580 if (duplicateClassOffsets[i].isDuplicate) {
581 DEBUG_PRINTF("isDuplicate = true\n");
582 continue; // duplicate
585 if (objectCacheOffset == 0) {
586 DEBUG_PRINTF("objectCacheOffset == invalidEntryOffset\n");
587 continue; // invalid offset
590 if (class_infos && idx < max_class_infos)
592 class_infos[idx].isa = (Class)((uint8_t *)shared_cache_base_ptr + objectCacheOffset);
594 // Lookup the class name.
595 const char *name = class_name_lookup_func(class_infos[idx].isa);
596 DEBUG_PRINTF("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
598 // Hash the class name so we don't have to read it.
599 const char *s = name;
601 for (unsigned char c = *s; c; c = *++s)
603 // class_getName demangles swift names and the hash must
604 // be calculated on the mangled name. hash==0 means lldb
605 // will fetch the mangled name and compute the hash in
606 // ParseClassInfoArray.
612 h = ((h << 5) + h) + c;
614 class_infos[idx].hash = h;
616 DEBUG_PRINTF("not(class_infos && idx < max_class_infos)\n");
623 // Always make sure start_idx gets updated. Otherwise we have an infinite
624 // loop if there are exactly max_class_infos number of classes.
625 if (*start_idx == original_start_idx) {
629 else if (objc_opt->version >= 12 && objc_opt->version <= 15)
631 const objc_clsopt_t* clsopt = NULL;
632 if (objc_opt->version >= 14)
633 clsopt = (const objc_clsopt_t*)((uint8_t *)objc_opt_v14 + objc_opt_v14->clsopt_offset);
635 clsopt = (const objc_clsopt_t*)((uint8_t *)objc_opt + objc_opt->clsopt_offset);
636 const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);
637 DEBUG_PRINTF("max_class_infos = %llu\n", (uint64_t)max_class_infos);
638 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
639 int32_t invalidEntryOffset = 0;
640 // this is safe to do because the version field order is invariant
641 if (objc_opt->version == 12)
642 invalidEntryOffset = 16;
643 const uint8_t *checkbytes = &clsopt->tab[clsopt->mask+1];
644 const int32_t *offsets = (const int32_t *)(checkbytes + clsopt->capacity);
645 const objc_classheader_t *classOffsets = (const objc_classheader_t *)(offsets + clsopt->capacity);
646 DEBUG_PRINTF ("clsopt->capacity = %u\n", clsopt->capacity);
647 DEBUG_PRINTF ("clsopt->mask = 0x%8.8x\n", clsopt->mask);
648 DEBUG_PRINTF ("classOffsets = %p\n", classOffsets);
649 DEBUG_PRINTF("invalidEntryOffset = %d\n", invalidEntryOffset);
650 for (uint32_t i=0; i<clsopt->capacity; ++i)
652 const int32_t clsOffset = classOffsets[i].clsOffset;
653 DEBUG_PRINTF("clsOffset[%u] = %u\n", i, clsOffset);
656 DEBUG_PRINTF("clsOffset & 1\n");
657 continue; // duplicate
659 else if (clsOffset == invalidEntryOffset)
661 DEBUG_PRINTF("clsOffset == invalidEntryOffset\n");
662 continue; // invalid offset
665 if (class_infos && idx < max_class_infos)
667 class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);
668 const char *name = class_name_lookup_func (class_infos[idx].isa);
669 DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
670 // Hash the class name so we don't have to read it
671 const char *s = name;
673 for (unsigned char c = *s; c; c = *++s)
675 // class_getName demangles swift names and the hash must
676 // be calculated on the mangled name. hash==0 means lldb
677 // will fetch the mangled name and compute the hash in
678 // ParseClassInfoArray.
684 h = ((h << 5) + h) + c;
686 class_infos[idx].hash = h;
690 DEBUG_PRINTF("not(class_infos && idx < max_class_infos)\n");
695 const uint32_t *duplicate_count_ptr = (uint32_t *)&classOffsets[clsopt->capacity];
696 const uint32_t duplicate_count = *duplicate_count_ptr;
697 const objc_classheader_t *duplicateClassOffsets = (const objc_classheader_t *)(&duplicate_count_ptr[1]);
698 DEBUG_PRINTF ("duplicate_count = %u\n", duplicate_count);
699 DEBUG_PRINTF ("duplicateClassOffsets = %p\n", duplicateClassOffsets);
700 for (uint32_t i=0; i<duplicate_count; ++i)
702 const int32_t clsOffset = duplicateClassOffsets[i].clsOffset;
704 continue; // duplicate
705 else if (clsOffset == invalidEntryOffset)
706 continue; // invalid offset
708 if (class_infos && idx < max_class_infos)
710 class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);
711 const char *name = class_name_lookup_func (class_infos[idx].isa);
712 DEBUG_PRINTF ("[%u] isa = %8p %s\n", idx, class_infos[idx].isa, name);
713 // Hash the class name so we don't have to read it
714 const char *s = name;
716 for (unsigned char c = *s; c; c = *++s)
718 // class_getName demangles swift names and the hash must
719 // be calculated on the mangled name. hash==0 means lldb
720 // will fetch the mangled name and compute the hash in
721 // ParseClassInfoArray.
727 h = ((h << 5) + h) + c;
729 class_infos[idx].hash = h;
734 DEBUG_PRINTF ("%u class_infos\n", idx);
735 DEBUG_PRINTF ("done\n");
746 bool read_value =
true, uint8_t byte_size = 0,
751 return default_value;
756 return default_value;
766 return default_value;
773 return default_value;
778 default_value,
error);
779 return symbol_load_addr;
784static llvm::SmallVector<RuntimeGlobalSymbolResult>
787 llvm::ArrayRef<RuntimeGlobalSymbolSpec> specs) {
790 llvm::SmallVector<RuntimeGlobalSymbolResult> results(specs.size());
792 if (!process || !module_sp)
804 llvm::SmallVector<ReadEntry> work_list;
805 for (
auto [i, spec] : llvm::enumerate(specs)) {
806 const uint8_t size = spec.byte_size ? spec.byte_size : ptr_size;
807 const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(
818 if (!spec.read_value)
819 results[i] = {symbol_load_addr,
true};
821 work_list.push_back({i, symbol_load_addr, size});
826 llvm::stable_sort(work_list, [](
const ReadEntry &a,
const ReadEntry &b) {
827 return a.byte_size < b.byte_size;
830 for (
size_t i = 0; i < work_list.size();) {
831 const uint8_t byte_size = work_list[i].byte_size;
832 const size_t group_start = i;
834 llvm::SmallVector<lldb::addr_t> addrs;
835 while (i < work_list.size() && work_list[i].byte_size == byte_size)
836 addrs.push_back(work_list[i++].addr);
841 for (
size_t j = 0; j < addrs.size(); ++j) {
842 size_t idx = work_list[group_start + j].result_idx;
843 if (read_values[j].has_value())
844 results[idx] = {*read_values[j],
true};
868 static const ConstString g_gdb_object_getClass(
"gdb_object_getClass");
870 static const ConstString g_objc_copyRealizedClassList(
871 "_ZL33objc_copyRealizedClassList_nolockPj");
872 static const ConstString g_objc_getRealizedClassList_trylock(
873 "_objc_getRealizedClassList_trylock");
876 HasSymbol(g_objc_getRealizedClassList_trylock);
886 LanguageType impl_lang = descriptor_sp->GetImplementationLanguage();
888 return process_sp->GetLanguageRuntime(impl_lang);
912 class_type_or_name.
Clear();
924 ConstString class_name(objc_class_sp->GetClassName());
925 class_type_or_name.
SetName(class_name);
926 TypeSP type_sp(objc_class_sp->GetType());
932 objc_class_sp->SetType(type_sp);
937 auto types = vendor->FindTypes(class_name, 1);
945 return !class_type_or_name.
IsEmpty();
975 "Print ivar and method information in detail"}};
989 switch (short_option) {
997 "unrecognized short option '%c'", short_option);
1017 "Dump information on Objective-C classes "
1018 "known to the current process.",
1019 "language objc class-table dump",
1020 eCommandRequiresProcess |
1021 eCommandProcessMustBeLaunched |
1022 eCommandProcessMustBePaused),
1033 std::unique_ptr<RegularExpression> regex_up;
1040 if (!regex_up->IsValid()) {
1042 "invalid argument - please provide a valid regular expression");
1049 result.
AppendError(
"please provide 0 or 1 arguments");
1059 auto iterator = iterators_pair.first;
1061 for (; iterator != iterators_pair.second; iterator++) {
1062 if (iterator->second) {
1063 const char *class_name =
1064 iterator->second->GetClassName().AsCString(
"<unknown>");
1065 if (regex_up && class_name &&
1066 !regex_up->Execute(llvm::StringRef(class_name)))
1068 std_out.Printf(
"isa = 0x%" PRIx64, iterator->first);
1069 std_out.Printf(
" name = %s", class_name);
1070 std_out.Printf(
" instance size = %" PRIu64,
1071 iterator->second->GetInstanceSize());
1072 std_out.Printf(
" num ivars = %" PRIuPTR,
1073 (uintptr_t)iterator->second->GetNumIVars());
1074 if (
auto superclass = iterator->second->GetSuperclass()) {
1075 std_out.Printf(
" superclass = %s",
1076 superclass->GetClassName().AsCString(
"<unknown>"));
1078 std_out.Printf(
"\n");
1080 for (
size_t i = 0; i < iterator->second->GetNumIVars(); i++) {
1081 auto ivar = iterator->second->GetIVarAtIndex(i);
1083 " ivar name = %s type = %s size = %" PRIu64
1084 " offset = %" PRId32
"\n",
1085 ivar.m_name.AsCString(
"<unknown>"),
1086 ivar.m_type.GetDisplayTypeName().AsCString(
"<unknown>"),
1087 ivar.m_size, ivar.m_offset);
1090 iterator->second->Describe(
1092 [&std_out](
const char *name,
const char *type) ->
bool {
1093 std_out.Printf(
" instance method name = %s type = %s\n",
1097 [&std_out](
const char *name,
const char *type) ->
bool {
1098 std_out.Printf(
" class method name = %s type = %s\n", name,
1105 if (regex_up && !regex_up->Execute(llvm::StringRef()))
1107 std_out.Printf(
"isa = 0x%" PRIx64
" has no associated class.\n",
1114 result.
AppendError(
"current process has no Objective-C runtime loaded");
1126 interpreter,
"info",
"Dump information on a tagged pointer.",
1127 "language objc tagged-pointer info",
1128 eCommandRequiresProcess | eCommandProcessMustBeLaunched |
1129 eCommandProcessMustBePaused) {
1138 result.
AppendError(
"this command requires arguments");
1147 if (!objc_runtime) {
1148 result.
AppendError(
"current process has no Objective-C runtime loaded");
1155 if (!tagged_ptr_vendor) {
1156 result.
AppendError(
"current process has no tagged pointer support");
1171 "could not convert '{0}' to a valid address\n", arg_str);
1182 if (!descriptor_sp) {
1184 "could not get class descriptor for {0:x16}\n", arg_addr);
1189 uint64_t info_bits = 0;
1190 uint64_t value_bits = 0;
1191 uint64_t payload = 0;
1192 if (descriptor_sp->GetTaggedPointerInfo(&info_bits, &value_bits,
1196 "\tpayload = {1:x16}\n"
1197 "\tvalue = {2:x16}\n"
1198 "\tinfo bits = {3:x16}\n"
1200 arg_addr, payload, value_bits, info_bits,
1201 descriptor_sp->GetClassName().AsCString(
"<unknown>"));
1215 interpreter,
"class-table",
1216 "Commands for operating on the Objective-C class table.",
1217 "class-table <subcommand> [<subcommand-options>]") {
1230 interpreter,
"tagged-pointer",
1231 "Commands for operating on Objective-C tagged pointers.",
1232 "tagged-pointer <subcommand> [<subcommand-options>]") {
1246 interpreter,
"objc",
1247 "Commands for operating on the Objective-C language runtime.",
1248 "objc <subcommand> [<subcommand-options>]") {
1276 bool catch_bp,
bool throw_bp) {
1280 resolver_sp = std::make_shared<BreakpointResolverName>(
1290llvm::Expected<std::unique_ptr<UtilityFunction>>
1293 char check_function_code[2048];
1297 len = ::snprintf(check_function_code,
sizeof(check_function_code), R
"(
1298 extern "C" void *gdb_object_getClass(void *);
1299 extern "C" int printf(const char *format, ...);
1301 %s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {
1302 if ($__lldb_arg_obj == (void *)0)
1303 return; // nil is ok
1304 if (!gdb_object_getClass($__lldb_arg_obj)) {
1305 *((volatile int *)0) = 'ocgc';
1306 } else if ($__lldb_arg_selector != (void *)0) {
1307 signed char $responds = (signed char)
1308 [(id)$__lldb_arg_obj respondsToSelector:
1309 (void *) $__lldb_arg_selector];
1310 if ($responds == (signed char) 0)
1311 *((volatile int *)0) = 'ocgc';
1316 len = ::snprintf(check_function_code,
sizeof(check_function_code), R
"(
1317 extern "C" void *gdb_class_getClass(void *);
1318 extern "C" int printf(const char *format, ...);
1320 %s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {
1321 if ($__lldb_arg_obj == (void *)0)
1322 return; // nil is ok
1323 void **$isa_ptr = (void **)$__lldb_arg_obj;
1324 if (*$isa_ptr == (void *)0 ||
1325 !gdb_class_getClass(*$isa_ptr))
1326 *((volatile int *)0) = 'ocgc';
1327 else if ($__lldb_arg_selector != (void *)0) {
1328 signed char $responds = (signed char)
1329 [(id)$__lldb_arg_obj respondsToSelector:
1330 (void *) $__lldb_arg_selector];
1331 if ($responds == (signed char) 0)
1332 *((volatile int *)0) = 'ocgc';
1338 assert(len < (int)
sizeof(check_function_code));
1346 const char *ivar_name) {
1349 ConstString class_name = parent_ast_type.
GetTypeName();
1350 if (!class_name.
IsEmpty() && ivar_name && ivar_name[0]) {
1353 std::string buffer(
"OBJC_IVAR_$_");
1355 buffer.push_back(
'.');
1356 buffer.append(ivar_name);
1357 ConstString ivar_const_str(buffer);
1372 if (ivar_offset_symbol.
symbol)
1373 ivar_offset_address =
1383 ivar_offset =
m_process->ReadUnsignedIntegerFromMemory(
1399class RemoteNXMapTable {
1401 RemoteNXMapTable() : m_end_iterator(*this, -1) {}
1404 printf(
"RemoteNXMapTable.m_load_addr = 0x%" PRIx64
"\n", m_load_addr);
1405 printf(
"RemoteNXMapTable.m_count = %u\n", m_count);
1406 printf(
"RemoteNXMapTable.m_num_buckets_minus_one = %u\n",
1407 m_num_buckets_minus_one);
1408 printf(
"RemoteNXMapTable.m_buckets_ptr = 0x%" PRIX64
"\n", m_buckets_ptr);
1412 m_process = process;
1413 m_load_addr = load_addr;
1414 m_map_pair_size = m_process->GetAddressByteSize() * 2;
1422 const uint32_t unsigned_byte_size =
sizeof(uint32_t);
1426 bool success =
true;
1434 cursor, unsigned_byte_size, 0, err);
1436 cursor += unsigned_byte_size;
1440 cursor, unsigned_byte_size, 0, err);
1441 cursor += unsigned_byte_size;
1460 typedef std::pair<ConstString, ObjCLanguageRuntime::ObjCISA>
element;
1471 : m_parent(rhs.m_parent), m_index(rhs.m_index) {
1475 const_iterator &operator=(
const const_iterator &rhs) {
1477 assert(&m_parent == &rhs.m_parent);
1478 m_index = rhs.m_index;
1482 bool operator==(
const const_iterator &rhs)
const {
1483 if (&m_parent != &rhs.m_parent)
1485 if (m_index != rhs.m_index)
1491 bool operator!=(
const const_iterator &rhs)
const {
1495 const_iterator &operator++() {
1496 AdvanceToValidIndex();
1501 if (m_index == -1) {
1507 size_t map_pair_size = m_parent.m_map_pair_size;
1508 lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
1513 m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
1516 lldb::addr_t value = m_parent.m_process->ReadPointerFromMemory(
1517 pair_ptr + m_parent.m_process->GetAddressByteSize(), err);
1521 std::string key_string;
1523 m_parent.m_process->ReadCStringFromMemory(key, key_string, err);
1532 void AdvanceToValidIndex() {
1537 const size_t map_pair_size = m_parent.m_map_pair_size;
1538 const lldb::addr_t invalid_key = m_parent.m_invalid_key;
1544 m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
1551 if (key != invalid_key)
1559 const_iterator begin() {
1560 return const_iterator(*
this, m_num_buckets_minus_one + 1);
1563 const_iterator end() {
return m_end_iterator; }
1565 uint32_t GetCount()
const {
return m_count; }
1567 uint32_t GetBucketCount()
const {
return m_num_buckets_minus_one; }
1569 lldb::addr_t GetBucketDataPointer()
const {
return m_buckets_ptr; }
1571 lldb::addr_t GetTableLoadAddress()
const {
return m_load_addr; }
1575 uint32_t m_count = 0;
1576 uint32_t m_num_buckets_minus_one = 0;
1579 const_iterator m_end_iterator;
1581 size_t m_map_pair_size = 0;
1603 if (m_count == hash_table.
GetCount() &&
1617 class_descriptor_sp = non_pointer_isa_cache->GetClassDescriptor(isa);
1618 if (!class_descriptor_sp)
1620 return class_descriptor_sp;
1632 seen.insert(&valobj);
1636 ValueObject *parent = valobj.
GetParent();
1638 if (!parent || seen.count(parent))
1642 return parent_descriptor_sp->GetSuperclass();
1649 return objc_class_sp;
1652 return objc_class_sp;
1659 Process *process = exe_ctx.GetProcessPtr();
1661 return objc_class_sp;
1666 return objc_class_sp;
1669 if (!objc_class_sp) {
1671 isa = abi_sp->FixCodeAddress(isa);
1675 if (isa && !objc_class_sp) {
1678 "0x%" PRIx64
": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
1679 "not in class descriptor cache 0x%" PRIx64,
1682 return objc_class_sp;
1692 if (!objc_module_sp)
1696 "objc_debug_taggedpointer_obfuscator");
1698 const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
1724 if (!objc_module_sp)
1727 static ConstString g_gdb_objc_realized_classes(
"gdb_objc_realized_classes");
1729 const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
1738 gdb_objc_realized_classes_ptr,
error);
1745std::unique_ptr<AppleObjCRuntimeV2::SharedCacheImageHeaders>
1751 if (!objc_module_sp || !process)
1754 const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
1757 LLDB_LOG(log,
"Symbol 'objc_debug_headerInfoRWs' unavailable. Some "
1758 "information concerning the shared cache may be unavailable");
1765 LLDB_LOG(log,
"Symbol 'objc_debug_headerInfoRWs' was found but we were "
1766 "unable to get its load address");
1775 "Failed to read address of 'objc_debug_headerInfoRWs' at {0:x}",
1776 objc_debug_headerInfoRWs_addr);
1780 const size_t metadata_size =
1781 sizeof(uint32_t) +
sizeof(uint32_t);
1782 DataBufferHeap metadata_buffer(metadata_size,
'\0');
1783 process->
ReadMemory(objc_debug_headerInfoRWs_ptr, metadata_buffer.GetBytes(),
1787 "Unable to read metadata for 'objc_debug_headerInfoRWs' at {0:x}",
1788 objc_debug_headerInfoRWs_ptr);
1792 DataExtractor metadata_extractor(metadata_buffer.GetBytes(), metadata_size,
1796 uint32_t count = metadata_extractor.GetU32_unchecked(&cursor);
1797 uint32_t entsize = metadata_extractor.GetU32_unchecked(&cursor);
1798 if (count == 0 || entsize == 0) {
1800 "'objc_debug_headerInfoRWs' had count {0} with entsize {1}. These "
1801 "should both be non-zero.",
1806 std::unique_ptr<SharedCacheImageHeaders> shared_cache_image_headers(
1807 new SharedCacheImageHeaders(runtime, objc_debug_headerInfoRWs_ptr, count,
1809 if (
auto Err = shared_cache_image_headers->UpdateIfNeeded()) {
1811 "Failed to update SharedCacheImageHeaders: {0}");
1815 return shared_cache_image_headers;
1819 if (!m_needs_update)
1820 return llvm::Error::success();
1822 Process *process = m_runtime.GetProcess();
1824 sizeof(uint32_t) +
sizeof(uint32_t);
1828 const size_t memory_needed =
static_cast<size_t>(m_count) * m_entsize;
1829 if (memory_needed > 1024 * 1024 * 1024)
1830 return llvm::createStringError(
1831 "SharedCacheImageHeaders require too much memory");
1833 const lldb::addr_t first_header_addr = m_headerInfoRWs_ptr + metadata_size;
1835 llvm::SmallVector<Range<addr_t, size_t>> mem_ranges =
1836 llvm::to_vector(llvm::map_range(llvm::seq(m_count), [&](uint32_t i) {
1837 return Range<addr_t, size_t>(first_header_addr + (i * m_entsize),
1841 llvm::SmallVector<uint8_t, 0> buffer(memory_needed, 0);
1842 llvm::SmallVector<llvm::MutableArrayRef<uint8_t>> read_results =
1845 for (
auto [i, header_data] : llvm::enumerate(read_results)) {
1847 return llvm::createStringError(llvm::inconvertibleErrorCode(),
1848 "Failed to read memory from inferior when "
1849 "populating SharedCacheImageHeaders");
1855 bool is_loaded =
false;
1867 m_loaded_images.set(i);
1869 m_loaded_images.reset(i);
1871 m_needs_update =
false;
1873 return llvm::Error::success();
1877 uint16_t image_index) {
1878 if (image_index >= m_count)
1880 if (
auto Err = UpdateIfNeeded()) {
1883 "Failed to update SharedCacheImageHeaders: {0}");
1885 return m_loaded_images.test(image_index);
1889 if (
auto Err = UpdateIfNeeded()) {
1892 "Failed to update SharedCacheImageHeaders: {0}");
1897std::unique_ptr<UtilityFunction>
1899 ExecutionContext &exe_ctx, Helper helper, std::string code,
1903 LLDB_LOG(log,
"Creating utility function {0}", name);
1912 if (!utility_fn_or_error) {
1914 log, utility_fn_or_error.takeError(),
1915 "Failed to get utility function for dynamic info extractor: {0}");
1920 CompilerType clang_uint32_t_type =
1921 scratch_ts_sp->GetBuiltinTypeForEncodingAndBitSize(
eEncodingUint, 32);
1922 CompilerType clang_void_pointer_type =
1926 ValueList arguments;
1946 std::unique_ptr<UtilityFunction> utility_fn = std::move(*utility_fn_or_error);
1949 utility_fn->MakeFunctionCaller(clang_uint32_t_type, arguments,
1954 "Failed to make function caller for implementation lookup: {0}.",
1982 case objc_getRealizedClassList_trylock: {
1983 if (!m_objc_getRealizedClassList_trylock_helper.utility_function)
1984 m_objc_getRealizedClassList_trylock_helper.utility_function =
1985 GetClassInfoUtilityFunctionImpl(exe_ctx, helper,
1988 return m_objc_getRealizedClassList_trylock_helper.utility_function.get();
1991 llvm_unreachable(
"Unexpected helper");
1997 case gdb_objc_realized_classes:
1998 return m_gdb_objc_realized_classes_helper.args;
1999 case objc_copyRealizedClassList:
2000 return m_objc_copyRealizedClassList_helper.args;
2001 case objc_getRealizedClassList_trylock:
2002 return m_objc_getRealizedClassList_trylock_helper.args;
2004 llvm_unreachable(
"Unexpected helper");
2010 if (!m_runtime.m_has_objc_copyRealizedClassList &&
2011 !m_runtime.m_has_objc_getRealizedClassList_trylock)
2014 if (
Process *process = m_runtime.GetProcess()) {
2016 if (loader->IsFullyInitialized()) {
2021 if (m_runtime.m_has_objc_getRealizedClassList_trylock)
2025 if (m_runtime.m_has_objc_copyRealizedClassList)
2038std::unique_ptr<UtilityFunction>
2043 LLDB_LOG(log,
"Creating utility function {0}",
2053 static ConstString g_class_getName_symbol_name(
"class_getName");
2054 static ConstString g_class_getNameRaw_symbol_name(
2055 "objc_debug_class_getNameRaw");
2057 ConstString class_name_getter_function_name =
2058 m_runtime.HasSymbol(g_class_getNameRaw_symbol_name)
2059 ? g_class_getNameRaw_symbol_name
2060 : g_class_getName_symbol_name;
2065 std::string shared_class_expression;
2066 llvm::raw_string_ostream(shared_class_expression) << llvm::formatv(
2068 class_name_getter_function_name);
2077 if (!utility_fn_or_error) {
2079 log, utility_fn_or_error.takeError(),
2080 "Failed to get utility function for shared class info extractor: {0}");
2085 CompilerType clang_uint32_t_type =
2086 scratch_ts_sp->GetBuiltinTypeForEncodingAndBitSize(
eEncodingUint, 32);
2087 CompilerType clang_void_pointer_type =
2089 CompilerType clang_uint64_t_pointer_type =
2090 scratch_ts_sp->GetBuiltinTypeForEncodingAndBitSize(
eEncodingUint, 64)
2092 CompilerType clang_uint32_t_pointer_type =
2093 scratch_ts_sp->GetBuiltinTypeForEncodingAndBitSize(
eEncodingUint, 32)
2097 ValueList arguments;
2121 std::unique_ptr<UtilityFunction> utility_fn = std::move(*utility_fn_or_error);
2124 utility_fn->MakeFunctionCaller(clang_uint32_t_type, arguments,
2129 "Failed to make function caller for implementation lookup: {0}.",
2140 if (!m_utility_function)
2141 m_utility_function = GetClassInfoUtilityFunctionImpl(exe_ctx);
2142 return m_utility_function.get();
2145AppleObjCRuntimeV2::DescriptorMapUpdateResult
2147 RemoteNXMapTable &hash_table) {
2148 Process *process = m_runtime.GetProcess();
2149 if (process ==
nullptr)
2152 uint32_t num_class_infos = 0;
2156 ExecutionContext exe_ctx;
2163 if (!thread_sp->SafeToCallFunctions())
2166 thread_sp->CalculateExecutionContext(exe_ctx);
2173 Address function_address;
2183 const uint32_t num_classes =
2186 : m_runtime.m_realized_class_generation_count;
2187 if (num_classes == 0) {
2188 LLDB_LOGF(log,
"No dynamic classes found.");
2192 UtilityFunction *get_class_info_code =
2193 GetClassInfoUtilityFunction(exe_ctx, helper);
2194 if (!get_class_info_code) {
2199 FunctionCaller *get_class_info_function =
2202 if (!get_class_info_function) {
2203 LLDB_LOGF(log,
"Failed to get implementation lookup function caller.");
2209 DiagnosticManager diagnostics;
2211 const uint32_t class_info_byte_size = addr_size + 4;
2212 const uint32_t class_infos_byte_size = num_classes * class_info_byte_size;
2214 class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
2218 "unable to allocate %" PRIu32
2219 " bytes in process for shared cache read",
2220 class_infos_byte_size);
2224 llvm::scope_exit deallocate_class_infos([&] {
2231 const uint32_t class_byte_size = addr_size;
2232 const uint32_t class_buffer_len = num_classes;
2233 const uint32_t class_buffer_byte_size = class_buffer_len * class_byte_size;
2234 if (helper == Helper::objc_getRealizedClassList_trylock) {
2236 class_buffer_byte_size, ePermissionsReadable | ePermissionsWritable,
2240 "unable to allocate %" PRIu32
2241 " bytes in process for shared cache read",
2242 class_buffer_byte_size);
2247 llvm::scope_exit deallocate_class_buffer([&] {
2253 std::lock_guard<std::mutex> guard(m_mutex);
2270 bool dump_log = type_log && type_log->
GetVerbose();
2274 bool success =
false;
2276 diagnostics.
Clear();
2280 exe_ctx, GetClassInfoArgs(helper), arguments, diagnostics)) {
2281 EvaluateExpressionOptions options;
2289 CompilerType clang_uint32_t_type =
2290 scratch_ts_sp->GetBuiltinTypeForEncodingAndBitSize(
eEncodingUint, 32);
2297 diagnostics.
Clear();
2301 exe_ctx, &GetClassInfoArgs(helper), options, diagnostics, return_value);
2306 LLDB_LOG(log,
"Discovered {0} Objective-C classes", num_class_infos);
2307 if (num_class_infos > 0) {
2309 DataBufferHeap buffer(num_class_infos * class_info_byte_size, 0);
2316 m_runtime.ParseClassInfoArray(class_infos_data, num_class_infos);
2322 LLDB_LOGF(log,
"Error evaluating our find class name function.");
2323 diagnostics.
Dump(log);
2328 LLDB_LOGF(log,
"Error writing function arguments.");
2329 diagnostics.
Dump(log);
2337 uint32_t num_class_infos) {
2349 uint32_t num_parsed = 0;
2353 for (uint32_t i = 0; i < num_class_infos; ++i) {
2359 log,
"AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
2367 "AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
2368 ", ignoring this class info",
2373 const uint32_t name_hash = data.
GetU32(&offset);
2374 ClassDescriptorSP descriptor_sp(
2383 AddClass(isa, descriptor_sp, name_hash);
2386 descriptor_sp->GetClassName().AsCString(
nullptr));
2390 "AppleObjCRuntimeV2 added isa=0x%" PRIx64
2391 ", hash=0x%8.8x, name=%s",
2393 descriptor_sp->GetClassName().AsCString(
"<unknown>"));
2397 LLDB_LOGF(log,
"AppleObjCRuntimeV2 parsed %" PRIu32
" class infos",
2413AppleObjCRuntimeV2::DescriptorMapUpdateResult
2415 Process *process = m_runtime.GetProcess();
2416 if (process ==
nullptr)
2421 ExecutionContext exe_ctx;
2428 if (!thread_sp->SafeToCallFunctions())
2431 thread_sp->CalculateExecutionContext(exe_ctx);
2438 Address function_address;
2444 uint32_t num_class_infos = 0;
2446 const lldb::addr_t objc_opt_ptr = m_runtime.GetSharedCacheReadOnlyAddress();
2448 m_runtime.GetSharedCacheBaseAddress();
2456 const uint32_t max_num_classes_in_buffer = 212992;
2458 UtilityFunction *get_class_info_code = GetClassInfoUtilityFunction(exe_ctx);
2459 if (!get_class_info_code) {
2464 FunctionCaller *get_shared_cache_class_info_function =
2467 if (!get_shared_cache_class_info_function) {
2468 LLDB_LOGF(log,
"Failed to get implementation lookup function caller.");
2472 ValueList arguments =
2475 DiagnosticManager diagnostics;
2477 const uint32_t class_info_byte_size = addr_size + 4;
2478 const uint32_t class_infos_byte_size =
2479 max_num_classes_in_buffer * class_info_byte_size;
2481 class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
2482 const uint32_t relative_selector_offset_addr_size = 64;
2485 ePermissionsReadable | ePermissionsWritable, err);
2486 constexpr uint32_t class_info_start_idx_byte_size =
sizeof(uint32_t);
2489 ePermissionsReadable | ePermissionsWritable, err);
2495 "unable to allocate %" PRIu32
2496 " bytes in process for shared cache read",
2497 class_infos_byte_size);
2501 const uint32_t start_idx_init_value = 0;
2503 class_info_start_idx_addr, &start_idx_init_value,
sizeof(uint32_t), err);
2504 if (bytes_written !=
sizeof(uint32_t)) {
2506 "unable to write %" PRIu32
2507 " bytes in process for shared cache read",
2508 class_infos_byte_size);
2512 std::lock_guard<std::mutex> guard(m_mutex);
2524 bool dump_log = type_log && type_log->
GetVerbose();
2528 bool success =
false;
2530 diagnostics.
Clear();
2534 exe_ctx, m_args, arguments, diagnostics)) {
2535 EvaluateExpressionOptions options;
2543 CompilerType clang_uint32_t_type =
2544 scratch_ts_sp->GetBuiltinTypeForEncodingAndBitSize(
eEncodingUint, 32);
2551 diagnostics.
Clear();
2553 uint32_t num_class_infos_read = 0;
2554 bool already_read_relative_selector_offset =
false;
2560 exe_ctx, &m_args, options, diagnostics, return_value);
2565 num_class_infos += num_class_infos_read;
2566 LLDB_LOG(log,
"Discovered {0} Objective-C classes in the shared cache",
2567 num_class_infos_read);
2568 if (num_class_infos_read > 0) {
2573 if (!already_read_relative_selector_offset) {
2574 DataBufferHeap relative_selector_offset_buffer(64, 0);
2576 relative_selector_offset_addr,
2577 relative_selector_offset_buffer.GetBytes(),
2578 relative_selector_offset_buffer.GetByteSize(),
2579 err) == relative_selector_offset_buffer.GetByteSize()) {
2580 DataExtractor relative_selector_offset_data(
2581 relative_selector_offset_buffer.GetBytes(),
2582 relative_selector_offset_buffer.GetByteSize(),
2585 uint64_t relative_selector_offset =
2586 relative_selector_offset_data.GetU64(&offset);
2587 if (relative_selector_offset > 0) {
2589 m_runtime.SetRelativeSelectorBaseAddr(objc_opt_ptr +
2590 relative_selector_offset);
2593 already_read_relative_selector_offset =
true;
2597 DataBufferHeap class_infos_buffer(
2598 num_class_infos_read * class_info_byte_size, 0);
2600 class_infos_buffer.GetBytes(),
2601 class_infos_buffer.GetByteSize(),
2602 err) == class_infos_buffer.GetByteSize()) {
2603 DataExtractor class_infos_data(class_infos_buffer.GetBytes(),
2604 class_infos_buffer.GetByteSize(),
2607 m_runtime.ParseClassInfoArray(class_infos_data,
2608 num_class_infos_read);
2612 LLDB_LOGF(log,
"Error evaluating our find class name function.");
2613 diagnostics.
Dump(log);
2616 }
while (num_class_infos_read == max_num_classes_in_buffer);
2618 LLDB_LOGF(log,
"Error writing function arguments.");
2619 diagnostics.
Dump(log);
2622 LLDB_LOG(log,
"Processed {0} Objective-C classes total from the shared cache",
2638 if (objc_module_sp) {
2639 ObjectFile *objc_object = objc_module_sp->GetObjectFile();
2642 SectionList *section_list = objc_module_sp->GetSectionList();
2647 if (text_segment_sp) {
2649 text_segment_sp->GetChildren().FindSectionByName(
2652 if (objc_opt_section_sp) {
2653 return objc_opt_section_sp->GetLoadBaseAddress(
2669 StructuredData::Dictionary *info_dict = info->GetAsDictionary();
2690 RemoteNXMapTable hash_table;
2701 !class_count_changed)
2721 const uint32_t num_classes_to_warn_at = 500;
2727 "attempted to read objc class data - results: "
2728 "[dynamic_update]: ran: %s, retry: %s, count: %" PRIu32
2729 " [shared_cache_update]: ran: %s, retry: %s, count: %" PRIu32,
2730 dynamic_update_result.m_update_ran ?
"yes" :
"no",
2731 dynamic_update_result.m_retry_update ?
"yes" :
"no",
2732 dynamic_update_result.m_num_found,
2733 shared_cache_update_result.m_update_ran ?
"yes" :
"no",
2734 shared_cache_update_result.m_retry_update ?
"yes" :
"no",
2735 shared_cache_update_result.m_num_found);
2740 if (dynamic_update_result.m_retry_update ||
2741 shared_cache_update_result.m_retry_update)
2743 else if ((!shared_cache_update_result.m_update_ran) ||
2744 (!dynamic_update_result.m_update_ran))
2747 else if (dynamic_update_result.m_num_found +
2748 shared_cache_update_result.m_num_found <
2749 num_classes_to_warn_at)
2765 uint64_t objc_debug_realized_class_generation_count =
2767 process,
ConstString(
"objc_debug_realized_class_generation_count"),
2773 objc_debug_realized_class_generation_count)
2778 "objc_debug_realized_class_generation_count changed from {0} to {1}",
2780 objc_debug_realized_class_generation_count);
2783 objc_debug_realized_class_generation_count;
2793 llvm::StringRef platform_plugin_name_sr = platform_sp->GetPluginName();
2794 if (platform_plugin_name_sr.ends_with(
"-simulator"))
2812 "the process. This may reduce the quality of type "
2813 "information available\n",
2818 "could not execute support code to read "
2819 "Objective-C class data in the process. This may "
2820 "reduce the quality of type information available\n",
2825 "could not execute support code to read Objective-C class data because "
2826 "it's not yet safe to do so, and will be retried later\n",
2827 debugger.GetID(),
nullptr);
2850 llvm::raw_string_ostream os(buffer);
2852 os <<
"libobjc.A.dylib is being read from process memory. This "
2853 "indicates that LLDB could not ";
2855 if (platform_sp->IsHost()) {
2856 os <<
"read from the host's in-memory shared cache";
2858 os <<
"find the on-disk shared cache for this device";
2861 os <<
"read from the shared cache";
2863 os <<
". This will likely reduce debugging performance\n";
2879 const char *name_cstr = name.
AsCString(
nullptr);
2882 llvm::StringRef name_strref(name_cstr);
2884 llvm::StringRef ivar_prefix(
"OBJC_IVAR_$_");
2885 llvm::StringRef class_prefix(
"OBJC_CLASS_$_");
2887 if (name_strref.starts_with(ivar_prefix)) {
2888 llvm::StringRef ivar_skipped_prefix =
2889 name_strref.substr(ivar_prefix.size());
2890 std::pair<llvm::StringRef, llvm::StringRef> class_and_ivar =
2891 ivar_skipped_prefix.split(
'.');
2893 if (!class_and_ivar.first.empty() && !class_and_ivar.second.empty()) {
2894 const ConstString class_name_cs(class_and_ivar.first);
2899 const ConstString ivar_name_cs(class_and_ivar.second);
2900 const char *ivar_name_cstr = ivar_name_cs.AsCString(
nullptr);
2902 auto ivar_func = [&ret,
2903 ivar_name_cstr](
const char *name,
const char *type,
2906 if (!strcmp(name, ivar_name_cstr)) {
2913 descriptor->Describe(
2914 std::function<
void(
ObjCISA)>(
nullptr),
2915 std::function<
bool(
const char *,
const char *)>(
nullptr),
2916 std::function<
bool(
const char *,
const char *)>(
nullptr),
2920 }
else if (name_strref.starts_with(class_prefix)) {
2921 llvm::StringRef class_skipped_prefix =
2922 name_strref.substr(class_prefix.size());
2923 const ConstString class_name_cs(class_skipped_prefix);
2928 ret = descriptor->GetISA();
2935AppleObjCRuntimeV2::NonPointerISACache *
2954 llvm::SmallVector<RuntimeGlobalSymbolSpec> specs = {
2955 {ConstString(
"objc_debug_isa_magic_mask")},
2956 {ConstString(
"objc_debug_isa_magic_value")},
2957 {ConstString(
"objc_debug_isa_class_mask")},
2958 {ConstString(
"objc_debug_indexed_isa_magic_mask")},
2959 {ConstString(
"objc_debug_indexed_isa_magic_value")},
2960 {ConstString(
"objc_debug_indexed_isa_index_mask")},
2961 {ConstString(
"objc_debug_indexed_isa_index_shift")},
2962 {ConstString(
"objc_indexed_classes"),
false},
2964 assert(specs.size() == kISASymbolCount);
2970 if (!results[kMagicMask].success || !results[kMagicValue].success ||
2971 !results[kClassMask].success)
2974 auto objc_debug_isa_magic_mask = results[kMagicMask].value;
2975 auto objc_debug_isa_magic_value = results[kMagicValue].value;
2976 auto objc_debug_isa_class_mask = results[kClassMask].value;
2979 log->
PutCString(
"AOCRT::NPI: Found all the non-indexed ISA masks");
2982 bool foundError = !results[kIndexedMagicMask].success ||
2983 !results[kIndexedMagicValue].success ||
2984 !results[kIndexedIndexMask].success ||
2985 !results[kIndexedIndexShift].success ||
2986 !results[kIndexedClasses].success;
2988 auto objc_debug_indexed_isa_magic_mask = results[kIndexedMagicMask].value;
2989 auto objc_debug_indexed_isa_magic_value = results[kIndexedMagicValue].value;
2990 auto objc_debug_indexed_isa_index_mask = results[kIndexedIndexMask].value;
2991 auto objc_debug_indexed_isa_index_shift = results[kIndexedIndexShift].value;
2992 auto objc_indexed_classes = results[kIndexedClasses].value;
2994 if (log && !foundError)
2995 log->
PutCString(
"AOCRT::NPI: Found all the indexed ISA masks");
3001 runtime, objc_module_sp, objc_debug_isa_class_mask,
3002 objc_debug_isa_magic_mask, objc_debug_isa_magic_value,
3003 objc_debug_indexed_isa_magic_mask, objc_debug_indexed_isa_magic_value,
3004 objc_debug_indexed_isa_index_mask, objc_debug_indexed_isa_index_shift,
3005 foundError ? 0 : objc_indexed_classes);
3014 enum TaggedPtrSymbol {
3027 kTaggedPtrSymbolCount,
3029 llvm::SmallVector<RuntimeGlobalSymbolSpec> specs = {
3031 {
ConstString(
"objc_debug_taggedpointer_slot_shift"),
true, 4},
3032 {ConstString(
"objc_debug_taggedpointer_slot_mask"),
true, 4},
3033 {ConstString(
"objc_debug_taggedpointer_payload_lshift"),
true, 4},
3034 {ConstString(
"objc_debug_taggedpointer_payload_rshift"),
true, 4},
3035 {ConstString(
"objc_debug_taggedpointer_classes"),
false},
3036 {ConstString(
"objc_debug_taggedpointer_ext_mask")},
3037 {ConstString(
"objc_debug_taggedpointer_ext_slot_shift"),
true, 4},
3038 {ConstString(
"objc_debug_taggedpointer_ext_slot_mask"),
true, 4},
3039 {ConstString(
"objc_debug_taggedpointer_ext_classes"),
false},
3040 {ConstString(
"objc_debug_taggedpointer_ext_payload_lshift"),
true, 4},
3041 {ConstString(
"objc_debug_taggedpointer_ext_payload_rshift"),
true, 4},
3043 assert(specs.size() == kTaggedPtrSymbolCount);
3049 bool required_success =
3050 results[kMask].success && results[kSlotShift].success &&
3051 results[kSlotMask].success && results[kPayloadLshift].success &&
3052 results[kPayloadRshift].success && results[kClasses].success;
3054 if (!required_success)
3057 auto objc_debug_taggedpointer_mask = results[kMask].value;
3058 auto objc_debug_taggedpointer_slot_shift = results[kSlotShift].value;
3059 auto objc_debug_taggedpointer_slot_mask = results[kSlotMask].value;
3060 auto objc_debug_taggedpointer_payload_lshift = results[kPayloadLshift].value;
3061 auto objc_debug_taggedpointer_payload_rshift = results[kPayloadRshift].value;
3062 auto objc_debug_taggedpointer_classes = results[kClasses].value;
3065 bool extended_success =
3066 results[kExtMask].success && results[kExtSlotShift].success &&
3067 results[kExtSlotMask].success && results[kExtClasses].success &&
3068 results[kExtPayloadLshift].success && results[kExtPayloadRshift].success;
3070 if (extended_success) {
3071 auto objc_debug_taggedpointer_ext_mask = results[kExtMask].value;
3072 auto objc_debug_taggedpointer_ext_slot_shift = results[kExtSlotShift].value;
3073 auto objc_debug_taggedpointer_ext_slot_mask = results[kExtSlotMask].value;
3074 auto objc_debug_taggedpointer_ext_classes = results[kExtClasses].value;
3075 auto objc_debug_taggedpointer_ext_payload_lshift =
3076 results[kExtPayloadLshift].value;
3077 auto objc_debug_taggedpointer_ext_payload_rshift =
3078 results[kExtPayloadRshift].value;
3081 runtime, objc_debug_taggedpointer_mask,
3082 objc_debug_taggedpointer_ext_mask, objc_debug_taggedpointer_slot_shift,
3083 objc_debug_taggedpointer_ext_slot_shift,
3084 objc_debug_taggedpointer_slot_mask,
3085 objc_debug_taggedpointer_ext_slot_mask,
3086 objc_debug_taggedpointer_payload_lshift,
3087 objc_debug_taggedpointer_payload_rshift,
3088 objc_debug_taggedpointer_ext_payload_lshift,
3089 objc_debug_taggedpointer_ext_payload_rshift,
3090 objc_debug_taggedpointer_classes, objc_debug_taggedpointer_ext_classes);
3097 runtime, objc_debug_taggedpointer_mask,
3098 objc_debug_taggedpointer_slot_shift, objc_debug_taggedpointer_slot_mask,
3099 objc_debug_taggedpointer_payload_lshift,
3100 objc_debug_taggedpointer_payload_rshift,
3101 objc_debug_taggedpointer_classes);
3109std::unique_ptr<ObjCLanguageRuntime::ClassDescriptor>
3112 if (!IsPossibleTaggedPointer(ptr))
3115 uint32_t foundation_version = m_runtime.GetFoundationVersion();
3120 uint64_t class_bits = (ptr & 0xE) >> 1;
3126 static ConstString g_NSManagedObject(
"NSManagedObject");
3129 if (foundation_version >= 900) {
3130 switch (class_bits) {
3141 name = g_NSManagedObject;
3150 switch (class_bits) {
3155 name = g_NSManagedObject;
3168 lldb::addr_t unobfuscated = ptr ^ m_runtime.GetTaggedPointerObfuscator();
3169 return std::make_unique<ClassDescriptorV2Tagged>(name, unobfuscated);
3175 uint32_t objc_debug_taggedpointer_slot_shift,
3176 uint32_t objc_debug_taggedpointer_slot_mask,
3177 uint32_t objc_debug_taggedpointer_payload_lshift,
3178 uint32_t objc_debug_taggedpointer_payload_rshift,
3180 : TaggedPointerVendorV2(runtime), m_cache(),
3181 m_objc_debug_taggedpointer_mask(objc_debug_taggedpointer_mask),
3182 m_objc_debug_taggedpointer_slot_shift(
3183 objc_debug_taggedpointer_slot_shift),
3184 m_objc_debug_taggedpointer_slot_mask(objc_debug_taggedpointer_slot_mask),
3185 m_objc_debug_taggedpointer_payload_lshift(
3186 objc_debug_taggedpointer_payload_lshift),
3187 m_objc_debug_taggedpointer_payload_rshift(
3188 objc_debug_taggedpointer_payload_rshift),
3189 m_objc_debug_taggedpointer_classes(objc_debug_taggedpointer_classes) {}
3193 return (ptr & m_objc_debug_taggedpointer_mask) != 0;
3196std::unique_ptr<ObjCLanguageRuntime::ClassDescriptor>
3200 uint64_t unobfuscated = (ptr) ^ m_runtime.GetTaggedPointerObfuscator();
3202 if (!IsPossibleTaggedPointer(unobfuscated))
3205 uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_slot_shift) &
3206 m_objc_debug_taggedpointer_slot_mask;
3208 CacheIterator iterator = m_cache.find(slot), end = m_cache.end();
3209 if (iterator != end) {
3210 actual_class_descriptor_sp = iterator->second;
3212 Process *process(m_runtime.GetProcess());
3214 m_objc_debug_taggedpointer_classes;
3217 if (
error.Fail() || slot_data == 0 ||
3220 actual_class_descriptor_sp =
3221 m_runtime.GetClassDescriptorFromISA((
ObjCISA)slot_data);
3222 if (!actual_class_descriptor_sp) {
3225 actual_class_descriptor_sp =
3226 m_runtime.GetClassDescriptorFromISA(fixed_isa);
3229 if (!actual_class_descriptor_sp)
3231 m_cache[slot] = actual_class_descriptor_sp;
3234 uint64_t data_payload =
3235 ((unobfuscated << m_objc_debug_taggedpointer_payload_lshift) >>
3236 m_objc_debug_taggedpointer_payload_rshift);
3237 int64_t data_payload_signed =
3238 ((int64_t)(unobfuscated << m_objc_debug_taggedpointer_payload_lshift) >>
3239 m_objc_debug_taggedpointer_payload_rshift);
3240 return std::make_unique<ClassDescriptorV2Tagged>(
3241 actual_class_descriptor_sp, data_payload, data_payload_signed);
3246 uint64_t objc_debug_taggedpointer_ext_mask,
3247 uint32_t objc_debug_taggedpointer_slot_shift,
3248 uint32_t objc_debug_taggedpointer_ext_slot_shift,
3249 uint32_t objc_debug_taggedpointer_slot_mask,
3250 uint32_t objc_debug_taggedpointer_ext_slot_mask,
3251 uint32_t objc_debug_taggedpointer_payload_lshift,
3252 uint32_t objc_debug_taggedpointer_payload_rshift,
3253 uint32_t objc_debug_taggedpointer_ext_payload_lshift,
3254 uint32_t objc_debug_taggedpointer_ext_payload_rshift,
3258 runtime, objc_debug_taggedpointer_mask,
3259 objc_debug_taggedpointer_slot_shift,
3260 objc_debug_taggedpointer_slot_mask,
3261 objc_debug_taggedpointer_payload_lshift,
3262 objc_debug_taggedpointer_payload_rshift,
3263 objc_debug_taggedpointer_classes),
3267 objc_debug_taggedpointer_ext_slot_shift),
3269 objc_debug_taggedpointer_ext_slot_mask),
3271 objc_debug_taggedpointer_ext_payload_lshift),
3273 objc_debug_taggedpointer_ext_payload_rshift),
3275 objc_debug_taggedpointer_ext_classes) {}
3279 if (!IsPossibleTaggedPointer(ptr))
3282 if (m_objc_debug_taggedpointer_ext_mask == 0)
3285 return ((ptr & m_objc_debug_taggedpointer_ext_mask) ==
3286 m_objc_debug_taggedpointer_ext_mask);
3289std::unique_ptr<ObjCLanguageRuntime::ClassDescriptor>
3292 ClassDescriptorSP actual_class_descriptor_sp;
3293 uint64_t unobfuscated = (ptr) ^ m_runtime.GetTaggedPointerObfuscator();
3295 if (!IsPossibleTaggedPointer(unobfuscated))
3298 if (!IsPossibleExtendedTaggedPointer(unobfuscated))
3301 uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_ext_slot_shift) &
3302 m_objc_debug_taggedpointer_ext_slot_mask;
3304 CacheIterator iterator = m_ext_cache.find(slot), end = m_ext_cache.end();
3305 if (iterator != end) {
3306 actual_class_descriptor_sp = iterator->second;
3308 Process *process(m_runtime.GetProcess());
3310 m_objc_debug_taggedpointer_ext_classes;
3313 if (
error.Fail() || slot_data == 0 ||
3316 actual_class_descriptor_sp =
3317 m_runtime.GetClassDescriptorFromISA((
ObjCISA)slot_data);
3318 if (!actual_class_descriptor_sp)
3320 m_ext_cache[slot] = actual_class_descriptor_sp;
3323 uint64_t data_payload = (((uint64_t)unobfuscated
3324 << m_objc_debug_taggedpointer_ext_payload_lshift) >>
3325 m_objc_debug_taggedpointer_ext_payload_rshift);
3326 int64_t data_payload_signed =
3327 ((int64_t)((uint64_t)unobfuscated
3328 << m_objc_debug_taggedpointer_ext_payload_lshift) >>
3329 m_objc_debug_taggedpointer_ext_payload_rshift);
3331 return std::make_unique<ClassDescriptorV2Tagged>(
3332 actual_class_descriptor_sp, data_payload, data_payload_signed);
3337 uint64_t objc_debug_isa_class_mask, uint64_t objc_debug_isa_magic_mask,
3338 uint64_t objc_debug_isa_magic_value,
3339 uint64_t objc_debug_indexed_isa_magic_mask,
3340 uint64_t objc_debug_indexed_isa_magic_value,
3341 uint64_t objc_debug_indexed_isa_index_mask,
3342 uint64_t objc_debug_indexed_isa_index_shift,
3357 if (!EvaluateNonPointerISA(isa, real_isa))
3359 auto cache_iter = m_cache.find(real_isa);
3360 if (cache_iter != m_cache.end())
3361 return cache_iter->second;
3362 auto descriptor_sp =
3363 m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(real_isa);
3365 m_cache[real_isa] = descriptor_sp;
3366 return descriptor_sp;
3373 LLDB_LOGF(log,
"AOCRT::NPI Evaluate(isa = 0x%" PRIx64
")", (uint64_t)isa);
3375 if ((isa & ~m_objc_debug_isa_class_mask) == 0)
3382 if (m_objc_debug_indexed_isa_magic_mask &&
3383 m_objc_debug_indexed_isa_magic_value &&
3384 m_objc_debug_indexed_isa_index_mask &&
3385 m_objc_debug_indexed_isa_index_shift && m_objc_indexed_classes) {
3386 if ((isa & ~m_objc_debug_indexed_isa_index_mask) == 0)
3389 if ((isa & m_objc_debug_indexed_isa_magic_mask) ==
3390 m_objc_debug_indexed_isa_magic_value) {
3392 uintptr_t index = (isa & m_objc_debug_indexed_isa_index_mask) >>
3393 m_objc_debug_indexed_isa_index_shift;
3398 if (index > m_indexed_isa_cache.size()) {
3400 "AOCRT::NPI (index = %" PRIu64
3401 ") exceeds cache (size = %" PRIu64
")",
3402 (uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
3404 Process *process(m_runtime.GetProcess());
3407 if (!objc_module_sp)
3412 process,
ConstString(
"objc_indexed_classes_count"), objc_module_sp,
3417 LLDB_LOGF(log,
"AOCRT::NPI (new class count = %" PRIu64
")",
3418 (uint64_t)objc_indexed_classes_count);
3420 if (objc_indexed_classes_count > m_indexed_isa_cache.size()) {
3424 auto num_new_classes =
3425 objc_indexed_classes_count - m_indexed_isa_cache.size();
3430 m_objc_indexed_classes + (m_indexed_isa_cache.size() * addr_size);
3432 last_read_class, buffer.GetBytes(), buffer.GetByteSize(),
error);
3433 if (
error.Fail() || bytes_read != buffer.GetByteSize())
3436 LLDB_LOGF(log,
"AOCRT::NPI (read new classes count = %" PRIu64
")",
3437 (uint64_t)num_new_classes);
3445 for (
unsigned i = 0; i != num_new_classes; ++i)
3446 m_indexed_isa_cache.push_back(data.
GetAddress(&offset));
3451 if (index >= m_indexed_isa_cache.size())
3454 LLDB_LOGF(log,
"AOCRT::NPI Evaluate(ret_isa = 0x%" PRIx64
")",
3455 (uint64_t)m_indexed_isa_cache[index]);
3457 ret_isa = m_indexed_isa_cache[index];
3458 return (ret_isa != 0);
3466 if ((isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value) {
3467 ret_isa = isa & m_objc_debug_isa_class_mask;
3468 return (ret_isa != 0);
3476 std::make_shared<AppleObjCTypeEncodingParser>(*
this);
3485 non_pointer_isa_cache->EvaluateNonPointerISA(isa, ret);
3494 static ConstString g_dunder_kCFBooleanFalse(
"__kCFBooleanFalse");
3495 static ConstString g_dunder_kCFBooleanTrue(
"__kCFBooleanTrue");
3496 static ConstString g_kCFBooleanFalse(
"kCFBooleanFalse");
3497 static ConstString g_kCFBooleanTrue(
"kCFBooleanTrue");
3499 static ModuleSpec corefoundation_module_spec(FileSpec(
"CoreFoundation"));
3503 corefoundation_module_spec);
3505 if (!corefoundation_module_sp)
3508 auto get_symbol = [
this, &corefoundation_module_sp](
3511 corefoundation_module_sp->FindFirstSymbolWithNameAndType(
3516 symbol = corefoundation_module_sp->FindFirstSymbolWithNameAndType(
3529 lldb::addr_t false_addr = get_symbol(g_dunder_kCFBooleanFalse, g_kCFBooleanFalse);
3530 lldb::addr_t true_addr = get_symbol(g_dunder_kCFBooleanTrue, g_kCFBooleanTrue);
3569 return std::nullopt;
3574 auto dict_up = std::make_unique<StructuredData::Dictionary>();
3575 dict_up->AddItem(
"Objective-C runtime version",
3576 std::make_unique<StructuredData::UnsignedInteger>(2));
3580#pragma mark Frame recognizers
3582class ObjCExceptionRecognizedStackFrame :
public RecognizedStackFrame {
3584 ObjCExceptionRecognizedStackFrame(
StackFrameSP frame_sp) {
3585 ThreadSP thread_sp = frame_sp->GetThread();
3586 ProcessSP process_sp = thread_sp->GetProcess();
3604 if (!abi->GetArgumentValues(*thread_sp, args))
3609 Value value(exception_addr);
3610 value.SetCompilerType(voidstar);
3617 m_arguments = std::make_shared<ValueObjectList>();
3618 m_arguments->Append(exception);
3620 m_stop_desc =
"hit Objective-C exception";
3628class ObjCExceptionThrowFrameRecognizer :
public StackFrameRecognizer {
3632 new ObjCExceptionRecognizedStackFrame(frame));
3634 std::string
GetName()
override {
3635 return "ObjC Exception Throw StackFrame Recognizer";
3641 ConstString function;
3643 std::vector<ConstString> symbols = {function};
static const char * g_get_dynamic_class_info_name
static void RegisterObjCExceptionRecognizer(Process *process)
static llvm::SmallVector< RuntimeGlobalSymbolResult > ExtractRuntimeGlobalSymbolsBatched(Process *process, const ModuleSP &module_sp, llvm::ArrayRef< RuntimeGlobalSymbolSpec > specs)
Batched version of ExtractRuntimeGlobalSymbol.
static const char * g_get_dynamic_class_info3_body
static const char * g_get_dynamic_class_info2_body
static const char * g_get_shared_cache_class_info_name
static const char * g_get_dynamic_class_info3_name
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)
static constexpr OptionDefinition g_objc_classtable_dump_options[]
static const char * g_get_shared_cache_class_info_body
static const char * g_shared_cache_class_name_funcptr
static const char * g_get_dynamic_class_info_body
static const char * g_get_dynamic_class_info2_name
static const char * g_get_shared_cache_class_info_definitions
static bool DoesProcessHaveSharedCache(Process &process)
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
#define LLDB_SCOPED_TIMER()
static llvm::StringRef GetName(XcodeSDK::Type type)
CommandObjectMultiwordObjC_ClassTable(CommandInterpreter &interpreter)
~CommandObjectMultiwordObjC_ClassTable() override=default
~CommandObjectMultiwordObjC_TaggedPointer_Info() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectMultiwordObjC_TaggedPointer_Info(CommandInterpreter &interpreter)
CommandObjectMultiwordObjC_TaggedPointer(CommandInterpreter &interpreter)
~CommandObjectMultiwordObjC_TaggedPointer() override=default
~CommandObjectMultiwordObjC() override=default
CommandObjectMultiwordObjC(CommandInterpreter &interpreter)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
OptionValueBoolean m_verbose
Options * GetOptions() override
~CommandObjectObjC_ClassTable_Dump() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectObjC_ClassTable_Dump(CommandInterpreter &interpreter)
void AdvanceToValidIndex()
RemoteNXMapTable & m_parent
const_iterator(RemoteNXMapTable &parent, int index)
lldb_private::Process * m_process
bool ParseHeader(Process *process, lldb::addr_t load_addr)
uint32_t m_num_buckets_minus_one
lldb::addr_t m_buckets_ptr
std::pair< ConstString, ObjCLanguageRuntime::ObjCISA > element
lldb::addr_t GetTableLoadAddress() const
uint32_t GetCount() const
lldb::addr_t GetBucketDataPointer() const
uint32_t GetBucketCount() const
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
void SetRawAddress(lldb::addr_t addr)
bool IsValid() const
Check if the object state is valid.
void UpdateSignature(const RemoteNXMapTable &hash_table)
bool NeedsUpdate(Process *process, AppleObjCRuntimeV2 *runtime, RemoteNXMapTable &hash_table)
lldb::addr_t m_buckets_ptr
lldb::ModuleWP m_objc_module_wp
uint64_t m_objc_debug_isa_magic_value
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)
std::vector< lldb::addr_t > m_indexed_isa_cache
uint64_t m_objc_debug_isa_magic_mask
friend class AppleObjCRuntimeV2
uint64_t m_objc_debug_indexed_isa_magic_mask
bool EvaluateNonPointerISA(ObjCISA isa, ObjCISA &ret_isa)
ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(ObjCISA isa)
lldb::addr_t m_objc_indexed_classes
uint64_t m_objc_debug_indexed_isa_index_mask
uint64_t m_objc_debug_indexed_isa_magic_value
static NonPointerISACache * CreateInstance(AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp)
uint64_t m_objc_debug_indexed_isa_index_shift
AppleObjCRuntimeV2 & m_runtime
std::map< ObjCISA, ObjCLanguageRuntime::ClassDescriptorSP > m_cache
uint64_t m_objc_debug_isa_class_mask
uint64_t m_objc_debug_taggedpointer_ext_mask
std::unique_ptr< ObjCLanguageRuntime::ClassDescriptor > GetClassDescriptor(lldb::addr_t ptr) override
uint32_t m_objc_debug_taggedpointer_ext_slot_shift
lldb::addr_t m_objc_debug_taggedpointer_ext_classes
uint32_t m_objc_debug_taggedpointer_ext_payload_lshift
uint32_t m_objc_debug_taggedpointer_ext_slot_mask
uint32_t m_objc_debug_taggedpointer_ext_payload_rshift
bool IsPossibleExtendedTaggedPointer(lldb::addr_t ptr)
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)
bool IsPossibleTaggedPointer(lldb::addr_t ptr) override
std::unique_ptr< ObjCLanguageRuntime::ClassDescriptor > GetClassDescriptor(lldb::addr_t ptr) override
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)
std::unique_ptr< ObjCLanguageRuntime::ClassDescriptor > GetClassDescriptor(lldb::addr_t ptr) override
bool IsPossibleTaggedPointer(lldb::addr_t ptr) override
static TaggedPointerVendorV2 * CreateInstance(AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp)
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateObjectChecker(std::string name, ExecutionContext &exe_ctx) override
bool m_has_objc_getRealizedClassList_trylock
bool IsTaggedPointer(lldb::addr_t ptr) override
uint32_t ParseClassInfoArray(const lldb_private::DataExtractor &data, uint32_t num_class_infos)
llvm::SmallPtrSet< ValueObject *, 8 > ValueObjectSet
bool RealizedClassGenerationCountChanged()
Update the generation count of realized classes.
static llvm::StringRef GetPluginNameStatic()
EncodingToTypeSP GetEncodingToType() override
AppleObjCRuntimeV2(Process *process, const lldb::ModuleSP &objc_module_sp)
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type, llvm::ArrayRef< uint8_t > &local_buffer) override
This call should return true if it could set the name and/or the type Sets address to the address of ...
NonPointerISACache * GetNonPointerIsaCache()
std::once_flag m_no_expanded_cache_warning
size_t GetByteOffsetForIvar(CompilerType &parent_ast_type, const char *ivar_name) override
StructuredData::ObjectSP GetLanguageSpecificData(SymbolContext sc) override
Language runtime plugins can use this API to report language-specific runtime information about this ...
lldb::addr_t m_isa_hash_table_ptr
HashTableSignature m_hash_signature
bool m_has_object_getClass
SharedCacheClassInfoExtractor m_shared_cache_class_info_extractor
DynamicClassInfoExtractor m_dynamic_class_info_extractor
lldb::addr_t GetISAHashTablePointer()
ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa) override
@ eExpressionExecutionFailure
std::unique_ptr< SharedCacheImageHeaders > m_shared_cache_image_headers_up
friend class ClassDescriptorV2
lldb::addr_t LookupRuntimeSymbol(ConstString name) override
ClassDescriptorSP GetClassDescriptor(ValueObject &valobj) override
lldb::addr_t m_relative_selector_base
void ModulesDidLoad(const ModuleList &module_list) override
Called when modules have been loaded in the process.
bool IsSharedCacheImageLoaded(uint16_t image_index)
bool HasSymbol(ConstString Name)
EncodingToTypeSP m_encoding_to_type_sp
lldb::addr_t GetSharedCacheBaseAddress()
std::once_flag m_no_classes_cached_warning
std::optional< std::pair< lldb::addr_t, lldb::addr_t > > m_CFBoolean_values
std::unique_ptr< DeclVendor > m_decl_vendor_up
uint64_t m_realized_class_generation_count
lldb::addr_t GetTaggedPointerObfuscator()
void WarnIfNoExpandedSharedCache()
ObjCISA GetPointerISA(ObjCISA isa) override
lldb::addr_t m_tagged_pointer_obfuscator
std::unique_ptr< TaggedPointerVendor > m_tagged_pointer_vendor_up
std::unique_ptr< NonPointerISACache > m_non_pointer_isa_cache_up
bool GetCFBooleanValuesIfNeeded()
lldb::addr_t GetSharedCacheReadOnlyAddress()
void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false) override
void UpdateISAToDescriptorMapIfNeeded() override
lldb::BreakpointResolverSP CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp) override
LanguageRuntime * GetPreferredLanguageRuntime(ValueObject &in_value) override
Return the preferred language runtime instance, which in most cases will be the current instance.
lldb::ModuleSP m_objc_module_sp
std::optional< uint64_t > GetSharedCacheImageHeaderVersion()
ClassDescriptorSP GetClassDescriptorImpl(ValueObject &valobj, ValueObjectSet &seen)
void WarnIfNoClassesCached(SharedCacheWarningReason reason)
static lldb_private::LanguageRuntime * CreateInstance(Process *process, lldb::LanguageType language)
DeclVendor * GetDeclVendor() override
bool m_has_objc_copyRealizedClassList
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false)
lldb::ModuleWP m_objc_module_wp
static std::tuple< FileSpec, ConstString > GetExceptionThrowLocation()
AppleObjCRuntime(Process *process)
static ObjCRuntimeVersions GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp)
bool HasReadObjCLibrary() override
lldb::ModuleSP GetObjCModule()
void ModulesDidLoad(const ModuleList &module_list) override
Called when modules have been loaded in the process.
bool CouldHaveDynamicValue(ValueObject &in_value) override
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
CommandObjectMultiword(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
friend class CommandInterpreter
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
ExecutionContext m_exe_ctx
void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormatv(const char *format, Args &&...args)
Stream & GetOutputStream()
Generic representation of a type in a programming language.
ConstString GetTypeName(bool BaseOnly=false) const
A uniqued constant string class.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * AsCString(const char *value_if_empty) const
Get the string value as a C string.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
A class to manage flag bits.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
A plug-in interface definition class for dynamic loaders.
void SetUnwindOnError(bool unwind=false)
void SetTryAllThreads(bool try_others=true)
void SetTimeout(const Timeout< std::micro > &timeout)
void SetStopOthers(bool stop_others=true)
void SetIsForUtilityExpr(bool b)
void SetIgnoreBreakpoints(bool ignore=false)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
Target & GetTargetRef() const
Returns a reference to the target object.
llvm::StringRef GetFilename() const
Filename string const get accessor.
ValueList GetArgumentValues() const
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.
bool WriteFunctionArguments(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, DiagnosticManager &diagnostic_manager)
Insert the default function argument struct.
void PutCString(const char *cstr)
A collection class for Module objects.
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
Finds the first module whose file specification matches module_spec.
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
virtual std::unique_ptr< ClassDescriptor > GetClassDescriptor(lldb::addr_t ptr)=0
virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr)=0
uint32_t m_isa_to_descriptor_stop_id
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp)
std::pair< ISAToDescriptorIterator, ISAToDescriptorIterator > GetDescriptorIteratorPair(bool update_if_needed=true)
virtual TaggedPointerVendor * GetTaggedPointerVendor()
lldb::TypeSP LookupInCompleteClassCache(ConstString &name)
ClassDescriptorSP GetNonKVOClassDescriptor(ValueObject &in_value)
virtual ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa)
bool ISAIsCached(ObjCISA isa) const
static ObjCLanguageRuntime * Get(Process &process)
virtual ClassDescriptorSP GetClassDescriptorFromClassName(ConstString class_name)
static lldb::BreakpointPreconditionSP GetBreakpointExceptionPrecondition(lldb::LanguageType language, bool throw_bp)
std::shared_ptr< EncodingToType > EncodingToTypeSP
A plug-in interface definition class for object file parsers.
bool IsInMemory() const
Returns true if the object file exists only in memory.
A command line option parsing protocol class.
std::vector< Option > m_getopt_table
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
std::chrono::seconds GetUtilityExpressionTimeout() const
A plug-in interface definition class for debugging a process.
ThreadList & GetThreadList()
lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error)
The public interface to allocating memory in the process.
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
llvm::SmallVector< std::optional< uint64_t > > ReadUnsignedIntegersFromMemory(llvm::ArrayRef< lldb::addr_t > addresses, unsigned byte_size)
Use Process::ReadMemoryRanges to efficiently read multiple unsigned integers from memory at once.
lldb::ByteOrder GetByteOrder() const
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.
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Status DeallocateMemory(lldb::addr_t ptr)
The public interface to deallocating memory in the process.
uint32_t GetAddressByteSize() const
uint32_t GetStopID() const
size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error)
Write memory to a process.
virtual DynamicLoader * GetDynamicLoader()
Get the dynamic loader plug-in for this process.
llvm::SmallVector< llvm::MutableArrayRef< uint8_t > > ReadMemoryRanges(llvm::ArrayRef< Range< lldb::addr_t, size_t > > ranges, llvm::MutableArrayRef< uint8_t > buffer)
Read from multiple memory ranges and write the results into buffer.
const lldb::ABISP & GetABI()
Target & GetTarget()
Get the target object pointer for this module.
unsigned long long ULongLong(unsigned long long fail_value=0) const
unsigned long ULong(unsigned long fail_value=0) const
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
lldb::SectionSP FindSectionByName(llvm::StringRef section_name) const
void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, ConstString module, llvm::ArrayRef< ConstString > symbols, Mangled::NamePreference symbol_mangling, bool first_instruction_only=true)
Add a new recognizer that triggers on a given symbol name.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
bool Success() const
Test for success condition.
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes to the stream.
ObjectSP GetValueForKey(llvm::StringRef key) const
std::shared_ptr< Object > ObjectSP
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
uint32_t GetSize() const
Get accessor for a symbol context list size.
Defines a symbol context baton that can be handed other debug core functions.
Symbol * symbol
The Symbol for a given query.
lldb::addr_t GetLoadAddress(Target *target) const
bool ValueIsAddress() const
Address & GetAddressRef()
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Debugger & GetDebugger() const
StackFrameRecognizerManager & GetFrameRecognizerManager()
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.
lldb::PlatformSP GetPlatform()
const ModuleList & GetImages() const
Get accessor for the images for this process.
lldb::ThreadSP GetExpressionExecutionThread()
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
void SetName(ConstString type_name)
void SetCompilerType(CompilerType compiler_type)
void SetTypeSP(lldb::TypeSP type_sp)
"lldb/Expression/UtilityFunction.h" Encapsulates a bit of source code that provides a function that i...
FunctionCaller * GetFunctionCaller()
void PushValue(const Value &value)
Value * GetValueAtIndex(size_t idx)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS, ValueObjectManager *manager=nullptr)
These routines create ValueObjectConstResult ValueObjects from various data sources.
static lldb::ValueObjectSP Create(ValueObject &parent, lldb::ValueType type)
lldb::ProcessSP GetProcessSP() const
virtual bool IsBaseClass()
lldb::TargetSP GetTargetSP() const
CompilerType GetCompilerType()
AddrAndType GetPointerValue()
virtual ValueObject * GetParent()
const ExecutionContextRef & GetExecutionContextRef() const
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
ValueType
Type that describes Value::m_value.
@ Scalar
A raw scalar value.
void SetCompilerType(const CompilerType &compiler_type)
void SetValueType(ValueType value_type)
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_INVALID_MODULE_VERSION
#define UNUSED_IF_ASSERT_DISABLED(x)
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_IVAR_OFFSET
llvm::Error exception(const char *s=nullptr)
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
const Scalar operator*(Scalar lhs, Scalar rhs)
bool operator!=(const Address &lhs, const Address &rhs)
@ eDynamicClassInfoHelperCopyRealizedClassList
@ eDynamicClassInfoHelperGetRealizedClassList
@ eDynamicClassInfoHelperAuto
@ eDynamicClassInfoHelperRealizedClassesStruct
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::RecognizedStackFrame > RecognizedStackFrameSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Platform > PlatformSP
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeObjC
Objective-C.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Process > ProcessSP
@ eEncodingUint
unsigned integer
@ eReturnStatusSuccessFinishResult
@ eArgTypeRegularExpression
@ eValueTypeVariableArgument
function argument variables
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
std::shared_ptr< lldb_private::StackFrameRecognizer > StackFrameRecognizerSP
std::shared_ptr< lldb_private::Section > SectionSP
bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
std::shared_ptr< lldb_private::Module > ModuleSP
static DescriptorMapUpdateResult Fail()
static DescriptorMapUpdateResult Success(uint32_t found)
static DescriptorMapUpdateResult Retry()
static lldb::addr_t ToRawAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, Status *error_ptr)
As for ToAddress but do not remove non-address bits from the result.
lldb::user_id_t GetID() const
Get accessor for the user ID.