[Lldb-commits] [lldb] r322418 - We have two sources for path remapping information that we get out

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 12 14:42:45 PST 2018


Author: jmolenda
Date: Fri Jan 12 14:42:45 2018
New Revision: 322418

URL: http://llvm.org/viewvc/llvm-project?rev=322418&view=rev
Log:
We have two sources for path remapping information that we get out
of a dSYM per-uuid plist that may be present (dsymutil does not
create this plist, it is only added after the fact by additional
tools) -- either the DBGBuildSourcePath + DBGSourcePath pair of
k-v entries which give us the build-time and debug-time remapping,
or the newer DBGSourcePathRemapping dictionary which may give us
multiple remappings.

I'm changing the order that we process these & add them to the
list of source remappings.  If the DBGSourcePathRemapping dict
is present, it should be the first entries we will try.

<rdar://problem/36481989> 


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=322418&r1=322417&r2=322418&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Symbols.cpp (original)
+++ lldb/trunk/source/Host/macosx/Symbols.cpp Fri Jan 12 14:42:45 2018
@@ -333,28 +333,9 @@ static bool GetModuleSpecInfoFromUUIDDic
     std::string DBGBuildSourcePath;
     std::string DBGSourcePath;
 
-    cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict,
-                                               CFSTR("DBGBuildSourcePath"));
-    if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
-      CFCString::FileSystemRepresentation(cf_str, DBGBuildSourcePath);
-    }
-
-    cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict,
-                                               CFSTR("DBGSourcePath"));
-    if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
-      CFCString::FileSystemRepresentation(cf_str, DBGSourcePath);
-    }
-
-    if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) {
-      if (DBGSourcePath[0] == '~') {
-        FileSpec resolved_source_path(DBGSourcePath.c_str(), true);
-        DBGSourcePath = resolved_source_path.GetPath();
-      }
-      module_spec.GetSourceMappingList().Append(
-          ConstString(DBGBuildSourcePath.c_str()),
-          ConstString(DBGSourcePath.c_str()), true);
-    }
-
+    // If DBGVersion value 2 or higher, look for
+    // DBGSourcePathRemapping dictionary and append the key-value pairs
+    // to our remappings.
     cf_dict = (CFDictionaryRef)CFDictionaryGetValue(
         (CFDictionaryRef)uuid_dict, CFSTR("DBGSourcePathRemapping"));
     if (cf_dict && CFGetTypeID(cf_dict) == CFDictionaryGetTypeID()) {
@@ -439,6 +420,32 @@ static bool GetModuleSpecInfoFromUUIDDic
           free(values);
       }
     }
+
+
+    // If we have a DBGBuildSourcePath + DBGSourcePath pair,
+    // append them to the source remappings list.
+
+    cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict,
+                                               CFSTR("DBGBuildSourcePath"));
+    if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
+      CFCString::FileSystemRepresentation(cf_str, DBGBuildSourcePath);
+    }
+
+    cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict,
+                                               CFSTR("DBGSourcePath"));
+    if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
+      CFCString::FileSystemRepresentation(cf_str, DBGSourcePath);
+    }
+
+    if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) {
+      if (DBGSourcePath[0] == '~') {
+        FileSpec resolved_source_path(DBGSourcePath.c_str(), true);
+        DBGSourcePath = resolved_source_path.GetPath();
+      }
+      module_spec.GetSourceMappingList().Append(
+          ConstString(DBGBuildSourcePath.c_str()),
+          ConstString(DBGSourcePath.c_str()), true);
+    }
   }
   return success;
 }

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=322418&r1=322417&r2=322418&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Fri Jan 12 14:42:45 2018
@@ -179,21 +179,6 @@ SymbolVendorMacOSX::CreateInstance(const
                       std::string DBGBuildSourcePath;
                       std::string DBGSourcePath;
 
-                      plist.GetValueAsString("DBGBuildSourcePath",
-                                             DBGBuildSourcePath);
-                      plist.GetValueAsString("DBGSourcePath", DBGSourcePath);
-                      if (!DBGBuildSourcePath.empty() &&
-                          !DBGSourcePath.empty()) {
-                        if (DBGSourcePath[0] == '~') {
-                          FileSpec resolved_source_path(DBGSourcePath.c_str(),
-                                                        true);
-                          DBGSourcePath = resolved_source_path.GetPath();
-                        }
-                        module_sp->GetSourceMappingList().Append(
-                            ConstString(DBGBuildSourcePath),
-                            ConstString(DBGSourcePath), true);
-                      }
-
                       // DBGSourcePathRemapping is a dictionary in the plist
                       // with
                       // keys which are DBGBuildSourcePath file paths and
@@ -287,6 +272,24 @@ SymbolVendorMacOSX::CreateInstance(const
                               return true;
                             });
                       }
+
+                      // If we have a DBGBuildSourcePath + DBGSourcePath pair,
+                      // append those to the source path remappings.
+
+                      plist.GetValueAsString("DBGBuildSourcePath",
+                                             DBGBuildSourcePath);
+                      plist.GetValueAsString("DBGSourcePath", DBGSourcePath);
+                      if (!DBGBuildSourcePath.empty() &&
+                          !DBGSourcePath.empty()) {
+                        if (DBGSourcePath[0] == '~') {
+                          FileSpec resolved_source_path(DBGSourcePath.c_str(),
+                                                        true);
+                          DBGSourcePath = resolved_source_path.GetPath();
+                        }
+                        module_sp->GetSourceMappingList().Append(
+                            ConstString(DBGBuildSourcePath),
+                            ConstString(DBGSourcePath), true);
+                      }
                     }
                   }
                 }




More information about the lldb-commits mailing list