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: Merge ProcState into LinuxPtraceProcState.


The branch, master has been updated
       via  6261f1b370301704c58f6ac48f25c8b6a6e4033e (commit)
       via  2c6345dea85fab00bd01e7f0380c358777661680 (commit)
       via  e8ecb49d0ae5601424efb2a8bf50a302cc21f0f6 (commit)
       via  7d4af180d76ed316b676c0d1137e095942c69683 (commit)
      from  152adc77859695a55324b5a4524968bbc5fd3b34 (commit)

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

- Log -----------------------------------------------------------------
commit 6261f1b370301704c58f6ac48f25c8b6a6e4033e
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri Jan 4 12:36:32 2008 -0500

    Merge ProcState into LinuxPtraceProcState.
    
    frysk-core/frysk/proc/ChangeLog
    2008-01-04  Andrew Cagney  <cagney@redhat.com>
    
    	* ProcState.java: Delete; merged into
    	frysk.proc.live.LinuxPtraceProcState.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-01-04  Andrew Cagney  <cagney@redhat.com>
    
    	* LinuxPtraceProcState.java: Merge in deleted
    	frysk.proc.TaskState.
    	* LinuxPtraceProc.java: Update.

commit 2c6345dea85fab00bd01e7f0380c358777661680
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri Jan 4 11:26:30 2008 -0500

    Fold TaskState into LinuxPtraceTaskState.
    
    frysk-core/frysk/proc/ChangeLog
    2008-01-04  Andrew Cagney  <cagney@redhat.com>
    
    	* TaskState.java: Delete; merged into
    	frysk.proc.live.LinuxPtraceTaskState.
    	* State.java: Make public.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-01-04  Andrew Cagney  <cagney@redhat.com>
    
    	* LinuxPtraceTaskState.java: Merge in deleted
    	frysk.proc.TaskState.
    	* LinuxPtraceTask.java: Update.

commit e8ecb49d0ae5601424efb2a8bf50a302cc21f0f6
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri Jan 4 10:54:15 2008 -0500

    Move state code in LiveProc to LinuxPtraceProc.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-01-04  Andrew Cagney  <cagney@redhat.com>
    
    	* LiveProc.java: Move all state code from here ...
    	* LinuxPtraceProc.java: ... to here.

commit 7d4af180d76ed316b676c0d1137e095942c69683
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri Jan 4 10:44:56 2008 -0500

    Move state code from LiveTask to LinuxPtraceTask.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-01-04  Andrew Cagney  <cagney@redhat.com>
    
    	* LiveTask.java: Move all state code from here ...
    	* LinuxPtraceTask.java: ... to here.

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

Summary of changes:
 frysk-core/frysk/proc/ChangeLog                    |    9 +
 frysk-core/frysk/proc/ProcState.java               |   88 ----
 frysk-core/frysk/proc/State.java                   |    5 +-
 frysk-core/frysk/proc/TaskState.java               |  121 ------
 frysk-core/frysk/proc/live/ChangeLog               |   16 +
 frysk-core/frysk/proc/live/LinuxPtraceProc.java    |  422 +++++++++++++++++++-
 .../frysk/proc/live/LinuxPtraceProcState.java      |   97 +++--
 frysk-core/frysk/proc/live/LinuxPtraceTask.java    |  315 ++++++++++++++-
 .../frysk/proc/live/LinuxPtraceTaskState.java      |  348 +++++++++-------
 frysk-core/frysk/proc/live/LiveProc.java           |  424 +-------------------
 frysk-core/frysk/proc/live/LiveTask.java           |  304 +--------------
 11 files changed, 1007 insertions(+), 1142 deletions(-)
 delete mode 100644 frysk-core/frysk/proc/ProcState.java
 delete mode 100644 frysk-core/frysk/proc/TaskState.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index 2173755..9a413e1 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,3 +1,12 @@
+2008-01-04  Andrew Cagney  <cagney@redhat.com>
+
+	* ProcState.java: Delete; merged into
+	frysk.proc.live.LinuxPtraceProcState.
+
+	* TaskState.java: Delete; merged into
+	frysk.proc.live.LinuxPtraceTaskState.
+	* State.java: Make public.
+
 2008-01-03  Andrew Cagney  <cagney@redhat.com>
 
 	* Task.java (requestAddInstructionObserver(TaskObserver.Instruction)):
