diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 10512a97ad69c..b4b6c8bf74861 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -2967,11 +2967,13 @@ bool AppleObjCRuntimeV2::GetCFBooleanValuesIfNeeded() { if (m_CFBoolean_values) return true; - static ConstString g_kCFBooleanFalse("__kCFBooleanFalse"); - static ConstString g_kCFBooleanTrue("__kCFBooleanTrue"); + static ConstString g___kCFBooleanFalse("__kCFBooleanFalse"); + static ConstString g___kCFBooleanTrue("__kCFBooleanTrue"); + static ConstString g_kCFBooleanFalse("kCFBooleanFalse"); + static ConstString g_kCFBooleanTrue("kCFBooleanTrue"); - std::function get_symbol = - [this](ConstString sym) -> lldb::addr_t { + std::function get_symbol = + [this](ConstString sym, ConstString real_sym) -> lldb::addr_t { SymbolContextList sc_list; GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType( sym, lldb::eSymbolTypeData, sc_list); @@ -2981,12 +2983,26 @@ bool AppleObjCRuntimeV2::GetCFBooleanValuesIfNeeded() { if (sc.symbol) return sc.symbol->GetLoadAddress(&GetProcess()->GetTarget()); } + GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType( + real_sym, lldb::eSymbolTypeData, sc_list); + if (sc_list.GetSize() != 1) + return LLDB_INVALID_ADDRESS; - return LLDB_INVALID_ADDRESS; + SymbolContext sc; + sc_list.GetContextAtIndex(0, sc); + if (!sc.symbol) + return LLDB_INVALID_ADDRESS; + + lldb::addr_t addr = sc.symbol->GetLoadAddress(&GetProcess()->GetTarget()); + Status error; + addr = GetProcess()->ReadPointerFromMemory(addr, error); + if (error.Fail()) + return LLDB_INVALID_ADDRESS; + return addr; }; - lldb::addr_t false_addr = get_symbol(g_kCFBooleanFalse); - lldb::addr_t true_addr = get_symbol(g_kCFBooleanTrue); + lldb::addr_t false_addr = get_symbol(g___kCFBooleanFalse, g_kCFBooleanFalse); + lldb::addr_t true_addr = get_symbol(g___kCFBooleanTrue, g_kCFBooleanTrue); return (m_CFBoolean_values = {false_addr, true_addr}).operator bool(); }