public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Implement run to run until first breakpoint.
@ 2008-01-03  7:28 rmoseley
  0 siblings, 0 replies; only message in thread
From: rmoseley @ 2008-01-03  7:28 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  3429ca4a01bdd6da988de7228fd46c7846dc91e7 (commit)
      from  6c524b69dd8d33075e37886dafaf69f492c0a30f (commit)

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

- Log -----------------------------------------------------------------
commit 3429ca4a01bdd6da988de7228fd46c7846dc91e7
Author: Rick Moseley <rmoseley@localhost.localdomain>
Date:   Thu Jan 3 01:26:51 2008 -0600

    Implement run to run until first breakpoint.
    
    * RunCommand.java: Run to breakpoint instead of first instruction.
    * TestRunCommand.java: New.
    * TestListCommand.java: Use HpdTestbed.start instead of HpdTestbed.run.
    * TestBreakpoints.java: Ditto.
    * TestLoadCommand.java: Ditto.

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

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog                     |    8 +++
 frysk-core/frysk/hpd/RunCommand.java               |   16 ++++++-
 frysk-core/frysk/hpd/TestBreakpoints.java          |    8 ++--
 frysk-core/frysk/hpd/TestListCommand.java          |    8 ++--
 frysk-core/frysk/hpd/TestLoadCommand.java          |   10 ++--
 ...isassemblerCommand.java => TestRunCommand.java} |   46 ++++++++++++--------
 6 files changed, 62 insertions(+), 34 deletions(-)
 copy frysk-core/frysk/hpd/{TestDisassemblerCommand.java => TestRunCommand.java} (64%)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 75c2749..bb4d85c 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-02  Rick Moseley  <rmoseley@redhat.com>
+
+	* RunCommand.java: Run to breakpoint instead of first instruction.
+	* TestRunCommand.java: New.
+	* TestListCommand.java: Use HpdTestbed.start instead of HpdTestbed.run.
+	* TestBreakpoints.java: Ditto.
+	* TestLoadCommand.java: Ditto.
+
 2008-01-02  Andrew Cagney  <cagney@redhat.com>
 
 	* CoreCommand.java: Update; frysk.proc.dead.LinuxHost renamed to
