public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: cagney@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Save the task creator in LinuxPtraceTask.
Date: Sat, 15 Mar 2008 17:22:00 -0000	[thread overview]
Message-ID: <20080315172200.4453.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  351653635e7bc30d6a5f0d5abdb0d31ab25d1fd5 (commit)
      from  ccf9809f752b0a3b2d9b04717ffb12cce771b922 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 351653635e7bc30d6a5f0d5abdb0d31ab25d1fd5
Author: Andrew Cagney <cagney@redhat.com>
Date:   Sat Mar 15 13:20:55 2008 -0400

    Save the task creator in LinuxPtraceTask.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-03-15  Andrew Cagney  <cagney@redhat.com>
    
    	* LinuxPtraceTask.java (LinuxPtraceTask(LinuxPtraceTask,
    	LinuxPtraceProc,Attached)): Add LinuxPtraceTask parameter.
    	(notifyClonedOffspring(), notifyForkedOffspring()): Simplify.
    	* LinuxPtraceHost.java: Update.
    	* LinuxWaitBuilder.java (forkEvent(ProcessIdentifier,ProcessIdentifier))
    	(cloneEvent(ProcessIdentifier,ProcessIdentifier)): Update; clean-up.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/proc/live/ChangeLog             |    9 +++++++
 frysk-core/frysk/proc/live/LinuxPtraceHost.java  |    5 +--
 frysk-core/frysk/proc/live/LinuxPtraceTask.java  |   26 +++++++++++++--------
 frysk-core/frysk/proc/live/LinuxWaitBuilder.java |   18 +++++++-------
 4 files changed, 36 insertions(+), 22 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index 773513b..385e477 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-15  Andrew Cagney  <cagney@redhat.com>
+
+	* LinuxPtraceTask.java (LinuxPtraceTask(LinuxPtraceTask,
+	LinuxPtraceProc,Attached)): Add LinuxPtraceTask parameter.	
+	(notifyClonedOffspring(), notifyForkedOffspring()): Simplify.
+	* LinuxPtraceHost.java: Update.
+	* LinuxWaitBuilder.java (forkEvent(ProcessIdentifier,ProcessIdentifier))
+	(cloneEvent(ProcessIdentifier,ProcessIdentifier)): Update; clean-up.
+
 2008-03-14  Andrew Cagney  <cagney@redhat.com>
 
 	* LinuxPtraceProcState.java: Update to match Proc.
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceHost.java b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
index e0ea0e8..fbeed58 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceHost.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
@@ -49,7 +49,6 @@ import frysk.proc.Proc;
 import frysk.sys.proc.Stat;
 import frysk.sys.proc.ProcBuilder;
 import java.util.Iterator;
-import frysk.proc.Task;
 import frysk.proc.TaskObserver.Attached;
 import frysk.sys.ProcessIdentifier;
 import frysk.sys.ProcessIdentifierFactory;
@@ -262,14 +261,14 @@ public class LinuxPtraceHost extends LiveHost {
 			= Fork.ptrace(exe, stdin, stdout, stderr, args);
 		    // See if the Host knows about this task.
 		    ProcessIdentifier myTid = Tid.get();
-		    Task myTask = getTask(myTid);
+		    LinuxPtraceTask myTask = getTask(myTid);
 		    if (myTask == null) {
 			// If not, find this process and add this task to it.
 			Proc myProc = getSelf();
 			myTask = new LinuxPtraceTask(myProc, pid);
 		    }
 		    LinuxPtraceProc proc = new LinuxPtraceProc(myTask, pid);
-		    new LinuxPtraceTask(proc, attachedObserver);
+		    new LinuxPtraceTask(myTask, proc, attachedObserver);
 		}
 	    });
     }
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTask.java b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
index 2f78591..4f27937 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTask.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
@@ -74,12 +74,14 @@ import frysk.rsl.Log;
 
 public class LinuxPtraceTask extends LiveTask {
     private static final Log fine = Log.fine(LinuxPtraceTask.class);
+    private final LinuxPtraceTask creator;
 
     /**
      * Create a new unattached Task.
      */
     public LinuxPtraceTask(Proc proc, ProcessIdentifier pid) {
 	super(proc, pid);
+	this.creator = null; // not known.
 	((LinuxPtraceHost)proc.getHost()).putTask(tid, this);
 	((LinuxPtraceProc)proc).addTask(this);
 	newState = LinuxPtraceTaskState.detachedState();
@@ -88,20 +90,24 @@ public class LinuxPtraceTask extends LiveTask {
     /**
      * Create a new attached clone of Task.
      */
-    public LinuxPtraceTask(Task task, ProcessIdentifier clone) {
-	// XXX: shouldn't need to grub around in the old task's state.
-	super(task, clone);
+    public LinuxPtraceTask(LinuxPtraceTask cloningTask,
+			   ProcessIdentifier clone) {
+	super(cloningTask, clone);
+	this.creator = cloningTask;
 	((LinuxPtraceHost)getProc().getHost()).putTask(tid, this);
-	((LinuxPtraceProc)task.getProc()).addTask(this);
-	newState = LinuxPtraceTaskState.clonedState(((LinuxPtraceTask)task).getState ());
+	((LinuxPtraceProc)cloningTask.getProc()).addTask(this);
+	// XXX: shouldn't need to grub around in the old task's state.
+	newState = LinuxPtraceTaskState.clonedState(cloningTask.getState());
 	this.watchpoints = new WatchpointAddresses(this);
     }
     /**
      * Create a new attached main Task of Proc.
      */
-    public LinuxPtraceTask(LinuxPtraceProc proc,
+    public LinuxPtraceTask(LinuxPtraceTask forkingTask,
+			   LinuxPtraceProc proc,
 			   TaskObserver.Attached attached) {
 	super(proc, attached);
+	this.creator = forkingTask;
 	((LinuxPtraceHost)proc.getHost()).putTask(tid, this);
 	((LinuxPtraceProc)proc).addTask(this);
 	newState = LinuxPtraceTaskState.mainState();
@@ -516,8 +522,8 @@ public class LinuxPtraceTask extends LiveTask {
      */
     int notifyClonedOffspring() {
 	fine.log(this, "notifyClonedOffspring");
-	LinuxPtraceTask creator = (LinuxPtraceTask)this.getCreator();
-	for (Iterator i = creator.clonedObservers.iterator(); i.hasNext();) {
+	for (Iterator i = creator.clonedObservers.iterator();
+	     i.hasNext();) {
 	    TaskObserver.Cloned observer = (TaskObserver.Cloned) i.next();
 	    if (observer.updateClonedOffspring(creator, this) == Action.BLOCK) {
 		blockers.add(observer);
@@ -616,8 +622,8 @@ public class LinuxPtraceTask extends LiveTask {
      * created using fork, is sitting at the first instruction.
      */
     int notifyForkedOffspring() {
-	LinuxPtraceTask creator = (LinuxPtraceTask)this.getCreator();
-	for (Iterator i = creator.forkedObservers.iterator(); i.hasNext();) {
+	for (Iterator i = creator.forkedObservers.iterator();
+	     i.hasNext();) {
 	    TaskObserver.Forked observer = (TaskObserver.Forked) i.next();
 	    if (observer.updateForkedOffspring(creator, this) == Action.BLOCK) {
 		blockers.add(observer);
diff --git a/frysk-core/frysk/proc/live/LinuxWaitBuilder.java b/frysk-core/frysk/proc/live/LinuxWaitBuilder.java
index 1ed8ef4..98fa1e8 100644
--- a/frysk-core/frysk/proc/live/LinuxWaitBuilder.java
+++ b/frysk-core/frysk/proc/live/LinuxWaitBuilder.java
@@ -125,10 +125,10 @@ class LinuxWaitBuilder implements WaitBuilder {
         // what happened. Note that hot on the heels of this event is
         // a clone.stopped event, and the clone Task must be created
         // before that event arrives.
-        LinuxPtraceTask task = get(pid, "cloneEvent");
+        LinuxPtraceTask cloningTask = get(pid, "cloneEvent");
         // Create an attached, and running, clone of TASK.
-        LinuxPtraceTask clone = new LinuxPtraceTask(task, clonePid);
-        task.processClonedEvent(clone);
+        LinuxPtraceTask clonedTask = new LinuxPtraceTask(cloningTask, clonePid);
+        cloningTask.processClonedEvent(clonedTask);
 	attemptDeliveringFsckedKernelEvents();
     }
 
@@ -138,13 +138,13 @@ class LinuxWaitBuilder implements WaitBuilder {
         // happened. Note that hot on the heels of this fork event is
         // the child's stop event, the fork Proc must be created
         // before that event arrives.
-        LinuxPtraceTask task = get(pid, "forkEvent");
+        LinuxPtraceTask forkingTask = get(pid, "forkEvent");
         // Create an attached and running fork of TASK.
-        LinuxPtraceProc forkProc = new LinuxPtraceProc(task, fork);
-        // The main task.
-        Task forkTask;
-	forkTask = new LinuxPtraceTask(forkProc, (TaskObserver.Attached) null);
-        task.processForkedEvent(forkTask);
+        LinuxPtraceProc forkedProc = new LinuxPtraceProc(forkingTask, fork);
+        // The forked proc's only and main task.
+        Task forkedTask = new LinuxPtraceTask(forkingTask, forkedProc,
+					      (TaskObserver.Attached) null);
+        forkingTask.processForkedEvent(forkedTask);
 	attemptDeliveringFsckedKernelEvents ();
     }
     


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2008-03-15 17:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080315172200.4453.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: link
Be 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).