From 75cad93bf26c9b7d888644dcb10074365dee16f5 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 6 Jan 2003 20:20:18 +0000 Subject: [PATCH] Slurmd now spawns tasks for totalview that are stopped and detached. Based upon kernel mod that permits SIGSTOP to child and ptrace(DETACH). --- src/slurmd/mgr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/slurmd/mgr.c b/src/slurmd/mgr.c index f74d54337c2..609ad6dab00 100644 --- a/src/slurmd/mgr.c +++ b/src/slurmd/mgr.c @@ -727,6 +727,22 @@ _exec_all_tasks(slurmd_job_t *job) if (shm_add_task(job->jobid, job->stepid, &t) < 0) error("shm_add_task: %m"); debug2("task %d added to shm", i); +#ifdef HAVE_TOTALVIEW + /* If task to be debugged, wait for it to stop via + * child's ptrace(PTRACE_TRACEME), then SIGSTOP, and + * ptrace(PTRACE_DETACH). This requires a kernel patch, + * which you probably already have in place for TotalView: + * http://hypermail.idiosynkrasia.net/linux-kernel/ + * archived/2001/week51/1193.html */ + if (job->task_flags & TASK_TOTALVIEW_DEBUG) { + int status; + waitpid(t.pid, &status, WUNTRACED); + if (kill(t.pid, SIGSTOP)) + error("kill %ld: %m", (long) t.pid); + if (ptrace(PTRACE_DETACH, (long) t.pid, NULL, NULL)) + error("ptrace %ld: %m", (long) t.pid); + } +#endif } -- GitLab