public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: frysk-core/frysk/proc/live/ChangeLog Date: Fri, 18 Jan 2008 06:02:00 -0000 [thread overview] Message-ID: <20080118060256.17627.qmail@sourceware.org> (raw) The branch, master has been updated via c032a5bd0673fe5cd9b0c172354f0928efdfa915 (commit) from 8f9300fae4dc499d712ded780297e7eac0849485 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit c032a5bd0673fe5cd9b0c172354f0928efdfa915 Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jan 18 00:59:33 2008 -0500 frysk-core/frysk/proc/live/ChangeLog 2008-01-18 Andrew Cagney <cagney@redhat.com> * LinuxPtraceTaskState.java: Convert a SIGCONT during the main task's attach back into a SIGSTOP; pass pending signals back when detaching. * LinuxPtraceProcState.java: Unwedge a suspended Proc by sending it a SIGCONT. * TestProcStopped.java (testStoppedAckDaemon()): Enable. (testStoppedDetached()): Enable. (testMultiThreadedStoppedAckDaemon()): Enable. (testMultiThreadedStoppedDetached()): Enable. frysk-sys/frysk/sys/proc/ChangeLog 2008-01-18 Andrew Cagney <cagney@redhat.com> * Status.java (isStopped(int)): New. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/proc/live/ChangeLog | 12 ++++++ .../frysk/proc/live/LinuxPtraceProcState.java | 11 +++++ .../frysk/proc/live/LinuxPtraceTaskState.java | 15 +++++-- frysk-core/frysk/proc/live/TestProcStopped.java | 8 ---- frysk-sys/frysk/sys/proc/ChangeLog | 4 ++ frysk-sys/frysk/sys/proc/Status.java | 40 ++++++++++--------- 6 files changed, 58 insertions(+), 32 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog index 98df95a..4c3f582 100644 --- a/frysk-core/frysk/proc/live/ChangeLog +++ b/frysk-core/frysk/proc/live/ChangeLog @@ -1,3 +1,15 @@ +2008-01-18 Andrew Cagney <cagney@redhat.com> + + * LinuxPtraceTaskState.java: Convert a SIGCONT during the main + task's attach back into a SIGSTOP; pass pending signals back when + detaching. + * LinuxPtraceProcState.java: Unwedge a suspended Proc by sending + it a SIGCONT. + * TestProcStopped.java (testStoppedAckDaemon()): Enable. + (testStoppedDetached()): Enable. + (testMultiThreadedStoppedAckDaemon()): Enable. + (testMultiThreadedStoppedDetached()): Enable. + 2008-01-17 Rick Moseley <rmoseley@redhat.com> * LinuxWaitBuilder.java: Catch error when process is gone. diff --git a/frysk-core/frysk/proc/live/LinuxPtraceProcState.java b/frysk-core/frysk/proc/live/LinuxPtraceProcState.java index ce77c57..841e914 100644 --- a/frysk-core/frysk/proc/live/LinuxPtraceProcState.java +++ b/frysk-core/frysk/proc/live/LinuxPtraceProcState.java @@ -39,6 +39,8 @@ package frysk.proc.live; +import frysk.sys.Signal; +import frysk.sys.proc.Status; import java.util.Iterator; import java.util.Collection; import java.util.HashSet; @@ -165,6 +167,15 @@ abstract class LinuxPtraceProcState extends State { } // Tell the main task to get things started. mainTask.performAttach (); + // The attach has been initiated and the process state + // should transition to (T) TRACED. If it is instead in + // (T) STOPPED then the process is stuck (suspended), send + // it a SIGSTOP to unwedge it. /proc/status is used as + // that differentiates between STOPPED an TRACED. + if (Status.isStopped(proc.getPid())) { + // wake the suspended process + Signal.CONT.tkill(proc.getPid()); + } return new Attaching.ToMainTask (mainTask); } /** diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java index e861a87..184c68c 100644 --- a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java +++ b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java @@ -207,7 +207,14 @@ class LinuxPtraceTaskState extends State { LinuxPtraceTaskState handleSignaledEvent (LinuxPtraceTask task, int signal) { logger.log (Level.FINE, "{0} handleSignaledEvent, signal: {1}\n ", new Object[] {task,new Integer(signal)}); - return transitionToAttached (task, signal); + if (task.getProc().getMainTask() == task + && Signal.CONT.equals(signal)) + // Its the cont signal sent to this task to wake + // it up from it's slumber; turn it back into a + // SIGSTOP. + return transitionToAttached (task, Signal.STOP.intValue()); + else + return transitionToAttached (task, signal); } LinuxPtraceTaskState handleTrappedEvent (LinuxPtraceTask task) { @@ -409,8 +416,7 @@ class LinuxPtraceTaskState extends State { if (shouldRemoveObservers) task.removeObservers(); // XXX: Otherwise check that observers are empty? - - task.sendDetach (0); + task.sendDetach(signal); ((LinuxPtraceProc)task.getProc()).performTaskDetachCompleted (task); return detached; } @@ -1414,8 +1420,7 @@ class LinuxPtraceTaskState extends State { if (shouldRemoveObservers) task.removeObservers(); // XXX: Otherwise check that observers are empty? - - task.sendDetach (0); + task.sendDetach (sig); ((LinuxPtraceProc)task.getProc()).performTaskDetachCompleted (task); return detached; } diff --git a/frysk-core/frysk/proc/live/TestProcStopped.java b/frysk-core/frysk/proc/live/TestProcStopped.java index eaad80a..16a193b 100644 --- a/frysk-core/frysk/proc/live/TestProcStopped.java +++ b/frysk-core/frysk/proc/live/TestProcStopped.java @@ -63,16 +63,12 @@ public class TestProcStopped extends TestLib { } public void testStoppedAckDaemon() { - if (unresolvedOnUtrace(5114)) - return; SlaveOffspring ackProc = SlaveOffspring.createDaemon(); stopped(ackProc); assertRunUntilStop("testStoppedAckDaemon"); } public void testStoppedDetached() { - if (unresolvedOnUtrace(5114)) - return; SlaveOffspring ackProc = SlaveOffspring.createChild(); stopped(ackProc); assertRunUntilStop("testStoppedDetached"); @@ -103,8 +99,6 @@ public class TestProcStopped extends TestLib { } public void testMultiThreadedStoppedAckDaemon() { - if (unresolvedOnUtrace(3595)) - return; SlaveOffspring ackProc = SlaveOffspring.createDaemon() .assertSendAddClonesWaitForAcks(2); stopped(ackProc); @@ -112,8 +106,6 @@ public class TestProcStopped extends TestLib { } public void testMultiThreadedStoppedDetached() { - if (unresolvedOnUtrace(3595)) - return; SlaveOffspring ackProc = SlaveOffspring.createChild() .assertSendAddClonesWaitForAcks(2); stopped(ackProc); diff --git a/frysk-sys/frysk/sys/proc/ChangeLog b/frysk-sys/frysk/sys/proc/ChangeLog index 309417d..94415be 100644 --- a/frysk-sys/frysk/sys/proc/ChangeLog +++ b/frysk-sys/frysk/sys/proc/ChangeLog @@ -1,3 +1,7 @@ +2008-01-18 Andrew Cagney <cagney@redhat.com> + + * Status.java (isStopped(int)): New. + 2008-01-15 Andrew Cagney <cagney@redhat.com> * Stat.java (Stat(int)): New. diff --git a/frysk-sys/frysk/sys/proc/Status.java b/frysk-sys/frysk/sys/proc/Status.java index e413583..c9a379c 100644 --- a/frysk-sys/frysk/sys/proc/Status.java +++ b/frysk-sys/frysk/sys/proc/Status.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, Red Hat Inc. +// Copyright 2005, 2006, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -37,26 +37,18 @@ // version and license this file solely under the GPL without // exception. - package frysk.sys.proc; - -public class Status -{ - - /** - * frysk.sys.proc.Status - * - * Partial wrapper for /proc/$$/status. - * - * This class supplements frysk.sys.proc.Stat - * as that class does not contain GID and UID. - * - * This class extracts that information from either - * /proc/$$/status or from a buffer that has been - * been passed to it for parsing. - * - */ +/** + * Partial wrapper for /proc/$$/status. + * + * This class supplements frysk.sys.proc.Stat as that class does not + * contain GID and UID. + * + * This class extracts that information from either /proc/$$/status or + * from a buffer that has been been passed to it for parsing. + */ +public class Status { private native static byte[] statusSlurp (int pid); @@ -162,4 +154,14 @@ public class Status return getGID(buffer); } + /** + * Returns true if the PID is in a stopped state. + */ + public static boolean isStopped(int pid) { + byte[] buf = statusSlurp(pid); + if (buf == null) + return false; // lost task? + String status = new String(buf); + return status.indexOf("T (stopped)") >= 0; + } } hooks/post-receive -- frysk system monitor/debugger
next reply other threads:[~2008-01-18 6:02 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-01-18 6:02 cagney [this message] 2008-01-18 7:33 cagney
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080118060256.17627.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).