forked from OSchip/llvm-project
Revert "Fixing a subtle issue on Mac OS X systems with dSYMs..."
This reverts commit r248985, as it was breaking all remote expression-evaluating tests (on android at least). llvm-svn: 248995
This commit is contained in:
parent
2bfb7cbddb
commit
746ffd6980
|
@ -29,7 +29,7 @@ public:
|
|||
// Locating the file should happen only on the local computer or using
|
||||
// the current computers global settings.
|
||||
//----------------------------------------------------------------------
|
||||
static ModuleSpec
|
||||
static FileSpec
|
||||
LocateExecutableObjectFile (const ModuleSpec &module_spec);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -1045,19 +1045,19 @@ ModuleList::GetSharedModule
|
|||
|
||||
// Fixup the incoming path in case the path points to a valid file, yet
|
||||
// the arch or UUID (if one was passed in) don't match.
|
||||
ModuleSpec located_binary_modulespec = Symbols::LocateExecutableObjectFile (module_spec);
|
||||
FileSpec file_spec = Symbols::LocateExecutableObjectFile (module_spec);
|
||||
|
||||
// Don't look for the file if it appears to be the same one we already
|
||||
// checked for above...
|
||||
if (located_binary_modulespec.GetFileSpec() != module_file_spec)
|
||||
if (file_spec != module_file_spec)
|
||||
{
|
||||
if (!located_binary_modulespec.GetFileSpec().Exists())
|
||||
if (!file_spec.Exists())
|
||||
{
|
||||
located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
|
||||
file_spec.GetPath(path, sizeof(path));
|
||||
if (path[0] == '\0')
|
||||
module_file_spec.GetPath(path, sizeof(path));
|
||||
// How can this check ever be true? This branch it is false, and we haven't modified file_spec.
|
||||
if (located_binary_modulespec.GetFileSpec().Exists())
|
||||
if (file_spec.Exists())
|
||||
{
|
||||
std::string uuid_str;
|
||||
if (uuid_ptr && uuid_ptr->IsValid())
|
||||
|
@ -1084,8 +1084,9 @@ ModuleList::GetSharedModule
|
|||
// Make sure no one else can try and get or create a module while this
|
||||
// function is actively working on it by doing an extra lock on the
|
||||
// global mutex list.
|
||||
ModuleSpec platform_module_spec(located_binary_modulespec);
|
||||
platform_module_spec.GetPlatformFileSpec() = located_binary_modulespec.GetFileSpec();
|
||||
ModuleSpec platform_module_spec(module_spec);
|
||||
platform_module_spec.GetFileSpec() = file_spec;
|
||||
platform_module_spec.GetPlatformFileSpec() = file_spec;
|
||||
ModuleList matching_module_list;
|
||||
if (shared_module_list.FindModules (platform_module_spec, matching_module_list) > 0)
|
||||
{
|
||||
|
@ -1095,7 +1096,7 @@ ModuleList::GetSharedModule
|
|||
// then we should make sure the modification time hasn't changed!
|
||||
if (platform_module_spec.GetUUIDPtr() == NULL)
|
||||
{
|
||||
TimeValue file_spec_mod_time(located_binary_modulespec.GetFileSpec().GetModificationTime());
|
||||
TimeValue file_spec_mod_time(file_spec.GetModificationTime());
|
||||
if (file_spec_mod_time.IsValid())
|
||||
{
|
||||
if (file_spec_mod_time != module_sp->GetModificationTime())
|
||||
|
@ -1124,9 +1125,9 @@ ModuleList::GetSharedModule
|
|||
}
|
||||
else
|
||||
{
|
||||
located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
|
||||
file_spec.GetPath(path, sizeof(path));
|
||||
|
||||
if (located_binary_modulespec.GetFileSpec())
|
||||
if (file_spec)
|
||||
{
|
||||
if (arch.IsValid())
|
||||
error.SetErrorStringWithFormat("unable to open %s architecture in '%s'", arch.GetArchitectureName(), path);
|
||||
|
|
|
@ -38,7 +38,8 @@ int
|
|||
LocateMacOSXFilesUsingDebugSymbols
|
||||
(
|
||||
const ModuleSpec &module_spec,
|
||||
ModuleSpec &return_module_spec
|
||||
FileSpec *out_exec_fspec, // If non-NULL, try and find the executable
|
||||
FileSpec *out_dsym_fspec // If non-NULL try and find the debug symbol file
|
||||
);
|
||||
|
||||
#else
|
||||
|
@ -47,7 +48,8 @@ int
|
|||
LocateMacOSXFilesUsingDebugSymbols
|
||||
(
|
||||
const ModuleSpec &module_spec,
|
||||
ModuleSpec &return_module_spec
|
||||
FileSpec *out_exec_fspec, // If non-NULL, try and find the executable
|
||||
FileSpec *out_dsym_fspec // If non-NULL try and find the debug symbol file
|
||||
) {
|
||||
// Cannot find MacOSX files using debug symbols on non MacOSX.
|
||||
return 0;
|
||||
|
@ -176,25 +178,19 @@ LocateExecutableSymbolFileDsym (const ModuleSpec &module_spec)
|
|||
(const void*)uuid);
|
||||
|
||||
FileSpec symbol_fspec;
|
||||
ModuleSpec dsym_module_spec;
|
||||
// First try and find the dSYM in the same directory as the executable or in
|
||||
// an appropriate parent directory
|
||||
if (LocateDSYMInVincinityOfExecutable (module_spec, symbol_fspec) == false)
|
||||
{
|
||||
// We failed to easily find the dSYM above, so use DebugSymbols
|
||||
LocateMacOSXFilesUsingDebugSymbols (module_spec, dsym_module_spec);
|
||||
LocateMacOSXFilesUsingDebugSymbols (module_spec, NULL, &symbol_fspec);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsym_module_spec.GetSymbolFileSpec() = symbol_fspec;
|
||||
}
|
||||
return dsym_module_spec.GetSymbolFileSpec();
|
||||
return symbol_fspec;
|
||||
}
|
||||
|
||||
ModuleSpec
|
||||
FileSpec
|
||||
Symbols::LocateExecutableObjectFile (const ModuleSpec &module_spec)
|
||||
{
|
||||
ModuleSpec result = module_spec;
|
||||
const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
|
||||
const ArchSpec *arch = module_spec.GetArchitecturePtr();
|
||||
const UUID *uuid = module_spec.GetUUIDPtr();
|
||||
|
@ -204,19 +200,20 @@ Symbols::LocateExecutableObjectFile (const ModuleSpec &module_spec)
|
|||
arch ? arch->GetArchitectureName() : "<NULL>",
|
||||
(const void*)uuid);
|
||||
|
||||
FileSpec objfile_fspec;
|
||||
ModuleSpecList module_specs;
|
||||
ModuleSpec matched_module_spec;
|
||||
if (exec_fspec &&
|
||||
ObjectFile::GetModuleSpecifications(*exec_fspec, 0, 0, module_specs) &&
|
||||
module_specs.FindMatchingModuleSpec(module_spec, matched_module_spec))
|
||||
{
|
||||
result.GetFileSpec() = exec_fspec;
|
||||
objfile_fspec = exec_fspec;
|
||||
}
|
||||
else
|
||||
{
|
||||
LocateMacOSXFilesUsingDebugSymbols (module_spec, result);
|
||||
LocateMacOSXFilesUsingDebugSymbols (module_spec, &objfile_fspec, NULL);
|
||||
}
|
||||
return result;
|
||||
return objfile_fspec;
|
||||
}
|
||||
|
||||
FileSpec
|
||||
|
|
|
@ -55,15 +55,18 @@ int
|
|||
LocateMacOSXFilesUsingDebugSymbols
|
||||
(
|
||||
const ModuleSpec &module_spec,
|
||||
ModuleSpec &return_module_spec
|
||||
FileSpec *out_exec_fspec, // If non-NULL, try and find the executable
|
||||
FileSpec *out_dsym_fspec // If non-NULL try and find the debug symbol file
|
||||
)
|
||||
{
|
||||
return_module_spec = module_spec;
|
||||
return_module_spec.GetFileSpec().Clear();
|
||||
return_module_spec.GetSymbolFileSpec().Clear();
|
||||
|
||||
int items_found = 0;
|
||||
|
||||
if (out_exec_fspec)
|
||||
out_exec_fspec->Clear();
|
||||
|
||||
if (out_dsym_fspec)
|
||||
out_dsym_fspec->Clear();
|
||||
|
||||
#if !defined (__arm__) && !defined (__arm64__) && !defined (__aarch64__) // No DebugSymbols on the iOS devices
|
||||
|
||||
const UUID *uuid = module_spec.GetUUIDPtr();
|
||||
|
@ -107,11 +110,30 @@ LocateMacOSXFilesUsingDebugSymbols
|
|||
strlen(exec_cf_path),
|
||||
FALSE));
|
||||
}
|
||||
if (log)
|
||||
{
|
||||
std::string searching_for;
|
||||
if (out_exec_fspec && out_dsym_fspec)
|
||||
{
|
||||
searching_for = "executable binary and dSYM";
|
||||
}
|
||||
else if (out_exec_fspec)
|
||||
{
|
||||
searching_for = "executable binary";
|
||||
}
|
||||
else
|
||||
{
|
||||
searching_for = "dSYM bundle";
|
||||
}
|
||||
log->Printf ("Calling DebugSymbols framework to locate dSYM bundle for UUID %s, searching for %s", uuid->GetAsString().c_str(), searching_for.c_str());
|
||||
}
|
||||
|
||||
CFCReleaser<CFURLRef> dsym_url (::DBGCopyFullDSYMURLForUUID(module_uuid_ref.get(), exec_url.get()));
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (dsym_url.get())
|
||||
{
|
||||
if (out_dsym_fspec)
|
||||
{
|
||||
if (::CFURLGetFileSystemRepresentation (dsym_url.get(), true, (UInt8*)path, sizeof(path)-1))
|
||||
{
|
||||
|
@ -119,20 +141,23 @@ LocateMacOSXFilesUsingDebugSymbols
|
|||
{
|
||||
log->Printf ("DebugSymbols framework returned dSYM path of %s for UUID %s -- looking for the dSYM", path, uuid->GetAsString().c_str());
|
||||
}
|
||||
FileSpec dsym_filespec(path, path[0] == '~');
|
||||
out_dsym_fspec->SetFile(path, path[0] == '~');
|
||||
|
||||
if (dsym_filespec.GetFileType () == FileSpec::eFileTypeDirectory)
|
||||
if (out_dsym_fspec->GetFileType () == FileSpec::eFileTypeDirectory)
|
||||
{
|
||||
dsym_filespec = Symbols::FindSymbolFileInBundle (dsym_filespec, uuid, arch);
|
||||
*out_dsym_fspec = Symbols::FindSymbolFileInBundle (*out_dsym_fspec, uuid, arch);
|
||||
if (*out_dsym_fspec)
|
||||
++items_found;
|
||||
}
|
||||
else
|
||||
{
|
||||
++items_found;
|
||||
}
|
||||
return_module_spec.GetSymbolFileSpec() = dsym_filespec;
|
||||
}
|
||||
}
|
||||
|
||||
if (out_exec_fspec)
|
||||
{
|
||||
bool success = false;
|
||||
if (log)
|
||||
{
|
||||
|
@ -142,7 +167,6 @@ LocateMacOSXFilesUsingDebugSymbols
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
CFCReleaser<CFDictionaryRef> dict(::DBGCopyDSYMPropertyLists (dsym_url.get()));
|
||||
CFDictionaryRef uuid_dict = NULL;
|
||||
if (dict.get())
|
||||
|
@ -160,12 +184,9 @@ LocateMacOSXFilesUsingDebugSymbols
|
|||
log->Printf ("plist bundle has exec path of %s for UUID %s", path, uuid->GetAsString().c_str());
|
||||
}
|
||||
++items_found;
|
||||
FileSpec exec_filespec (path, path[0] == '~');
|
||||
if (exec_filespec.Exists())
|
||||
{
|
||||
out_exec_fspec->SetFile(path, path[0] == '~');
|
||||
if (out_exec_fspec->Exists())
|
||||
success = true;
|
||||
return_module_spec.GetFileSpec() = exec_filespec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +222,7 @@ LocateMacOSXFilesUsingDebugSymbols
|
|||
|
||||
{
|
||||
++items_found;
|
||||
return_module_spec.GetFileSpec() = bundle_exe_file_spec;
|
||||
*out_exec_fspec = bundle_exe_file_spec;
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("Executable binary %s next to dSYM is compatible; using", path);
|
||||
|
@ -226,7 +247,7 @@ LocateMacOSXFilesUsingDebugSymbols
|
|||
|
||||
{
|
||||
++items_found;
|
||||
return_module_spec.GetFileSpec() = file_spec;
|
||||
*out_exec_fspec = file_spec;
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("Executable binary %s next to dSYM is compatible; using", path);
|
||||
|
@ -241,6 +262,7 @@ LocateMacOSXFilesUsingDebugSymbols
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // #if !defined (__arm__) && !defined (__arm64__) && !defined (__aarch64__)
|
||||
|
||||
return items_found;
|
||||
|
|
|
@ -321,13 +321,7 @@ ProcessKDP::DoConnectRemote (Stream *strm, const char *remote_url)
|
|||
// Lookup UUID locally, before attempting dsymForUUID like action
|
||||
module_spec.GetSymbolFileSpec() = Symbols::LocateExecutableSymbolFile(module_spec);
|
||||
if (module_spec.GetSymbolFileSpec())
|
||||
{
|
||||
ModuleSpec executable_module_spec = Symbols::LocateExecutableObjectFile (module_spec);
|
||||
if (executable_module_spec.GetFileSpec().Exists())
|
||||
{
|
||||
module_spec.GetFileSpec() = executable_module_spec.GetFileSpec();
|
||||
}
|
||||
}
|
||||
module_spec.GetFileSpec() = Symbols::LocateExecutableObjectFile (module_spec);
|
||||
if (!module_spec.GetSymbolFileSpec() || !module_spec.GetSymbolFileSpec())
|
||||
Symbols::DownloadObjectAndSymbolFile (module_spec, true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue