Author: flackr Date: Thu May 21 10:44:24 2015 New Revision: 237907 URL: http://llvm.org/viewvc/llvm-project?rev=237907&view=rev Log: Only check for matching arch and UUID when looking for dsym in vincinity of executable.
ModuleSpecs::FindMatchingModuleSpec looks for matching filenames but when looking for the dSYM we should only be looking for a matching architecture and and UUID. Jason pointed out this mistake in http://reviews.llvm.org/D9174 when this function was incorrectly converted to not be Mac specific. Test Plan: Running LLDB on test/lang/c/shared_lib_stripped_symbols/a.out in a debugger I've verified LocateDSYMInVincinityOfExecutable correctly locates the matching dSYM. Differential Revision: http://reviews.llvm.org/D9896 Modified: lldb/trunk/source/Host/common/Symbols.cpp Modified: lldb/trunk/source/Host/common/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=237907&r1=237906&r2=237907&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Symbols.cpp (original) +++ lldb/trunk/source/Host/common/Symbols.cpp Thu May 21 10:44:24 2015 @@ -57,6 +57,26 @@ LocateMacOSXFilesUsingDebugSymbols #endif static bool +FileAtPathContainsArchAndUUID (const FileSpec &file_fspec, const ArchSpec *arch, const lldb_private::UUID *uuid) +{ + ModuleSpecList module_specs; + if (ObjectFile::GetModuleSpecifications(file_fspec, 0, 0, module_specs)) + { + ModuleSpec spec; + for (size_t i = 0; i < module_specs.GetSize(); ++i) + { + assert(module_specs.GetModuleSpecAtIndex(i, spec)); + if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && + (arch == NULL || (spec.GetArchitecturePtr() && spec.GetArchitecture().IsCompatibleMatch(*arch)))) + { + return true; + } + } + } + return false; +} + +static bool LocateDSYMInVincinityOfExecutable (const ModuleSpec &module_spec, FileSpec &dsym_fspec) { const FileSpec *exec_fspec = module_spec.GetFileSpecPtr(); @@ -77,8 +97,7 @@ LocateDSYMInVincinityOfExecutable (const ModuleSpecList module_specs; ModuleSpec matched_module_spec; if (dsym_fspec.Exists() && - ObjectFile::GetModuleSpecifications(dsym_fspec, 0, 0, module_specs) && - module_specs.FindMatchingModuleSpec(module_spec, matched_module_spec)) + FileAtPathContainsArchAndUUID(dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr())) { return true; } @@ -97,8 +116,7 @@ LocateDSYMInVincinityOfExecutable (const ::strncat(path, exec_fspec->GetFilename().AsCString(), sizeof(path) - strlen(path) - 1); dsym_fspec.SetFile(path, false); if (dsym_fspec.Exists() && - ObjectFile::GetModuleSpecifications(dsym_fspec, 0, 0, module_specs) && - module_specs.FindMatchingModuleSpec(module_spec, matched_module_spec)) + FileAtPathContainsArchAndUUID(dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr())) { return true; } _______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits