m_non_pointer_isa_cache_ap(NonPointerISACache::CreateInstance(*this, objc_module_sp)),
m_tagged_pointer_vendor_ap(TaggedPointerVendorV2::CreateInstance(*this, objc_module_sp)),
m_encoding_to_type_sp(),
- m_noclasses_warning_emitted(false)
+ m_noclasses_warning_emitted(false),
+ m_CFBoolean_values()
{
static const ConstString g_gdb_object_getClass("gdb_object_getClass");
m_has_object_getClass =
return ret;
}
+
+bool
+AppleObjCRuntimeV2::GetCFBooleanValuesIfNeeded ()
+{
+ if (m_CFBoolean_values)
+ return true;
+
+ static ConstString g_kCFBooleanFalse("kCFBooleanFalse");
+ static ConstString g_kCFBooleanTrue("kCFBooleanTrue");
+
+ std::function<lldb::addr_t(ConstString)> get_symbol = [this] (ConstString sym) -> lldb::addr_t {
+ SymbolContextList sc_list;
+ if (GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType(g_kCFBooleanFalse, lldb::eSymbolTypeData, sc_list) == 1)
+ {
+ SymbolContext sc;
+ sc_list.GetContextAtIndex(0, sc);
+ if (sc.symbol)
+ return sc.symbol->GetLoadAddress(&GetProcess()->GetTarget());
+ }
+
+ return LLDB_INVALID_ADDRESS;
+ };
+
+ lldb::addr_t false_addr = get_symbol(g_kCFBooleanFalse);
+ lldb::addr_t true_addr = get_symbol(g_kCFBooleanTrue);
+
+ return (m_CFBoolean_values = {false_addr,true_addr}).operator bool();
+}
+
+void
+AppleObjCRuntimeV2::GetValuesForGlobalCFBooleans(lldb::addr_t& cf_true,
+ lldb::addr_t& cf_false)
+{
+ if (GetCFBooleanValuesIfNeeded())
+ {
+ cf_true = m_CFBoolean_values->second;
+ cf_false = m_CFBoolean_values->first;
+ }
+ else
+ this->AppleObjCRuntime::GetValuesForGlobalCFBooleans(cf_true, cf_false);
+}
return m_tagged_pointer_vendor_ap.get();
}
+ void
+ GetValuesForGlobalCFBooleans(lldb::addr_t& cf_true,
+ lldb::addr_t& cf_false) override;
+
// none of these are valid ISAs - we use them to infer the type
// of tagged pointers - if we have something meaningful to say
// we report an actual type - otherwise, we just say tagged
lldb::addr_t
GetSharedCacheReadOnlyAddress();
+ bool
+ GetCFBooleanValuesIfNeeded ();
+
friend class ClassDescriptorV2;
std::unique_ptr<UtilityFunction> m_get_class_info_code;
std::unique_ptr<TaggedPointerVendor> m_tagged_pointer_vendor_ap;
EncodingToTypeSP m_encoding_to_type_sp;
bool m_noclasses_warning_emitted;
+ llvm::Optional<std::pair<lldb::addr_t,
+ lldb::addr_t>> m_CFBoolean_values;
};
} // namespace lldb_private