diff --git a/frysk-core/frysk/hpd/RunCommand.java b/frysk-core/frysk/hpd/RunCommand.java
index ee78d69..a7307aa 100644
--- a/frysk-core/frysk/hpd/RunCommand.java
+++ b/frysk-core/frysk/hpd/RunCommand.java
@@ -128,14 +128,24 @@ class RunCommand extends ParameterizedCommand {
 	/* If the run command is given no args, check to see if 
 	   any procs were loaded with the load command or loaded
 	   when fhpd was started or loaded with the core command*/
-	if (cmd.size() < 1) {
-	    if (cli.coreProcs.isEmpty() && cli.loadedProcs.isEmpty())
-		throw new InvalidCommandException("missing program");
+	Iterator foo = cli.targetset.getTasks();
+	if (cmd.size() < 1 && foo.hasNext()) {
+	    if (cli.coreProcs.isEmpty() && cli.loadedProcs.isEmpty()) {
+		cli.execCommand("kill");
+		cli.execCommand("start");
+		cli.execCommand("go");
+		return;
+	    }
+	} else if (cmd.size() < 1 && !foo.hasNext()) {
+	    cli.addMessage("No procs in targetset to run", 
+		    Message.TYPE_NORMAL);
+	    return;
 	}
 	
 	// If a parameter was given the run command, go ahead and run it
 	if (cmd.size() >= 1) {
 	    run(cli, cmd);
+	    cli.execCommand("go");
 	    return;
 	}
 	
diff --git a/frysk-core/frysk/hpd/TestBreakpoints.java b/frysk-core/frysk/hpd/TestBreakpoints.java
index 7d5ad4b..f739a2f 100644
--- a/frysk-core/frysk/hpd/TestBreakpoints.java
+++ b/frysk-core/frysk/hpd/TestBreakpoints.java
@@ -57,7 +57,7 @@ public class TestBreakpoints
     }
     
     public void testHpdBreakpointRunProcess() {
-	e = HpdTestbed.run("hpd-c");
+	e = HpdTestbed.start("hpd-c");
 	// Break
 	e.send("break #hpd-c.c#196\n");	// This has to break on: while (int_21)
 	e.expect("breakpoint.*" + prompt);
@@ -115,7 +115,7 @@ public class TestBreakpoints
     public void testHpdBreakMultiThreaded() {
 	if (unresolved(5351))
 	    return;
-	e = HpdTestbed.run("funit-fib-clone", "3");
+	e = HpdTestbed.start("funit-fib-clone", "3");
 	// Break
 	e.send("break fib\n");	
 	e.expect("breakpoint.*" + prompt);
@@ -141,7 +141,7 @@ public class TestBreakpoints
 	if(unresolved(5280)){
 	    return;
 	}
-	e = HpdTestbed.run("funit-fib-clone", "3");
+	e = HpdTestbed.start("funit-fib-clone", "3");
 	// Break
 	e.send("break fib\n");	
 	e.expect("breakpoint.*" + prompt);
@@ -178,7 +178,7 @@ public class TestBreakpoints
   // name as a structure member.
 
   public void testBreakOnStructMemberName() {
-      e = HpdTestbed.run("funit-structmember");
+      e = HpdTestbed.start("funit-structmember");
       e.send("break testfn\n");
       e.expect("break.*" + prompt);
       e.send("go\n");
diff --git a/frysk-core/frysk/hpd/TestListCommand.java b/frysk-core/frysk/hpd/TestListCommand.java
index 8b2a015..c04ba47 100644
--- a/frysk-core/frysk/hpd/TestListCommand.java
+++ b/frysk-core/frysk/hpd/TestListCommand.java
@@ -51,7 +51,7 @@ public class TestListCommand extends TestLib {
     }
 
     public void testListPC() {
-	e = HpdTestbed.run("funit-quicksort");
+	e = HpdTestbed.start("funit-quicksort");
 	e.sendCommandExpectPrompt("break main", "breakpoint.*");
         e.send("go\n");
         e.expect("go.*\n" + prompt + "Breakpoint");
@@ -78,7 +78,7 @@ public class TestListCommand extends TestLib {
 
 
     public void testListFunction() {
-	e = HpdTestbed.run("funit-quicksort");
+	e = HpdTestbed.start("funit-quicksort");
 	e.sendCommandExpectPrompt("break main", "breakpoint.*");
         e.send("go\n");
         e.expect("go.*\n" + prompt + "Breakpoint");
@@ -122,7 +122,7 @@ public class TestListCommand extends TestLib {
     }
 
     public void testListReverse() {
-	e = HpdTestbed.run("funit-quicksort");
+	e = HpdTestbed.start("funit-quicksort");
 	e.sendCommandExpectPrompt("break main", "breakpoint.*");
         e.send("go\n");
         e.expect("go.*\n" + prompt + "Breakpoint");
@@ -156,7 +156,7 @@ public class TestListCommand extends TestLib {
     }
 
     public void testListErrors() {
-	e = HpdTestbed.run("funit-quicksort");
+	e = HpdTestbed.start("funit-quicksort");
 	e.sendCommandExpectPrompt("break main", "breakpoint.*");
         e.send("go\n");
         e.expect("go.*\n" + prompt + "Breakpoint");
diff --git a/frysk-core/frysk/hpd/TestLoadCommand.java b/frysk-core/frysk/hpd/TestLoadCommand.java
index fdb12e9..b69ec72 100644
--- a/frysk-core/frysk/hpd/TestLoadCommand.java
+++ b/frysk-core/frysk/hpd/TestLoadCommand.java
@@ -65,7 +65,7 @@ public class TestLoadCommand extends TestLib {
 	e.close();
     }
     
-    public void testLoadRun() {
+    public void testLoadStart() {
 	e = new HpdTestbed();
 	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-hello").getPath(),
 		"Loaded executable file.*");
@@ -75,7 +75,7 @@ public class TestLoadCommand extends TestLib {
 		"Loaded executable file.*");
 	e.sendCommandExpectPrompt("focus", "Target set.*\\[0\\.0\\]\t\t0\t0.*"+
 		"\\[1\\.0\\]\t\t0*\\t0.*");
-	e.sendCommandExpectPrompt("run", "Attached to process.*Attached to process.*");
+	e.sendCommandExpectPrompt("start", "Attached to process.*Attached to process.*");
 	e.sendCommandExpectPrompt("focus", "Target set.*\\[0\\.0\\].*\\[1\\.0].*");
 	e.send("quit\n");
 	e.expect("Quitting...");
@@ -84,11 +84,11 @@ public class TestLoadCommand extends TestLib {
     
     public void testLoadRunRun() {
 	e = new HpdTestbed();
-	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-hello").getPath(),
+	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(),
 		"Loaded executable file.*");
-	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-hello").getPath(),
+	e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(),
 		"Loaded executable file.*");
-	e.sendCommandExpectPrompt("run", "Attached to process.*Attached to process.*");
+	e.sendCommandExpectPrompt("start", "Attached to process.*Attached to process.*");
 	e.send("quit\n");
 	e.expect("Quitting...");
 	e.close();
diff --git a/frysk-core/frysk/hpd/TestDisassemblerCommand.java b/frysk-core/frysk/hpd/TestRunCommand.java
similarity index 64%
copy from frysk-core/frysk/hpd/TestDisassemblerCommand.java
copy to frysk-core/frysk/hpd/TestRunCommand.java
index 33f2f36..bd41c22 100644
--- a/frysk-core/frysk/hpd/TestDisassemblerCommand.java
+++ b/frysk-core/frysk/hpd/TestRunCommand.java
@@ -39,31 +39,41 @@
 
 package frysk.hpd;
 
-import lib.opcodes.Disassembler;
+import frysk.Config;
 
-public class TestDisassemblerCommand
-    extends TestLib
-{
-    public void testHpdDisassemble() {
-	if (unsupported("disassembler", !Disassembler.available()))
-	    return;
-	e = HpdTestbed.attachXXX("hpd-c");
-	e.send("disassemble\n");
-	e.expect(5, "\\*.*test.*\n(.*\n)*" + prompt);
+/**
+ * This class tests the "run" command.
+ */
+
+public class TestRunCommand extends TestLib {
+    public void testRunCommand() {
+	e = new HpdTestbed();
+	e.sendCommandExpectPrompt("run " + Config.getPkgLibFile("funit-threads-looper"),
+		"Attached to process ([0-9]+).*Running process ([0-9]+).*");
+	try { Thread.sleep(1000); } catch (Exception e) {}
+	e.sendCommandExpectPrompt("focus","Target set.*\\[0\\.0\\]\t\t([0-9]+)" +
+		"\t([0-9]+)\r\n" + "\\[0\\.1\\]\t\t([0-9]+)\t([0-9]+)\r\n");
 	e.send("quit\n");
 	e.expect("Quitting...");
 	e.close();
     }
     
-    public void testDisassembleRange() {
-	if (unsupported("disassembler", !lib.opcodes.Disassembler.available()))
-	    return;
-	e = HpdTestbed.attachXXX("hpd-c");
-	e.send("disassemble 0x804860f  0x80487ea\n");
-	e.expect(5, " 0x804860f.*\n");
-	e.expect(5, " 0x80487ea.*\n" + prompt);
+    /**
+     * Test running the run command twice, the second time should kill the previous process
+     * and restart it and run until a breakpoint is found or the process blows up.
+     */
+    public void testRunTimesTwo() {
+	e = new HpdTestbed();
+	e.sendCommandExpectPrompt("run " + Config.getPkgLibFile("funit-threads-looper"),
+		"Attached to process ([0-9]+).*Running process ([0-9]+).*");
+	try { Thread.sleep(1000); } catch (Exception e) {}
+	e.sendCommandExpectPrompt("focus","Target set.*\\[0\\.0\\]\t\t([0-9]+)" +
+		"\t([0-9]+)\r\n" + "\\[0\\.1\\]\t\t([0-9]+)\t([0-9]+)\r\n");
+	e.sendCommandExpectPrompt("run", "Killing process ([0-9])+.*" +
+		"Loaded executable file.*" + "Attached to process ([0-9])+.*" +
+		"Running process ([0-9])+.*");
 	e.send("quit\n");
 	e.expect("Quitting...");
 	e.close();
     }
-}
+}
\ No newline at end of file


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


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

only message in thread, other threads:[~2008-01-03  7:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-03  7:28 [SCM] master: Implement run to run until first breakpoint 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).