public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Fix error when 'go' command used before 'start' command and after 'load'/'core'.
@ 2008-02-02  8:38 rmoseley
  0 siblings, 0 replies; only message in thread
From: rmoseley @ 2008-02-02  8:38 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  12f10b3aab52bfe1a88c2715cce51d65db013258 (commit)
      from  d80d5af416877aef88bc9ac2bcd38d17568244cd (commit)

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

- Log -----------------------------------------------------------------
commit 12f10b3aab52bfe1a88c2715cce51d65db013258
Author: Rick Moseley <rmoseley@localhost.localdomain>
Date:   Sat Feb 2 02:37:10 2008 -0600

    Fix error when 'go' command used before 'start' command and after 'load'/'core'.
    
    * GoCommand.java: Fix bz #5714.
    * TestGoCommand.java(testGoCommandError()): New for above fix.

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

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog          |    5 ++++
 frysk-core/frysk/hpd/GoCommand.java     |   33 +++++++++++++++++-------------
 frysk-core/frysk/hpd/TestGoCommand.java |   31 +++++++++++++++++++++++-----
 3 files changed, 49 insertions(+), 20 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index ca5c749..434c3c3 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-02  Rick Moseley  <rmoseley@redhat.com>
+
+	* GoCommand.java: Fix bz #5714.
+	* TestGoCommand.java(testGoCommandError()): New for above fix.
+
 2008-02-01  Rick Moseley  <rmoseley@redhat.com>
 
 	* GoCommand.java: Fix bz#5674.
diff --git a/frysk-core/frysk/hpd/GoCommand.java b/frysk-core/frysk/hpd/GoCommand.java
index 321d7c4..246d79d 100644
--- a/frysk-core/frysk/hpd/GoCommand.java
+++ b/frysk-core/frysk/hpd/GoCommand.java
@@ -62,14 +62,10 @@ class GoCommand extends ParameterizedCommand {
 	if (cli.steppingObserver != null) {
 	    Iterator taskIter = ptset.getTasks();
 	    SteppingEngine steppingEngine = cli.getSteppingEngine();
-//	    HashMap loadedProcs = cli.getLoadedProcs();
-//	    HashMap coreProcs = cli.getCoreProcs();
+
 	    while (taskIter.hasNext()) {
 		Task task = (Task) taskIter.next();
-//		int taskPid = task.getProc().getPid();
-		if (!steppingEngine.isTaskRunning(task)) { //&& 
-//			CLI.notRunningProc(taskPid, loadedProcs) && 
-//			CLI.notRunningProc(taskPid, coreProcs)) {
+		if (!steppingEngine.isTaskRunning(task)) {
 		    /* Try to continue task, if an exception occurs it is 
 		     * probably because it is already running and previously
 		     * has not been marked as such.  Until the
@@ -77,17 +73,26 @@ class GoCommand extends ParameterizedCommand {
 		     * can do for now.
 		     */
 		    try {
+			if (CLI.notRunningProc(task.getProc().getPid(), cli.getLoadedProcs()) || 
+				CLI.notRunningProc(task.getProc().getPid(), cli.getCoreProcs())) {
+				cli.addMessage("Cannot use 'go' on a loaded or core file, must " +
+					"use 'start' first",
+					Message.TYPE_ERROR);
+				continue;
+			}
 			steppingEngine.continueExecution(task);
+			cli.addMessage("Running process " + task.getProc().getPid(),
+				Message.TYPE_NORMAL);
 		    } catch (Exception e) {
-			// OK, caught an exception, set the task to running
-			steppingEngine.setTaskRunning(task);
+			// OK, caught an exception, try to set the task to running
+			try {
+			    steppingEngine.setTaskRunning(task);
+			} catch (Exception err) {
+			    cli.addMessage("Process " + task.getProc().getPid() + " already running",
+				    Message.TYPE_NORMAL);
+			}
 		    }
-		} // else if (CLI.notRunningProc(taskPid, loadedProcs) || 
-		//	CLI.notRunningProc(taskPid, coreProcs))
-		  //     cli.addMessage("Cannot use 'go' on a loaded or core file, must 'start' first", Message.TYPE_WARNING);
-		//else
-		    cli.addMessage("Running process " + task.getProc().getPid(),
-			Message.TYPE_NORMAL);
+		}
 	    }
 	} else
 	    cli.addMessage("Not attached to any process", Message.TYPE_ERROR);
diff --git a/frysk-core/frysk/hpd/TestGoCommand.java b/frysk-core/frysk/hpd/TestGoCommand.java
index c332887..2242ee1 100644
--- a/frysk-core/frysk/hpd/TestGoCommand.java
+++ b/frysk-core/frysk/hpd/TestGoCommand.java
@@ -53,20 +53,39 @@ public class TestGoCommand extends TestLib {
 	"Loaded executable file.*");
 	//e.sendCommandExpectPrompt("run ",
 	//	"Attached to process ([0-9]+).*Running process ([0-9]+).*");
-	e.send("run\n");
-	e.expect("Attached to process ([0-9]+).*");
-	e.expect("Running process ([0-9]+).*" + prompt);
-	e.sendCommandExpectPrompt("go","Running process ([0-9]+).*");
+	e.sendCommandExpectPrompt("start", "Attached to process ([0-9]+).*");
+	e.sendCommandExpectPrompt("go", "Running process ([0-9]+).*");
 	e.send("quit\n");
 	e.expect("Quitting\\.\\.\\.");
 	e.close();
     }
     
-/*    public void testGoCommandError() {
+    /**
+     * testGoCommandError tests the condition when a 'go' command is issued on
+     * a loaded core file or executable before a 'start' or 'run' is issued.
+     */
+    public void testGoCommandError() {
 	e = new HpdTestbed();
 	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(),
 	"Loaded executable file.*");
-	e.sendCommandExpectPrompt("go", "Warning: Cannot use.*");
+	e.sendCommandExpectPrompt("go", "Error: Cannot use.*");
+	e.send("quit\n");
+	e.expect("Quitting\\.\\.\\.");
+	e.close(); 
+    }
+    
+    /**
+     * testGoCommandErrorTwo tests the condition when a 'go' command is issued on
+     * a loaded core file or executable before a 'start' or 'run' is issued.
+     * 
+     * Future test when bz #5674 is resolved.
+     */
+ /*   public void testGoCommandErrorTwo() {
+	e = new HpdTestbed();
+	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(),
+	"Loaded executable file.*");
+	e.sendCommandExpectPrompt("run", "Attached to process.*Running process.*");
+	e.sendCommandExpectPrompt("go", "Error: Cannot use.*");
 	e.send("quit\n");
 	e.expect("Quitting\\.\\.\\.");
 	e.close(); 


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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-02  8:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-02  8:38 [SCM] master: Fix error when 'go' command used before 'start' command and after 'load'/'core' rmoseley

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).