Skip to content

Commit 68c9ce8

Browse files
committed
[lldb] Account for objc_debug_class_getNameRaw returning NULL
On macOS Catalina, calling objc_debug_class_getNameRaw on some of the ISA pointers returns NULL, causing us to crash and unwind before reading all the Objective-C classes. This does not happen on macOS Big Sur. Account for that possibility and skip the class when that happens. (cherry picked from commit cf51bf7) (cherry picked from commit 756f6e2)
1 parent e4dea3b commit 68c9ce8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ __lldb_apple_objc_v2_get_dynamic_class_info2(void *gdb_objc_realized_classes_ptr
200200
201201
uint32_t count = 0;
202202
Class* realized_class_list = objc_copyRealizedClassList(&count);
203+
DEBUG_PRINTF ("count = %u\n", count);
203204
204205
uint32_t idx = 0;
205206
for (uint32_t i=0; i<=count; ++i)
@@ -208,6 +209,8 @@ __lldb_apple_objc_v2_get_dynamic_class_info2(void *gdb_objc_realized_classes_ptr
208209
{
209210
Class isa = realized_class_list[i];
210211
const char *name_ptr = objc_debug_class_getNameRaw(isa);
212+
if (name_ptr == NULL)
213+
continue;
211214
const char *s = name_ptr;
212215
uint32_t h = 5381;
213216
for (unsigned char c = *s; c; c = *++s)

0 commit comments

Comments
 (0)