[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.
GitOrigin-RevId: cf51bf77b070f63391bacada5e166bfec2616989
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 6b65ace..debdfea 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -200,6 +200,7 @@
uint32_t count = 0;
Class* realized_class_list = objc_copyRealizedClassList(&count);
+ DEBUG_PRINTF ("count = %u\n", count);
uint32_t idx = 0;
for (uint32_t i=0; i<=count; ++i)
@@ -208,6 +209,8 @@
{
Class isa = realized_class_list[i];
const char *name_ptr = objc_debug_class_getNameRaw(isa);
+ if (name_ptr == NULL)
+ continue;
const char *s = name_ptr;
uint32_t h = 5381;
for (unsigned char c = *s; c; c = *++s)