[SCM] master: Delete SyscallEventInfo.number().

cagney@sourceware.org cagney@sourceware.org
Thu Dec 27 20:54:00 GMT 2007


The branch, master has been updated
       via  90b3799ab0d02de462524c4d60a66a9b3e51fa0c (commit)
      from  313740045e4275ac1cef9e089e3042cff90d6d0e (commit)

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

- Log -----------------------------------------------------------------
commit 90b3799ab0d02de462524c4d60a66a9b3e51fa0c
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Dec 27 15:31:52 2007 -0500

    Delete SyscallEventInfo.number().
    
    frysk-core/frysk/proc/ChangeLog
    2007-12-27  Andrew Cagney  <cagney@redhat.com>
    
    	* Syscall.java (INVALID): New.
    	* SyscallEventInfo.java (number(Task)): Delete.
    	(ENTER, EXIT, UNKNOWN): Delete.
    	* Task.java (notifySyscallExit()): Update.
    	(notifySyscallEnter()): Update.
    	* TestSyscallSignal.java: Update.
    	* TestTaskSyscallObserver.java: Update.
    	* LinuxIa32.java: Update.
    	* LinuxPPC32.java: Update.
    	* LinuxX8664.java: Update.
    	* LinuxPPC64.java: Update.

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

Summary of changes:
 frysk-core/frysk/proc/ChangeLog                    |   12 +++
 frysk-core/frysk/proc/LinuxIa32.java               |    2 +-
 frysk-core/frysk/proc/LinuxPPC32.java              |    2 +-
 frysk-core/frysk/proc/LinuxPPC64.java              |    2 +-
 frysk-core/frysk/proc/LinuxX8664.java              |    2 +-
 frysk-core/frysk/proc/Syscall.java                 |   11 +++-
 frysk-core/frysk/proc/SyscallEventInfo.java        |   36 +++-------
 frysk-core/frysk/proc/SyscallTable.java            |    1 +
 frysk-core/frysk/proc/Task.java                    |   76 ++++++++-----------
 frysk-core/frysk/proc/TestSyscallSignal.java       |    3 -
 frysk-core/frysk/proc/TestTaskSyscallObserver.java |   13 ----
 11 files changed, 69 insertions(+), 91 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index 5c8202c..c877298 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,5 +1,17 @@
 2007-12-27  Andrew Cagney  <cagney@redhat.com>
 
+	* Syscall.java (INVALID): New.
+	* SyscallEventInfo.java (number(Task)): Delete.
+	(ENTER, EXIT, UNKNOWN): Delete.
+	* Task.java (notifySyscallExit()): Update.
+	(notifySyscallEnter()): Update.
+	* TestSyscallSignal.java: Update.
+	* TestTaskSyscallObserver.java: Update.
+	* LinuxIa32.java: Update.
+	* LinuxPPC32.java: Update.
+	* LinuxX8664.java: Update.
+	* LinuxPPC64.java: Update.
+
 	* Syscall.java (iterateSyscallByName(String,Syscall[])): Move to ...
 	* SyscallTable.java (iterateSyscallByName(String,Syscall[])): New.
 	* LinuxX8664Syscall.java: Update.
