95 llvm::dyn_cast_or_null<ObjectFileMachO>(module_sp->GetObjectFile());
100 Timer scoped_timer(func_cat,
101 "SymbolVendorMacOSX::CreateInstance (module = %s)",
102 module_sp->GetFileSpec().GetPath().c_str());
110 "SymbolVendorMacOSX::CreateInstance() locate dSYM");
113 "SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM",
114 module_sp->GetFileSpec().GetPath().c_str());
118 FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec());
126 if (!dsym_fspec && module_sp->GetObjectFile()->CalculateType() !=
132 file_spec = module_sp->GetFileSpec();
134 ModuleSpec module_spec(file_spec, module_sp->GetArchitecture());
135 module_spec.
GetUUID() = module_sp->GetUUID();
139 module_spec, search_paths, module_sp->GetSymbolLocatorStatistics());
141 module_sp->GetSourceMappingList().Append(
147 std::string dsym_root = dsym_fspec.
GetPath();
148 const size_t pos = dsym_root.find(
"/Contents/Resources/");
149 dsym_root = pos != std::string::npos ? dsym_root.substr(0, pos) :
"";
156 dsym_file_data_sp, dsym_file_data_offset);
160 if (dsym_objfile_sp && !module_sp->GetSymbolFileFileSpec()) {
161 module_sp->SetSymbolFileFileSpec(dsym_fspec);
163 if (
UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm)) {
166 if (module_sp->GetSourceMappingList().IsEmpty()) {
170 if (!uuid_str.empty() && !dsym_root.empty()) {
171 char dsym_uuid_plist_path[
PATH_MAX];
172 snprintf(dsym_uuid_plist_path,
sizeof(dsym_uuid_plist_path),
173 "%s/Contents/Resources/%s.plist", dsym_root.c_str(),
175 FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path);
179 std::string DBGBuildSourcePath;
180 std::string DBGSourcePath;
188 if (plist_sp.get() && plist_sp->GetAsDictionary() &&
189 plist_sp->GetAsDictionary()->HasKey(
190 "DBGSourcePathRemapping") &&
191 plist_sp->GetAsDictionary()
192 ->GetValueForKey(
"DBGSourcePathRemapping")
193 ->GetAsDictionary()) {
205 bool new_style_source_remapping_dictionary =
false;
206 bool do_truncate_remapping_names =
false;
207 std::string original_DBGSourcePath_value = DBGSourcePath;
208 if (plist_sp->GetAsDictionary()->HasKey(
"DBGVersion")) {
209 std::string version_string =
210 std::string(plist_sp->GetAsDictionary()
211 ->GetValueForKey(
"DBGVersion")
212 ->GetStringValue(
""));
213 if (!version_string.empty() &&
214 isdigit(version_string[0])) {
215 int version_number = atoi(version_string.c_str());
216 if (version_number > 1) {
217 new_style_source_remapping_dictionary =
true;
219 if (version_number == 2) {
220 do_truncate_remapping_names =
true;
230 [&module_sp, new_style_source_remapping_dictionary,
231 original_DBGSourcePath_value,
232 do_truncate_remapping_names](
235 if (
object && object->GetAsString()) {
239 std::string DBGSourcePath =
240 std::string(object->GetStringValue());
241 if (!new_style_source_remapping_dictionary &&
242 !original_DBGSourcePath_value.empty()) {
243 DBGSourcePath = original_DBGSourcePath_value;
245 module_sp->GetSourceMappingList().Append(
246 key, DBGSourcePath,
true);
253 if (do_truncate_remapping_names) {
255 FileSpec source_path(DBGSourcePath.c_str());
260 module_sp->GetSourceMappingList().Append(
275 if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) {
276 module_sp->GetSourceMappingList().Append(
277 DBGBuildSourcePath, DBGSourcePath,
true);
287 return symbol_vendor;
296 return symbol_vendor;