[Lldb-commits] [lldb] r286335 - When deciding whether to use the source remapping dictionary from

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 8 19:42:12 PST 2016


Author: jmolenda
Date: Tue Nov  8 21:42:12 2016
New Revision: 286335

URL: http://llvm.org/viewvc/llvm-project?rev=286335&view=rev
Log:
When deciding whether to use the source remapping dictionary from 
a dSYM per-uuid plist, only use it when the DBGVersion key has a
value of 2 or greater.

<rdar://problem/28889578> 
<rdar://problem/29131339> 

Modified:
    lldb/trunk/source/Host/macosx/Symbols.cpp
    lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp

Modified: lldb/trunk/source/Host/macosx/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=286335&r1=286334&r2=286335&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Symbols.cpp (original)
+++ lldb/trunk/source/Host/macosx/Symbols.cpp Tue Nov  8 21:42:12 2016
@@ -350,15 +350,22 @@ static bool GetModuleSpecInfoFromUUIDDic
     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) {

Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=286335&r1=286334&r2=286335&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Tue Nov  8 21:42:12 2016
@@ -209,8 +209,7 @@ SymbolVendorMacOSX::CreateInstance(const
                         // 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
                         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 =




More information about the lldb-commits mailing list