[test] [linux] define PR_SET_PTRACER constants if the system does not provide them

Android API <= 16 header do not have these symbols defined, but the kernel does support the
relevant calls. And in general, since these calls are on a best-effort basis, it won't hurt even
if we try to run in on a really ancient kernel.

llvm-svn: 275393
This commit is contained in:
Pavel Labath 2016-07-14 10:43:21 +00:00
parent 6cf195b6d5
commit fa3d652d26
1 changed files with 8 additions and 3 deletions

View File

@ -26,7 +26,14 @@
#if defined(__linux__)
#include <sys/prctl.h>
#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY)
// Android API <= 16 does not have these defined.
#ifndef PR_SET_PTRACER
#define PR_SET_PTRACER 0x59616d61
#endif
#ifndef PR_SET_PTRACER_ANY
#define PR_SET_PTRACER_ANY ((unsigned long)-1)
#endif
// For now we execute on best effort basis. If this fails for some reason, so be it.
#define lldb_enable_attach() \
do \
@ -35,8 +42,6 @@
(void)prctl_result; \
} while (0)
#endif
#else // not linux
#define lldb_enable_attach()