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: Fix a few small bugs, start/run looper and duplicate method removal.


The branch, master has been updated
       via  d25bf85036ec9bd992ee2f356a614d4bf4e051ff (commit)
      from  63b760ae473b2baa4b520bcbc5e0f725a5e6d7a8 (commit)

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

- Log -----------------------------------------------------------------
commit d25bf85036ec9bd992ee2f356a614d4bf4e051ff
Author: Rick Moseley <rmoseley@localhost.localdomain>
Date:   Mon Feb 11 18:35:53 2008 -0600

    Fix a few small bugs, start/run looper and duplicate method removal.
    
    * ProcTaskIDManager.java: Remove duplicate method.
    * CLI.java: Fix call to duplicate method.
    * StartRun.java: Fix error in looping for start/run.

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

Summary of changes:
 frysk-core/frysk/hpd/CLI.java              |    2 +-
 frysk-core/frysk/hpd/ChangeLog             |    2 +
 frysk-core/frysk/hpd/StartRun.java         |   27 +++++++++++++++-------
 frysk-core/frysk/hpd/TestRunCommand.java   |   33 ++++++++++++++++++++++++++++
 frysk-core/frysk/rt/ChangeLog              |    4 +++
 frysk-core/frysk/rt/ProcTaskIDManager.java |   23 ++++++++-----------
 6 files changed, 68 insertions(+), 23 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/CLI.java b/frysk-core/frysk/hpd/CLI.java
index 61f5033..9c39a9f 100644
--- a/frysk-core/frysk/hpd/CLI.java
+++ b/frysk-core/frysk/hpd/CLI.java
@@ -178,7 +178,7 @@ public class CLI {
             idManager.manageProc(proc, idManager.reserveProcID());
         // Assign this proc to the passed in procID 
         else
-            idManager.manageProcSelect(proc, this.taskID);
+            idManager.manageProc(proc, this.taskID);
     }
 
     final PrintWriter outWriter;
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 0f710d5..0af5c04 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -5,6 +5,8 @@
 	* TestLoadCommand.java: Test above.
 	* KillCommand.java: Added path-to-proc to the output info.
 	* TopLevelCommand.java: Added UnloadCommand.java.
+	* CLI.java: Fix call to duplicate method.
+	* StartRun.java: Fix error in looping for start/run.
 
 
 2008-02-08  Stan Cox  <scox@redhat.com>
