return false;
}
- bool ios_simulator_compatible = false;
- // Check for iOS desktop simulator matches where:
- // x86_64-apple-ios is compatible with x86_64-apple-macosx
- // i386-apple-ios is compatible with i386-apple-macosx
- if (lhs_triple_vendor == llvm::Triple::Apple)
- {
- const llvm::Triple::ArchType lhs_arch = lhs_triple.getArch();
- if (lhs_arch == llvm::Triple::x86_64 ||
- lhs_arch == llvm::Triple::x86)
- {
- if ((lhs_triple_os == llvm::Triple::MacOSX && rhs_triple_os == llvm::Triple::IOS ) ||
- (lhs_triple_os == llvm::Triple::IOS && rhs_triple_os == llvm::Triple::MacOSX ))
- {
- ios_simulator_compatible = true;
- }
-
- }
- }
-
- // Only fail if both os types are not unknown or if we determined the triples
- // match for x86_64 or x86 iOS simulator
- if (!ios_simulator_compatible)
- {
- if (lhs_triple_os != llvm::Triple::UnknownOS &&
- rhs_triple_os != llvm::Triple::UnknownOS)
- return false;
- }
+ // Only fail if both os types are not unknown
+ if (lhs_triple_os != llvm::Triple::UnknownOS &&
+ rhs_triple_os != llvm::Triple::UnknownOS)
+ return false;
}
const llvm::Triple::EnvironmentType lhs_triple_env = lhs_triple.getEnvironment();
mCPU,
mAttrs);
+ m_failed_lookups.clear();
+
m_execution_engine_ap.reset(builder.create(target_machine));
if (!m_execution_engine_ap.get())
Target &target = m_process->GetTarget();
const ModuleList &target_images = target.GetImages();
- ModuleSpec module_spec (image_info.file_spec, image_info.GetArchitecture ());
+ ModuleSpec module_spec (image_info.file_spec);
module_spec.GetUUID() = image_info.uuid;
ModuleSP module_sp (target_images.FindFirstModule (module_spec));
ArchSpec platform_arch;
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
{
-
- error = ModuleList::GetSharedModule (module_spec,
- exe_module_sp,
- NULL,
- NULL,
- NULL);
- // Did we find an executable using one of the
- if (error.Success())
+ // Only match x86 with x86 and x86_64 with x86_64...
+ if (!exe_arch.IsValid() || exe_arch.GetCore() == module_spec.GetArchitecture().GetCore())
{
- if (exe_module_sp && exe_module_sp->GetObjectFile())
- break;
- else
- error.SetErrorToGenericError();
+ error = ModuleList::GetSharedModule (module_spec,
+ exe_module_sp,
+ NULL,
+ NULL,
+ NULL);
+ // Did we find an executable using one of the
+ if (error.Success())
+ {
+ if (exe_module_sp && exe_module_sp->GetObjectFile())
+ break;
+ else
+ error.SetErrorToGenericError();
+ }
+
+ if (idx > 0)
+ arch_names.PutCString (", ");
+ arch_names.PutCString (platform_arch.GetArchitectureName());
}
-
- if (idx > 0)
- arch_names.PutCString (", ");
- arch_names.PutCString (platform_arch.GetArchitectureName());
}
if (error.Fail() || !exe_module_sp)
{
// 32/64: return "x86_64-apple-macosx" for architecture 1
arch = platform_arch64;
+ return true;
}
else if (idx == 2 || idx == 3)
{
{
// This macosx platform supports only 32 bit, so return the *-apple-macosx version
arch = platform_arch;
+ return true;
}
}
return false;
// use the debug map, to add new sections to each .o file and
// even though a .o file might not have changed, the sections
// that get added to the .o file can change.
+ ArchSpec oso_arch;
+ // Only adopt the architecture from the module (not the vendor or OS)
+ // since .o files for "i386-apple-ios" will historically show up as "i386-apple-macosx"
+ // due to the lack of a LC_VERSION_MIN_MACOSX or LC_VERSION_MIN_IPHONEOS
+ // load command...
+ oso_arch.SetTriple(m_obj_file->GetModule()->GetArchitecture().GetTriple().getArchName().str().c_str());
comp_unit_info->oso_sp->module_sp.reset (new DebugMapModule (obj_file->GetModule(),
GetCompUnitInfoIndex(comp_unit_info),
oso_file,
- m_obj_file->GetModule()->GetArchitecture(),
+ oso_arch,
oso_object ? &oso_object : NULL,
0,
oso_object ? &comp_unit_info->oso_mod_time : NULL));
ArchSpec platform_arch(arch);
+ bool prefer_platform_arch = false;
if (user_exe_path && user_exe_path[0])
{
{
if (platform_arch.IsValid())
{
- if (!platform_arch.IsCompatibleMatch(matching_module_spec.GetArchitecture()))
+ if (platform_arch.IsCompatibleMatch(matching_module_spec.GetArchitecture()))
+ {
+ // If the OS or vendor weren't specified, then adopt the module's
+ // architecture so that the platform matching can be more accurate
+ if (!platform_arch.TripleOSWasSpecified() || !platform_arch.TripleVendorWasSpecified())
+ {
+ prefer_platform_arch = true;
+ platform_arch = matching_module_spec.GetArchitecture();
+ }
+ }
+ else
{
error.SetErrorStringWithFormat("the specified architecture '%s' is not compatible with '%s' in '%s'",
platform_arch.GetTriple().str().c_str(),
else
{
// Only one arch and none was specified
+ prefer_platform_arch = true;
platform_arch = matching_module_spec.GetArchitecture();
}
}
module_spec.GetArchitecture() = arch;
if (module_specs.FindMatchingModuleSpec(module_spec, matching_module_spec))
{
+ prefer_platform_arch = true;
platform_arch = matching_module_spec.GetArchitecture();
}
}
- // Don't just select the first architecture, we want to let the platform select
- // the best architecture first when there are multiple archs.
-// else
-// {
-// // No arch specified, select the first arch
-// if (module_specs.GetModuleSpecAtIndex(0, matching_module_spec))
-// {
-// platform_arch = matching_module_spec.GetArchitecture();
-// }
-// }
}
}
}
// current architecture if we have a valid architecture.
platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
- if (arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
+ if (!prefer_platform_arch && arch.IsValid())
+ {
+ if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
+ platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
+ }
+ else if (platform_arch.IsValid())
{
- platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
+ // if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with
+ // a single architecture which should be used
+ ArchSpec fixed_platform_arch;
+ if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch))
+ platform_sp = Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch);
}
}