Add support for the new (added last week) llvm::Triple::WatchOS and ::TvOS

in places where we check for Triple::IOS.  They're mostly the same as far
as lldb is conerned.
.
Also add a base cass implementation for Process::IsAlive - Greg added this 
last year but it didn't get upstreamed.

llvm-svn: 252227
This commit is contained in:
Jason Molenda 2015-11-05 23:03:44 +00:00
parent 12ec50553f
commit a814f704d3
9 changed files with 95 additions and 4 deletions

View File

@ -2080,7 +2080,7 @@ public:
/// otherwise.
//------------------------------------------------------------------
virtual bool
IsAlive () = 0;
IsAlive ();
//------------------------------------------------------------------
/// Before lldb detaches from a process, it warns the user that they are about to lose their debug session.

View File

@ -162,6 +162,8 @@ DynamicLoaderDarwinKernel::CreateInstance (Process* process, bool force)
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
case llvm::Triple::TvOS:
case llvm::Triple::WatchOS:
if (triple_ref.getVendor() != llvm::Triple::Apple)
{
return NULL;

View File

@ -118,6 +118,8 @@ DynamicLoaderMacOSXDYLD::CreateInstance (Process* process, bool force)
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
case llvm::Triple::TvOS:
case llvm::Triple::WatchOS:
create = triple_ref.getVendor() == llvm::Triple::Apple;
break;
default:

View File

@ -292,7 +292,6 @@ EmulateInstructionARM::GetFramePointerRegisterNumber () const
{
if (m_arch.GetTriple().isAndroid())
return LLDB_INVALID_REGNUM; // Don't use frame pointer on android
bool is_apple = false;
if (m_arch.GetTriple().getVendor() == llvm::Triple::Apple)
is_apple = true;
@ -301,6 +300,8 @@ EmulateInstructionARM::GetFramePointerRegisterNumber () const
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
case llvm::Triple::TvOS:
case llvm::Triple::WatchOS:
is_apple = true;
break;
default:

View File

@ -111,8 +111,11 @@ PlatformDarwinKernel::CreateInstance (bool force, const ArchSpec *arch)
{
switch (triple.getOS())
{
case llvm::Triple::Darwin: // Deprecated, but still support Darwin for historical reasons
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
case llvm::Triple::WatchOS:
case llvm::Triple::TvOS:
break;
// Only accept "vendor" for vendor if the host is Apple and
// it "unknown" wasn't specified (it was just returned because it
@ -312,7 +315,11 @@ PlatformDarwinKernel::CollectKextAndKernelDirectories ()
// e.g. /Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.Internal.sdk
std::vector<FileSpec> sdk_dirs;
if (m_ios_debug_session != eLazyBoolNo)
{
GetiOSSDKDirectoriesToSearch (sdk_dirs);
GetAppleTVOSSDKDirectoriesToSearch (sdk_dirs);
GetWatchOSSDKDirectoriesToSearch (sdk_dirs);
}
if (m_ios_debug_session != eLazyBoolYes)
GetMacSDKDirectoriesToSearch (sdk_dirs);
@ -363,6 +370,50 @@ PlatformDarwinKernel::GetiOSSDKDirectoriesToSearch (std::vector<lldb_private::Fi
}
}
void
PlatformDarwinKernel::GetAppleTVOSSDKDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories)
{
// DeveloperDirectory is something like "/Applications/Xcode.app/Contents/Developer"
const char *developer_dir = GetDeveloperDirectory();
if (developer_dir == NULL)
developer_dir = "/Applications/Xcode.app/Contents/Developer";
char pathbuf[PATH_MAX];
::snprintf (pathbuf, sizeof (pathbuf), "%s/Platforms/AppleTVOS.platform/Developer/SDKs", developer_dir);
FileSpec ios_sdk(pathbuf, true);
if (ios_sdk.Exists() && ios_sdk.IsDirectory())
{
directories.push_back (ios_sdk);
}
}
void
PlatformDarwinKernel::GetWatchOSSDKDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories)
{
// DeveloperDirectory is something like "/Applications/Xcode.app/Contents/Developer"
const char *developer_dir = GetDeveloperDirectory();
if (developer_dir == NULL)
developer_dir = "/Applications/Xcode.app/Contents/Developer";
char pathbuf[PATH_MAX];
::snprintf (pathbuf, sizeof (pathbuf), "%s/Platforms/watchOS.platform/Developer/SDKs", developer_dir);
FileSpec ios_sdk(pathbuf, true);
if (ios_sdk.Exists() && ios_sdk.IsDirectory())
{
directories.push_back (ios_sdk);
}
else
{
::snprintf (pathbuf, sizeof (pathbuf), "%s/Platforms/WatchOS.platform/Developer/SDKs", developer_dir);
FileSpec alt_watch_sdk(pathbuf, true);
if (ios_sdk.Exists() && ios_sdk.IsDirectory())
{
directories.push_back (ios_sdk);
}
}
}
void
PlatformDarwinKernel::GetMacSDKDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories)
{

View File

@ -133,6 +133,14 @@ protected:
void
GetiOSSDKDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories);
// Directories where we may find AppleTVOS SDKs with kext bundles in them
void
GetAppleTVOSSDKDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories);
// Directories where we may find WatchOS SDKs with kext bundles in them
void
GetWatchOSSDKDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories);
// Directories where we may find Mac OS X SDKs with kext bundles in them
void
GetMacSDKDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories);

View File

@ -157,6 +157,8 @@ ProcessKDP::CanDebug(TargetSP target_sp, bool plugin_specified_by_name)
case llvm::Triple::Darwin: // Should use "macosx" for desktop and "ios" for iOS, but accept darwin just in case
case llvm::Triple::MacOSX: // For desktop targets
case llvm::Triple::IOS: // For arm targets
case llvm::Triple::TvOS:
case llvm::Triple::WatchOS:
if (triple_ref.getVendor() == llvm::Triple::Apple)
{
ObjectFile *exe_objfile = exe_module->GetObjectFile();
@ -698,7 +700,7 @@ ProcessKDP::DoDestroy ()
bool
ProcessKDP::IsAlive ()
{
return m_comm.IsConnected() && m_private_state.GetValue() != eStateExited;
return m_comm.IsConnected() && Process::IsAlive();
}
//------------------------------------------------------------------

View File

@ -64,6 +64,8 @@ SystemRuntimeMacOSX::CreateInstance (Process* process)
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
case llvm::Triple::TvOS:
case llvm::Triple::WatchOS:
create = triple_ref.getVendor() == llvm::Triple::Apple;
break;
default:

View File

@ -1501,6 +1501,29 @@ Process::SetExitStatus (int status, const char *cstr)
return true;
}
bool
Process::IsAlive ()
{
switch (m_private_state.GetValue())
{
case eStateInvalid:
case eStateUnloaded:
case eStateDetached:
case eStateExited:
return false;
case eStateConnected:
case eStateAttaching:
case eStateLaunching:
case eStateStopped:
case eStateRunning:
case eStateStepping:
case eStateCrashed:
case eStateSuspended:
return true;
}
}
// This static callback can be used to watch for local child processes on
// the current host. The child process exits, the process will be
// found in the global target list (we want to be completely sure that the