[Lldb-commits] [lldb] r238408 - Move prctl call in TestChangeProcessGroup to the child
Pavel Labath
labath at google.com
Thu May 28 03:28:34 PDT 2015
Author: labath
Date: Thu May 28 05:28:34 2015
New Revision: 238408
URL: http://llvm.org/viewvc/llvm-project?rev=238408&view=rev
Log:
Move prctl call in TestChangeProcessGroup to the child
I was hoping the enable-tracing flag will be inherited from the parent. It is not.
Modified:
lldb/trunk/test/functionalities/process_group/main.c
Modified: lldb/trunk/test/functionalities/process_group/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_group/main.c?rev=238408&r1=238407&r2=238408&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/process_group/main.c (original)
+++ lldb/trunk/test/functionalities/process_group/main.c Thu May 28 05:28:34 2015
@@ -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);
More information about the lldb-commits
mailing list