From: Pavel Labath Date: Thu, 28 May 2015 10:28:34 +0000 (+0000) Subject: Move prctl call in TestChangeProcessGroup to the child X-Git-Tag: llvmorg-3.7.0-rc1~3623 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9d6e8993133994d7f1462b0caec10da77b4c974;p=platform%2Fupstream%2Fllvm.git Move prctl call in TestChangeProcessGroup to the child I was hoping the enable-tracing flag will be inherited from the parent. It is not. llvm-svn: 238408 --- diff --git a/lldb/test/functionalities/process_group/main.c b/lldb/test/functionalities/process_group/main.c index 5de63db..c730c629 100644 --- a/lldb/test/functionalities/process_group/main.c +++ b/lldb/test/functionalities/process_group/main.c @@ -10,19 +10,6 @@ volatile int release_child_flag = 0; int main(int argc, char const *argv[]) { -#if defined(__linux__) - // Immediately enable any ptracer so that we can allow the stub attach - // operation to succeed. Some Linux kernels are locked down so that - // only an ancestor process can be a ptracer of a process. This disables that - // restriction. Without it, attach-related stub tests will fail. -#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY) - // For now we execute on best effort basis. If this fails for - // some reason, so be it. - const int prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); - (void) prctl_result; -#endif -#endif - pid_t child = fork(); if (child == -1) { @@ -74,6 +61,19 @@ int main(int argc, char const *argv[]) } else { // child +#if defined(__linux__) + // Immediately enable any ptracer so that we can allow the stub attach + // operation to succeed. Some Linux kernels are locked down so that + // only an ancestor process can be a ptracer of a process. This disables that + // restriction. Without it, attach-related stub tests will fail. +#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY) + // For now we execute on best effort basis. If this fails for + // some reason, so be it. + const int prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); + (void) prctl_result; +#endif +#endif + while (! release_child_flag) // Wait for debugger to attach sleep(1);