summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/Host.cpp
diff options
context:
space:
mode:
authorShawn Best <sbest@blueshiftinc.com>2014-11-08 01:41:49 +0000
committerShawn Best <sbest@blueshiftinc.com>2014-11-08 01:41:49 +0000
commit8da0bf3b7cf3670095d7ce9eac885dfc5976720e (patch)
tree05ff1512e3eb73a6f0e0387105bba0df772c671e /lldb/source/Host/common/Host.cpp
parented9825848281163a14c55f48def81b6e04ef7ffe (diff)
downloadbcm5719-llvm-8da0bf3b7cf3670095d7ce9eac885dfc5976720e.tar.gz
bcm5719-llvm-8da0bf3b7cf3670095d7ce9eac885dfc5976720e.zip
LLGS Android target support - for Andy Chien : http://reviews.llvm.org/D6166
llvm-svn: 221570
Diffstat (limited to 'lldb/source/Host/common/Host.cpp')
-rw-r--r--lldb/source/Host/common/Host.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 33729abb2c6..c6a1b6e6fa7 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -30,7 +30,7 @@
#endif
#if defined (__linux__) || defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) || defined(__NetBSD__)
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
#include <spawn.h>
#endif
#include <sys/wait.h>
@@ -111,7 +111,7 @@ Host::StartMonitoringChildProcess(Host::MonitorChildProcessCallback callback, vo
return ThreadLauncher::LaunchThread(thread_name, MonitorChildProcessThreadFunction, info_ptr, NULL);
}
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
//------------------------------------------------------------------
// Scoped class that will disable thread canceling when it is
// constructed, and exception safely restore the previous value it
@@ -126,7 +126,6 @@ public:
int err = ::pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &m_old_state);
if (err != 0)
m_old_state = -1;
-
}
~ScopedPThreadCancelDisabler()
@@ -139,7 +138,7 @@ public:
private:
int m_old_state; // Save the old cancelability state.
};
-#endif
+#endif // __ANDROID_NDK__
static thread_result_t
MonitorChildProcessThreadFunction (void *arg)
@@ -173,15 +172,14 @@ MonitorChildProcessThreadFunction (void *arg)
log->Printf("%s ::wait_pid (pid = %" PRIi32 ", &status, options = %i)...", function, pid, options);
// Wait for all child processes
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
::pthread_testcancel ();
#endif
// Get signals from all children with same process group of pid
const ::pid_t wait_pid = ::waitpid (pid, &status, options);
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
::pthread_testcancel ();
#endif
-
if (wait_pid == -1)
{
if (errno == EINTR)
@@ -226,7 +224,7 @@ MonitorChildProcessThreadFunction (void *arg)
// Scope for pthread_cancel_disabler
{
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
ScopedPThreadCancelDisabler pthread_cancel_disabler;
#endif
@@ -316,6 +314,8 @@ Host::GetCurrentThreadID()
return thread_self;
#elif defined(__FreeBSD__)
return lldb::tid_t(pthread_getthreadid_np());
+#elif defined(__ANDROID_NDK__)
+ return lldb::tid_t(gettid());
#elif defined(__linux__)
return lldb::tid_t(syscall(SYS_gettid));
#else
@@ -456,7 +456,7 @@ FileSpec
Host::GetModuleFileSpecForHostAddress (const void *host_addr)
{
FileSpec module_filespec;
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
Dl_info info;
if (::dladdr (host_addr, &info))
{
@@ -694,14 +694,13 @@ Host::RunShellCommand (const char *command,
// systems
#if defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__) || defined(__NetBSD__)
-
// this method needs to be visible to macosx/Host.cpp and
// common/Host.cpp.
short
Host::GetPosixspawnFlags(const ProcessLaunchInfo &launch_info)
{
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
short flags = POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK;
#if defined (__APPLE__)
@@ -745,7 +744,7 @@ Host::GetPosixspawnFlags(const ProcessLaunchInfo &launch_info)
#endif // #if defined (__APPLE__)
return flags;
#else
- assert(false *&& "Host::GetPosixspawnFlags() not supported on Android");
+ assert(false && "Host::GetPosixspawnFlags() not supported on Android");
return 0;
#endif
}
@@ -754,7 +753,7 @@ Error
Host::LaunchProcessPosixSpawn(const char *exe_path, const ProcessLaunchInfo &launch_info, lldb::pid_t &pid)
{
Error error;
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS));
posix_spawnattr_t attr;
@@ -954,7 +953,7 @@ Host::LaunchProcessPosixSpawn(const char *exe_path, const ProcessLaunchInfo &lau
bool
Host::AddPosixSpawnFileAction(void *_file_actions, const FileAction *info, Log *log, Error &error)
{
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
if (info == NULL)
return false;
@@ -1022,7 +1021,6 @@ Host::AddPosixSpawnFileAction(void *_file_actions, const FileAction *info, Log *
return false;
#endif
}
-
#endif // LaunchProcedssPosixSpawn: Apple, Linux, FreeBSD and other GLIBC systems
#if defined(__linux__) || defined(__FreeBSD__) || defined(__GLIBC__) || defined(__NetBSD__) || defined(_WIN32)
@@ -1049,11 +1047,9 @@ Host::LaunchProcess (ProcessLaunchInfo &launch_info)
return error;
}
-
#endif // defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
#ifndef _WIN32
-
void
Host::Kill(lldb::pid_t pid, int signo)
{
OpenPOWER on IntegriCloud