diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp index e6b31c61837b..c428377eb7d2 100644 --- a/lldb/source/Host/macosx/Symbols.cpp +++ b/lldb/source/Host/macosx/Symbols.cpp @@ -350,15 +350,22 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, cf_dict = (CFDictionaryRef)CFDictionaryGetValue( (CFDictionaryRef)uuid_dict, CFSTR("DBGSourcePathRemapping")); if (cf_dict && CFGetTypeID(cf_dict) == CFDictionaryGetTypeID()) { - // If we see DBGVersion with any kind of value, this is a new style + // If we see DBGVersion with a value of 2 or higher, this is a new style // DBGSourcePathRemapping dictionary bool new_style_source_remapping_dictionary = false; std::string original_DBGSourcePath_value = DBGSourcePath; - const void *version_value; - version_value = - CFDictionaryGetValue((CFDictionaryRef)uuid_dict, CFSTR("DBGVersion")); - if (version_value) - new_style_source_remapping_dictionary = true; + cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict, + CFSTR("DBGVersion")); + if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) { + std::string version; + CFCString::FileSystemRepresentation(cf_str, version); + if (!version.empty() && isdigit(version[0])) { + int version_number = atoi(version.c_str()); + if (version_number > 1) { + new_style_source_remapping_dictionary = true; + } + } + } CFIndex kv_pair_count = CFDictionaryGetCount((CFDictionaryRef)uuid_dict); if (kv_pair_count > 0) { diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index 4309d32af64e..5e1953e03208 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -209,8 +209,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, // DBGSourcePath // values were incorrect. If we have a newer style // DBGSourcePathRemapping, there will be a DBGVersion - // key in the plist - // (we don't care about the value at this point). + // key in the plist with version 2 or higher. // // If this is an old style DBGSourcePathRemapping, // ignore the @@ -221,7 +220,17 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, std::string original_DBGSourcePath_value = DBGSourcePath; if (plist_sp->GetAsDictionary()->HasKey("DBGVersion")) { - new_style_source_remapping_dictionary = true; + std::string version_string = + plist_sp->GetAsDictionary() + ->GetValueForKey("DBGVersion") + ->GetStringValue(""); + if (!version_string.empty() && + isdigit(version_string[0])) { + int version_number = atoi(version_string.c_str()); + if (version_number > 1) { + new_style_source_remapping_dictionary = true; + } + } } StructuredData::Dictionary *remappings_dict =