From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14051 invoked by alias); 2 Feb 2008 08:38:33 -0000 Received: (qmail 14026 invoked by uid 9519); 2 Feb 2008 08:38:32 -0000 Date: Sat, 02 Feb 2008 08:38:00 -0000 Message-ID: <20080202083832.14011.qmail@sourceware.org> From: rmoseley@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Fix error when 'go' command used before 'start' command and after 'load'/'core'. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: d80d5af416877aef88bc9ac2bcd38d17568244cd X-Git-Newrev: 12f10b3aab52bfe1a88c2715cce51d65db013258 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00149.txt.bz2 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 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 + + * GoCommand.java: Fix bz #5714. + * TestGoCommand.java(testGoCommandError()): New for above fix. + 2008-02-01 Rick Moseley * 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