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> 

llvm-svn: 322418
This commit is contained in:
Jason Molenda 2018-01-12 22:42:45 +00:00
parent 0d29aaf628
commit 9f0115fe1c
2 changed files with 47 additions and 37 deletions

View File

@ -333,28 +333,9 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
std::string DBGBuildSourcePath; std::string DBGBuildSourcePath;
std::string DBGSourcePath; std::string DBGSourcePath;
cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict, // If DBGVersion value 2 or higher, look for
CFSTR("DBGBuildSourcePath")); // DBGSourcePathRemapping dictionary and append the key-value pairs
if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) { // to our remappings.
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);
}
cf_dict = (CFDictionaryRef)CFDictionaryGetValue( cf_dict = (CFDictionaryRef)CFDictionaryGetValue(
(CFDictionaryRef)uuid_dict, CFSTR("DBGSourcePathRemapping")); (CFDictionaryRef)uuid_dict, CFSTR("DBGSourcePathRemapping"));
if (cf_dict && CFGetTypeID(cf_dict) == CFDictionaryGetTypeID()) { if (cf_dict && CFGetTypeID(cf_dict) == CFDictionaryGetTypeID()) {
@ -439,6 +420,32 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
free(values); 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; return success;
} }

View File

@ -179,21 +179,6 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
std::string DBGBuildSourcePath; std::string DBGBuildSourcePath;
std::string DBGSourcePath; 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 // DBGSourcePathRemapping is a dictionary in the plist
// with // with
// keys which are DBGBuildSourcePath file paths and // keys which are DBGBuildSourcePath file paths and
@ -287,6 +272,24 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
return true; 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);
}
} }
} }
} }