diff --git a/frysk-core/frysk/proc/LinuxIa32.java b/frysk-core/frysk/proc/LinuxIa32.java
index b488ff8..695b3db 100644
--- a/frysk-core/frysk/proc/LinuxIa32.java
+++ b/frysk-core/frysk/proc/LinuxIa32.java
@@ -170,7 +170,7 @@ class LinuxIa32 implements SyscallEventDecoder, Isa {
     public SyscallEventInfo getSyscallEventInfo() {
 	if (info == null)
 	    info = new SyscallEventInfo() {
-		    public int number (Task task) {
+		    private int number(Task task) {
 			return (int)task.getRegister(IA32Registers.ORIG_EAX);
 		    }
 		    public Syscall getSyscall(Task task) {
diff --git a/frysk-core/frysk/proc/LinuxPPC32.java b/frysk-core/frysk/proc/LinuxPPC32.java
index 149b0c0..83f6836 100644
--- a/frysk-core/frysk/proc/LinuxPPC32.java
+++ b/frysk-core/frysk/proc/LinuxPPC32.java
@@ -68,7 +68,7 @@ class LinuxPPC32 extends IsaPowerPC implements SyscallEventDecoder {
     public SyscallEventInfo getSyscallEventInfo () {
 	if (info == null)
 	    info = new SyscallEventInfo () {
-		    public int number (Task task) {
+		    private int number(Task task) {
 			logger.log (Level.FINE, "Get GPR0\n");
 			return (int)task.getRegister(PPC32Registers.GPR0);
 		    }
diff --git a/frysk-core/frysk/proc/LinuxPPC64.java b/frysk-core/frysk/proc/LinuxPPC64.java
index b6c2e83..e793660 100644
--- a/frysk-core/frysk/proc/LinuxPPC64.java
+++ b/frysk-core/frysk/proc/LinuxPPC64.java
@@ -68,7 +68,7 @@ class LinuxPPC64 extends IsaPowerPC implements SyscallEventDecoder
     public SyscallEventInfo getSyscallEventInfo () {
 	if (info == null)
 	    info = new SyscallEventInfo () {
-		    public int number (Task task) {
+		    private int number(Task task) {
 			logger.log (Level.FINE, "Get GPR0\n");
 			return (int)task.getRegister(PPC64Registers.GPR0);
 		    }
diff --git a/frysk-core/frysk/proc/LinuxX8664.java b/frysk-core/frysk/proc/LinuxX8664.java
index 2fa440f..7bd8ff8 100644
--- a/frysk-core/frysk/proc/LinuxX8664.java
+++ b/frysk-core/frysk/proc/LinuxX8664.java
@@ -174,7 +174,7 @@ class LinuxX8664 implements SyscallEventDecoder, Isa {
     public SyscallEventInfo getSyscallEventInfo () {
 	if (info == null)
 	    info = new SyscallEventInfo () {
-		    public int number (Task task) {
+		    private int number(Task task) {
 			return (int)task.getRegister(X8664Registers.ORIG_RAX);
 		    }
 		    public Syscall getSyscall(Task task) {
diff --git a/frysk-core/frysk/proc/Syscall.java b/frysk-core/frysk/proc/Syscall.java
index c6f26fd..ac012da 100644
--- a/frysk-core/frysk/proc/Syscall.java
+++ b/frysk-core/frysk/proc/Syscall.java
@@ -49,6 +49,15 @@ import java.util.HashMap;
  */
 
 public abstract class Syscall {
+    public static final Syscall INVALID = new Syscall("<invalid>", -1) {
+	    public long getArguments(Task task, int n) {
+		return 0;
+	    }
+	    public long getReturnCode(Task task) {
+		return 0;
+	    }
+	};
+
     private final int number;
     private final int numArgs;
     private final String name;
@@ -257,7 +266,7 @@ public abstract class Syscall {
 	unknownSyscalls = syscallTable.getUnknownSyscalls();
 
 	if (num < 0) {
-	    throw new RuntimeException ("Negative syscall number: " + num);
+	    return INVALID;
 	} else if (num >= syscallList.length) {
 	    synchronized (unknownSyscalls) {
 		Integer key = new Integer(num);
diff --git a/frysk-core/frysk/proc/SyscallEventInfo.java b/frysk-core/frysk/proc/SyscallEventInfo.java
index fa6e5fd..9873250 100644
--- a/frysk-core/frysk/proc/SyscallEventInfo.java
+++ b/frysk-core/frysk/proc/SyscallEventInfo.java
@@ -42,31 +42,15 @@ package frysk.proc;
  * An object that retrieves syscall info from a task. Used in combination
  * with Syscall and a Task object to retrieve information.
  */
-public abstract class SyscallEventInfo
-{
-  public final static int ENTER = 0;
-  public final static int EXIT = 1;
-  public final static int UNKNOWN = -1;
-  
-  /**
-   * Returns the syscall number of the system call the the
-   * given task just made.
-   * This function assumes that the given task is currently
-   * in the system call. This function should not be called
-   * otherwise.
-   * @param task the task which made the system call
-   * @return the number of the system call that was made
-   */
-  public abstract int number (Task task);
-  
-  /** 
-   * getSyscall does everything on the assumption that there is a 
-   * system, and programmer want to know the information about this
-   * system call.  A meaningless Syscall object is returned when
-   * getSyscall is called at the moment no system call occurs.
-   * @param task the task that system call occurred
-   * @return the Syscall object
-   */
-  public abstract Syscall getSyscall (Task task);
+public abstract class SyscallEventInfo {
+    /** 
+     * getSyscall does everything on the assumption that there is a 
+     * system, and programmer want to know the information about this
+     * system call.  A meaningless Syscall object is returned when
+     * getSyscall is called at the moment no system call occurs.
+     * @param task the task that system call occurred
+     * @return the Syscall object
+     */
+    public abstract Syscall getSyscall (Task task);
   
 }
diff --git a/frysk-core/frysk/proc/SyscallTable.java b/frysk-core/frysk/proc/SyscallTable.java
index cc582b6..245fb42 100644
--- a/frysk-core/frysk/proc/SyscallTable.java
+++ b/frysk-core/frysk/proc/SyscallTable.java
@@ -46,6 +46,7 @@ import java.util.HashMap;
  */
 
 public abstract class SyscallTable {
+
     /**
      * @return Syscall[] return system call list for this Linux<ISA>.
      */
diff --git a/frysk-core/frysk/proc/Task.java b/frysk-core/frysk/proc/Task.java
index f22b1b0..2d5f4b3 100644
--- a/frysk-core/frysk/proc/Task.java
+++ b/frysk-core/frysk/proc/Task.java
@@ -758,51 +758,39 @@ public abstract class Task
     logger.log(Level.FINE, "{0} requestDeleteSyscallObserver\n", this);
   }
 
-  /**
-   * Notify all Syscall observers of this Task's entry into a system call.
-   * Return the number of blocking observers.
-   *
-   * XXX: Should not be public.
-   */
-  public int notifySyscallEnter ()
-  {
-      logger.log(Level.FINE,
-		 "{0} notifySyscallEnter {1}\n",
-		 new Object[] 
-		 { this,
-		   new Integer(this.getSyscallEventInfo().number(this))
-		 });
-    for (Iterator i = syscallObservers.iterator(); i.hasNext();)
-      {
-        TaskObserver.Syscall observer = (TaskObserver.Syscall) i.next();
-        if (observer.updateSyscallEnter(this) == Action.BLOCK)
-          blockers.add(observer);
-      }
-    return blockers.size();
-  }
+    /**
+     * Notify all Syscall observers of this Task's entry into a system
+     * call.  Return the number of blocking observers.
+     *
+     * XXX: Should not be public.
+     */
+    public int notifySyscallEnter () {
+	logger.log(Level.FINE,
+		   "{0} notifySyscallEnter\n", this);
+	for (Iterator i = syscallObservers.iterator(); i.hasNext();) {
+	    TaskObserver.Syscall observer = (TaskObserver.Syscall) i.next();
+	    if (observer.updateSyscallEnter(this) == Action.BLOCK)
+		blockers.add(observer);
+	}
+	return blockers.size();
+    }
 
-  /**
-   * Notify all Syscall observers of this Task's exit from a system
-   * call. Return the number of blocking observers.
-   *
-   * XXX: Should not be public.
-   */
-  public int notifySyscallExit ()
-  {
-      logger.log(Level.FINE,
-		 "{0} notifySyscallExit {1}\n",
-		 new Object[] 
-		 { this,
-		   new Integer(this.getSyscallEventInfo().number(this))
-		 });
-    for (Iterator i = syscallObservers.iterator(); i.hasNext();)
-      {
-        TaskObserver.Syscall observer = (TaskObserver.Syscall) i.next();
-        if (observer.updateSyscallExit(this) == Action.BLOCK)
-          blockers.add(observer);
-      }
-    return blockers.size();
-  }
+    /**
+     * Notify all Syscall observers of this Task's exit from a system
+     * call. Return the number of blocking observers.
+     *
+     * XXX: Should not be public.
+     */
+    public int notifySyscallExit () {
+	logger.log(Level.FINE,
+		   "{0} notifySyscallExit {1}\n", this);
+	for (Iterator i = syscallObservers.iterator(); i.hasNext();) {
+	    TaskObserver.Syscall observer = (TaskObserver.Syscall) i.next();
+	    if (observer.updateSyscallExit(this) == Action.BLOCK)
+		blockers.add(observer);
+	}
+	return blockers.size();
+    }
 
   /**
    * Set of Signaled observers.
diff --git a/frysk-core/frysk/proc/TestSyscallSignal.java b/frysk-core/frysk/proc/TestSyscallSignal.java
index 44cfbaf..737b832 100644
--- a/frysk-core/frysk/proc/TestSyscallSignal.java
+++ b/frysk-core/frysk/proc/TestSyscallSignal.java
@@ -273,9 +273,6 @@ public class TestSyscallSignal
 
 	public Action updateSyscallExit(Task task) {
 	    SyscallEventInfo syscallEventInfo = getSyscallEventInfo(task);
-	    // XXX - workaround for broken syscall detection on exit
-	    if (syscallEventInfo.number(task) == -1)
-		return Action.CONTINUE;
 	    frysk.proc.Syscall syscall = syscallEventInfo.getSyscall(task);
 	    if (opensys.equals(syscall) || closesys.equals(syscall)) {
 		exited++;
diff --git a/frysk-core/frysk/proc/TestTaskSyscallObserver.java b/frysk-core/frysk/proc/TestTaskSyscallObserver.java
index d212969..05d008c 100644
--- a/frysk-core/frysk/proc/TestTaskSyscallObserver.java
+++ b/frysk-core/frysk/proc/TestTaskSyscallObserver.java
@@ -100,10 +100,6 @@ public class TestTaskSyscallObserver
 	    enter++;
 
 	    SyscallEventInfo syscallEventInfo = getSyscallEventInfo(task);
-	    // XXX - workaround for broken syscall detection on exit
-	    if (syscallEventInfo.number(task) == - 1)
-		return Action.CONTINUE;
-
 	    frysk.proc.Syscall syscall = syscallEventInfo.getSyscall(task);
 
 	    if (execvesys.equals(syscall)) {
@@ -420,12 +416,6 @@ public class TestTaskSyscallObserver
     public Action updateSyscallExit (Task task)
     {
       super.updateSyscallExit(task);
-      SyscallEventInfo syscallEventInfo = getSyscallEventInfo(task);
-      
-      // XXX - workaround for broken syscall detection on exit
-      if (syscallEventInfo.number(task) == - 1)
-        return Action.CONTINUE;
-      
       frysk.proc.Syscall syscall = (frysk.proc.Syscall) syscallCache.remove(task);
       
       if (opensys.equals(syscall) && openingTestFile)
@@ -535,9 +525,6 @@ public class TestTaskSyscallObserver
       {
         super.updateSyscallExit(task);
         SyscallEventInfo syscallEventInfo = getSyscallEventInfo(task);
-        // XXX - workaround for broken syscall detection on exit
-        if (syscallEventInfo.number(task) == - 1)
-          return Action.CONTINUE;
         frysk.proc.Syscall syscall = syscallEventInfo.getSyscall(task);
         if (readsys.equals(syscall))
           {


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



More information about the Frysk-cvs mailing list