This is the mail archive of the frysk-cvs@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SCM] master: frysk-core/frysk/proc/live/ChangeLog


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]