diff --git a/frysk-core/frysk/proc/ProcState.java b/frysk-core/frysk/proc/ProcState.java
deleted file mode 100644
index 53db181..0000000
--- a/frysk-core/frysk/proc/ProcState.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2005, 2006, 2007, 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
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-package frysk.proc;
-
-/**
- * A Process State Machine
- */
-
-public abstract class ProcState
-    extends State
-{
-    protected ProcState (String state)
-    {
-	super (state);
-    }
-    public ProcState handleRemoval (Proc proc)
-    {
-	throw unhandled (proc, "handleRemoval");
-    }
-    public ProcState handleRefresh (Proc proc)
-    {
-	throw unhandled (proc, "handleRefresh");
-    }
-    public ProcState handleTaskAttachCompleted (Proc proc, Task task)
-    {
-	throw unhandled (proc, "handleTaskAttachCompleted");
-    }
-    public ProcState handleTaskDetachCompleted (Proc proc, Task task)
-    {
-	throw unhandled (proc, "handleTaskDetachCompleted");
-    }
-    public ProcState handleTaskDetachCompleted (Proc proc, Task task,
-					 Task clone)
-    {
-	throw unhandled (proc, "handleTaskDetachCompleted/clone");
-    }
-    public ProcState handleAddObservation (Proc proc,
-				    Observation observation)
-    {
-	throw unhandled (proc, "handleAddObservation");
-    }
-    public ProcState handleDeleteObservation (Proc proc,
-				       Observation observation)
-    {
-	throw unhandled (proc, "handleDeleteObservation");
-    }
-    public ProcState handleDetach(Proc proc, boolean shouldRemoveObservers)
-    {
-	throw unhandled (proc, "handleDetach");
-    }
-}
diff --git a/frysk-core/frysk/proc/State.java b/frysk-core/frysk/proc/State.java
index 1a0d08e..350d2d1 100644
--- a/frysk-core/frysk/proc/State.java
+++ b/frysk-core/frysk/proc/State.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2005, Red Hat Inc.
+// Copyright 2005, 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
@@ -43,8 +43,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import frysk.event.Event;
 
