diff --git a/src/slurmd/mgr.c b/src/slurmd/mgr.c
index 012a36d3103915122af732ff23be8f7b57cb09c0..d5ccce5ee4dee00a4d27de6d78d15fa999ff7c3f 100644
--- a/src/slurmd/mgr.c
+++ b/src/slurmd/mgr.c
@@ -36,6 +36,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#include <sys/ptrace.h>
 #include <unistd.h>
 #include <pwd.h>
 #include <grp.h>
diff --git a/src/srun/launch.c b/src/srun/launch.c
index c0e00f8365ac1fecd8ac6ed7ec666d0e133c4c67..b382e56e6da67b18570ffd312562dfac9efb85e0 100644
--- a/src/srun/launch.c
+++ b/src/srun/launch.c
@@ -175,7 +175,7 @@ launch(void *arg)
 
 #ifdef HAVE_TOTALVIEW
 		if (opt.totalview)
-			r->task_flags &= TASK_TOTALVIEW_DEBUG;
+			r->task_flags |= TASK_TOTALVIEW_DEBUG;
 #endif
 
 	}