From b3a40ba812cde1ab2571754a97d19215645271ff Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Tue, 20 Mar 2012 18:34:04 +0000 Subject: Platforms can now auto-select themselves if you specify a full target triple when doing a "target create" command. Each platform now knows if it can handle an architecture and a platform can be found using an architecture. Each platform can look at the arch, vendor and OS and know if it should be used or not. llvm-svn: 153104 --- .../Platform/MacOSX/PlatformiOSSimulator.cpp | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp') diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 18cd4eb8f88..7a8884eba0a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -60,9 +60,30 @@ PlatformiOSSimulator::Terminate () } Platform* -PlatformiOSSimulator::CreateInstance () +PlatformiOSSimulator::CreateInstance (bool force, const ArchSpec *arch) { - return new PlatformiOSSimulator (); + bool create = force; + if (create == false && arch && arch->IsValid()) + { + switch (arch->GetMachine()) + { + // Currently simulator is i386 only... + case llvm::Triple::x86: + { + const llvm::Triple &triple = arch->GetTriple(); + const llvm::Triple::OSType os = triple.getOS(); + const llvm::Triple::VendorType vendor = triple.getVendor(); + if (os == llvm::Triple::Darwin && vendor == llvm::Triple::Apple) + create = true; + } + break; + default: + break; + } + } + if (create) + return new PlatformiOSSimulator (); + return NULL; } -- cgit v1.2.3