-class State
-{
+public class State {
     protected static Logger logger = Logger.getLogger(ProcLogger.LOGGER_ID);
 
     private String name;
diff --git a/frysk-core/frysk/proc/TaskState.java b/frysk-core/frysk/proc/TaskState.java
deleted file mode 100644
index 0a643f0..0000000
--- a/frysk-core/frysk/proc/TaskState.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2005, 2006, 2007, 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
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-package frysk.proc;
-
-/**
- * The task state machine.
- */
-
-public abstract class TaskState
-    extends State
-{
-    protected TaskState (String state)
-    {
-	super (state);
-    }
-    public TaskState handleSignaledEvent (Task task, int sig)
-    {
-	throw unhandled (task, "handleSignaledEvent");
-    }
-    public TaskState handleStoppedEvent (Task task)
-    {
-	throw unhandled (task, "handleStoppedEvent");
-    }
-    public TaskState handleTrappedEvent (Task task)
-    {
-	throw unhandled (task, "handleTrappedEvent");
-    }
-    public TaskState handleSyscalledEvent (Task task)
-    {
-	throw unhandled (task, "handleSyscalledEvent");
-    }
-    public TaskState handleTerminatedEvent (Task task, boolean signal, int value)
-    {
-	throw unhandled (task, "handleTerminatedEvent");
-    }
-    public TaskState handleTerminatingEvent (Task task, boolean signal, int value)
-    {
-	throw unhandled (task, "handleTerminatingEvent");
-    }
-    public TaskState handleExecedEvent (Task task)
-    {
-	throw unhandled (task, "handleExecedEvent");
-    }
-    public TaskState handleDisappearedEvent (Task task, Throwable w)
-    {
-	throw unhandled (task, "handleDisappearedEvent");
-    }
-    public TaskState handleContinue (Task task)
-    {
-	throw unhandled (task, "handleContinue");
-    }
-    public TaskState handleRemoval (Task task)
-    {
-	throw unhandled (task, "handleRemoval");
-    }
-    public TaskState handleAttach (Task task)
-    {
-	throw unhandled (task, "handleAttach");
-    }
-    public TaskState handleDetach (Task task, boolean shouldRemoveObservers)
-    {
-	throw unhandled (task, "handleDetach");
-    }
-    public TaskState handleClonedEvent (Task task, Task clone)
-    {
-	throw unhandled (task, "handleClonedEvent");
-    }
-    public TaskState handleForkedEvent (Task task, Task fork)
-    {
-	throw unhandled (task, "handleForkedEvent");
-    }
-    public TaskState handleUnblock (Task task, TaskObserver observer)
-    {
-	throw unhandled (task, "handleUnblock");
-    }
-    public TaskState handleAddObservation (Task task, TaskObservation observation)
-    {
-	throw unhandled (task, "handleAddObservation");
-    }
-    public TaskState handleDeleteObservation (Task task, TaskObservation observation)
-    {
-	throw unhandled (task, "handleDeleteObservation");
-    }
-}
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index 5b75066..45ece90 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,3 +1,19 @@
+2008-01-04  Andrew Cagney  <cagney@redhat.com>
+
+	* LinuxPtraceProcState.java: Merge in deleted
+	frysk.proc.TaskState.
+	* LinuxPtraceProc.java: Update.
+
+	* LinuxPtraceTaskState.java: Merge in deleted
+	frysk.proc.TaskState.
+	* LinuxPtraceTask.java: Update.
+
+	* LiveProc.java: Move all state code from here ...
+	* LinuxPtraceProc.java: ... to here.
+
+	* LiveTask.java: Move all state code from here ...
+	* LinuxPtraceTask.java: ... to here.
+
 2008-01-03  Andrew Cagney  <cagney@redhat.com>
 
 	* LiveTask.java (requestAddInstructionObserver(TaskObserver.Instruction)): New.
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceProc.java b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
index 84d0817..0444021 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceProc.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
@@ -39,6 +39,8 @@
 
 package frysk.proc.live;
 
+import frysk.proc.Action;
+import frysk.proc.Breakpoint;
 import frysk.sys.proc.Exe;
 import frysk.proc.ProcId;
 import frysk.proc.Proc;
@@ -60,7 +62,12 @@ import java.util.Map;
 import java.util.HashMap;
 import frysk.proc.TaskId;
 import java.util.Iterator;
+import frysk.proc.TaskObservable;
 import java.io.File;
+import frysk.proc.Manager;
+import frysk.proc.ProcEvent;
+import frysk.proc.TaskObserver;
+import frysk.proc.TaskObservation;
 
 /**
  * A Linux Proc tracked using PTRACE.
@@ -72,7 +79,8 @@ public class LinuxPtraceProc extends LiveProc {
      * Since PARENT could be NULL, also explicitly pass in the host.
      */
     public LinuxPtraceProc(Host host, Proc parent, ProcId pid, Stat stat) {
-	super(host, parent, pid, LinuxPtraceProcState.initial(false));
+	super(host, parent, pid);
+	this.newState = LinuxPtraceProcState.initial(false);
 	this.stat = stat;
     }
     /**
@@ -80,7 +88,8 @@ public class LinuxPtraceProc extends LiveProc {
      * Task.
      */
     public LinuxPtraceProc(Task task, ProcId forkId) {
-	super(task, forkId, LinuxPtraceProcState.initial(true));
+	super(task, forkId);
+	this.newState = LinuxPtraceProcState.initial(true);
     }
 
     /**
@@ -296,4 +305,413 @@ public class LinuxPtraceProc extends LiveProc {
 	    remove (task);
 	}
     }
+
+
+    /**
+     * The current state of this Proc, during a state transition
+     * newState is null.
+     */
+    private LinuxPtraceProcState oldState;
+    private LinuxPtraceProcState newState;
+
+    /**
+     * Return the current state as a string.
+     */
+    protected String getStateFIXME() {
+	if (newState != null)
+	    return newState.toString();
+	else
+	    return oldState.toString();
+    }
+
+    /**
+     * Return the current state while at the same time marking that
+     * the state is in flux. If a second attempt to change state
+     * occurs before the current state transition has completed,
+     * barf. XXX: Bit of a hack, but at least this prevents state
+     * transition code attempting a second recursive state transition.
+     */
+    private LinuxPtraceProcState oldState() {
+	if (newState == null)
+	    throw new RuntimeException(this + " double state transition");
+	oldState = newState;
+	newState = null;
+	return oldState;
+    }
+  
+    /**
+     * Request that the Proc's task list be refreshed using system
+     * tables.
+     */
+    public void requestRefresh() {
+	logger.log(Level.FINE, "{0} requestRefresh\n", this);
+	Manager.eventLoop.add(new ProcEvent() {
+		public void execute() {
+		    newState = oldState().handleRefresh(LinuxPtraceProc.this);
+		}
+	    });
+    }
+
+    /**
+     * (Internal) Tell the process that is no longer listed in the
+     * system table remove itself.
+     *
+     * XXX: This should not be public.
+     */
+    public void performRemoval() {
+	logger.log(Level.FINEST, "{0} performRemoval -- no longer in /proc\n", this);
+	Manager.eventLoop.add(new ProcEvent() {
+		public void execute() {
+		    newState = oldState().handleRemoval(LinuxPtraceProc.this);
+		}
+	    });
+    }
+
+    /**
+     *(Internal) Tell the process that the corresponding task has
+     * completed its attach.
+     *
+     * XXX: Should not be public.
+     */
+    public void performTaskAttachCompleted (final Task theTask) {
+	logger.log(Level.FINE, "{0} performTaskAttachCompleted\n", this);
+	Manager.eventLoop.add(new ProcEvent() {
+		Task task = theTask;
+
+		public void execute() {
+		    newState = oldState().handleTaskAttachCompleted(LinuxPtraceProc.this, task);
+		}
+	    });
+    }
+
+    /**
+     * (Internal) Tell the process that the corresponding task has
+     * completed its detach.
+     *
+     * XXX: Should not be public.
+     */
+    public void performTaskDetachCompleted(final Task theTask) {
+	logger.log(Level.FINE, "{0} performTaskDetachCompleted\n", this);
+	Manager.eventLoop.add(new ProcEvent() {
+		Task task = theTask;
+		public void execute() {
+		    newState = oldState().handleTaskDetachCompleted(LinuxPtraceProc.this, task);
+		}
+	    });
+    }
+
+    /**
+     * (Internal) Tell the process that the corresponding task has
+     * completed its detach.
+     */
+    protected void performTaskDetachCompleted(final Task theTask, final Task theClone) {
+	logger.log(Level.FINE, "{0} performTaskDetachCompleted/clone\n", this);
+	Manager.eventLoop.add(new ProcEvent() {
+		Task task = theTask;
+
+		Task clone = theClone;
+
+		public void execute() {
+		    newState = oldState().handleTaskDetachCompleted(LinuxPtraceProc.this, task, clone);
+		}
+	    });
+    }
+
+    protected void performDetach() {
+	logger.log(Level.FINE, "{0} performDetach\n", this);
+	Manager.eventLoop.add(new ProcEvent() {
+		public void execute() {
+		    newState = oldState().handleDetach(LinuxPtraceProc.this, true);
+		}
+	    });
+    }
+
+    /**
+     * (internal) Tell the process to add the specified Observation,
+     * attaching the process if necessary.
+     */
+    void handleAddObservation(TaskObservation observation) {
+	newState = oldState().handleAddObservation(this, observation);
+    }
+
+    /**
+     * (Internal) Tell the process to add the specified Observation,
+     * attaching to the process if necessary.
+     *
+     * XXX: Should not be public.
+     */
+    public void requestAddObserver(Task task, TaskObservable observable,
+			    TaskObserver observer) {
+	logger.log(Level.FINE, "{0} requestAddObservation\n", this);
+	Manager.eventLoop.add(new TaskObservation(task, observable, observer, true) {
+		public void execute() {
+		    handleAddObservation(this);
+		}
+	    });
+    }
+
+    /**
+     * Class describing the action to take on the suspended Task
+     * before adding or deleting a Syscall observer.
+     */
+    final class SyscallAction implements Runnable {
+	private final Task task;
+
+	private final boolean addition;
+
+	SyscallAction(Task task, boolean addition) {
+	    this.task = task;
+	    this.addition = addition;
+	}
+
+	public void run() {
+	    int syscallobs = task.syscallObservers.numberOfObservers();
+	    if (addition) {
+		if (syscallobs == 0)
+		    task.startTracingSyscalls();
+	    } else {
+		if (syscallobs == 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]