diff --git a/frysk-core/frysk/hpd/StartRun.java b/frysk-core/frysk/hpd/StartRun.java
index bda78bf..fa58e6c 100644
--- a/frysk-core/frysk/hpd/StartRun.java
+++ b/frysk-core/frysk/hpd/StartRun.java
@@ -159,23 +159,34 @@ class StartRun extends ParameterizedCommand {
     public void interpretCmd(CLI cli, Input cmd, Object options) {
 	// See if there are any running tasks, if so, process them
 	// if there are not any procs loaded with the load/core commands
-	Iterator foo = cli.targetset.getTasks();
+	Iterator foo = cli.targetset.getTaskData();
 	if (foo.hasNext()) {
 	    if (cli.coreProcs.isEmpty() && cli.loadedProcs.isEmpty()) {
 		// Clear the parameters for this process
 		int oldPid = -1;
+		TaskData taskData = null;
 		while (foo.hasNext()) {
-		    Task task = (Task) foo.next();
+		    taskData = (TaskData) foo.next();
+		    Task task = taskData.getTask();
 		    // Need only one kill per PID(proc)
 		    if (task.getProc().getPid() == oldPid) {
 			continue;
-		    } else 
+		    } else {
 			cli.execCommand("kill\n");
-		    String paramList = getParameters(cmd, task);
-		    Input newcmd = new Input(task.getProc().getExe() + " " +
+			int taskid = taskData.getParentID();
+			synchronized (cli) {
+				cli.taskID = taskid;
+			}
+			String paramList = getParameters(cmd, task);
+		    	Input newcmd = new Input(task.getProc().getExe() + " " +
 			    paramList);
-		    run(cli, newcmd);
-		    oldPid = task.getProc().getPid();
+		    	run(cli, newcmd);
+		    	synchronized (cli) {
+				cli.taskID = -1;
+				cli.loadedProcs.clear();
+			}
+		    	oldPid = task.getProc().getPid();
+		    }
 		}
 		return;
 	    }
@@ -250,8 +261,6 @@ class StartRun extends ParameterizedCommand {
 	    cli.addMessage("starting/running with this command: " + 
 		    newcmd, Message.TYPE_NORMAL);
 	    run(cli, newcmd);
-	    //if (runToBreak)
-		//cli.execCommand("go\n");
 	    synchronized (cli) {
 		cli.taskID = -1;
 	    }
diff --git a/frysk-core/frysk/hpd/TestRunCommand.java b/frysk-core/frysk/hpd/TestRunCommand.java
index 151368d..30735bb 100644
--- a/frysk-core/frysk/hpd/TestRunCommand.java
+++ b/frysk-core/frysk/hpd/TestRunCommand.java
@@ -141,4 +141,37 @@ public class TestRunCommand extends TestLib {
 	e.expect("Quitting\\.\\.\\.");
 	e.close();
     }
+    
+    /**
+     * This test case tests a kind of corner case where a single threaded process gets loaded and
+     * then right after a two-threaded looping process gets loaded.  Then a 'run' command is issued
+     * and the first process runs to completion.  If the 'run' command is issued again it should
+     * just rerun the currently running process and place in in the same place in the target set.
+     */
+    public void testRunCommandTwoProcesses() {
+	if (unresolved(5615))
+	    return;
+	e = new HpdTestbed();
+	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-hello").getPath(),
+	"Loaded executable file.*");
+	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(),
+	"Loaded executable file.*");
+	e.sendCommandExpectPrompt("focus", "Target set.*\\[0\\.0\\]\t\t0\t0.*"+
+	"\\[1\\.0\\]\t\t0*\\t0.*");
+	e.sendCommandExpectPrompt("run", "Attached to process ([0-9]+).*Attached to process ([0-9]+).*" +
+		"starting.*" + "Running process ([0-9]+).*starting.*Running process ([0-9]+).*");
+	//e.sendCommandExpectPrompt("run", "Killing process ([0-9]+).*Loaded executable file.*" +
+	//	"Attached to process ([0-9]+).*starting.*Running process ([0-9]+).*starting.*" +
+	//	"Running process ([0-9]+).*");
+	e.send("run\n");
+	e.expect("Killing process ([0-9]+).*");
+	e.expect("Loaded executable file.*");
+	e.expect("Attached to process ([0-9]+).*");
+	e.expect("Running process ([0-9]+).*");
+	e.sendCommandExpectPrompt("focus", "Target set.*\\[1\\.0\\]\t\t([0-9]+)\t([0-9]+).*" +
+		"\\[1\\.1\\]\t\t([0-9]+).*\\t([0-9]+).*");
+	e.send("quit\n");
+	e.expect("Quitting\\.\\.\\.");
+	e.close();
+    }
 }
\ No newline at end of file
diff --git a/frysk-core/frysk/rt/ChangeLog b/frysk-core/frysk/rt/ChangeLog
index ce3d9d1..2e8a851 100644
--- a/frysk-core/frysk/rt/ChangeLog
+++ b/frysk-core/frysk/rt/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-11  Rick Moseley  <rmoseley@redhat.com>
+
+	* ProcTaskIDManager.java: Remove duplicate method.
+
 2008-02-04  Tim Moore  <timoore@redhat.com>
 
 	* BreakpointManager.java (enableBreakpoint, disableBreakpoint): Pass breakpoint in
diff --git a/frysk-core/frysk/rt/ProcTaskIDManager.java b/frysk-core/frysk/rt/ProcTaskIDManager.java
index 22a9eda..96188a4 100644
--- a/frysk-core/frysk/rt/ProcTaskIDManager.java
+++ b/frysk-core/frysk/rt/ProcTaskIDManager.java
@@ -88,15 +88,6 @@ public class ProcTaskIDManager
         procList.add(null);
         return result;
     }
-    
-    public void manageProcSelect(Proc proc, int usedID) {
-	ProcEntry entry;
-	synchronized (this) {
-	    entry = new ProcEntry(proc, usedID);
-	    procList.set(usedID, entry);
-	    procMap.put(proc, new Integer(usedID));
-	}
-    }
 
     public void manageProc(Proc proc, int reservedID) {
         ProcEntry entry;
@@ -183,10 +174,13 @@ public class ProcTaskIDManager
         int id = getProcID(proc);
         if (id < 0)
             return Action.CONTINUE;
+        ProcEntry entry;
         synchronized (this) {
-            ProcEntry entry = (ProcEntry)procList.get(id);
+            entry = (ProcEntry)procList.get(id);
+        }
             if (entry == null)
                 return Action.CONTINUE;
+        synchronized (this) {
             int taskID = entry.tasks.size();
             entry.tasks.add(offspring);
             entry.taskMap.put(offspring, new Integer(taskID));
@@ -205,10 +199,13 @@ public class ProcTaskIDManager
         int id = getProcID(proc);
         if (id < 0 || procList.isEmpty())
             return Action.CONTINUE;
+        ProcEntry entry;
+        synchronized (this) {
+            entry = (ProcEntry)procList.get(id);
+        }
+        if (entry == null)
+            return Action.CONTINUE;
         synchronized (this) {
-            ProcEntry entry = (ProcEntry)procList.get(id);
-            if (entry == null)
-                return Action.CONTINUE;
             Integer taskIDInt = (Integer)entry.taskMap.get(task);
             if (taskIDInt != null) {
                 entry.taskMap.remove(task);


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]