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: More commands extend ParameterizedCommand.


The branch, master has been updated
       via  c5892213ca4bee5d89b7c02ce0ba9ab19d3bb8ed (commit)
      from  cc4bec76cd893ccb3be127fbf4748ac34019f392 (commit)

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

- Log -----------------------------------------------------------------
commit c5892213ca4bee5d89b7c02ce0ba9ab19d3bb8ed
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Nov 8 11:27:19 2007 -0500

    More commands extend ParameterizedCommand.
    
    frysk-core/frysk/hpd/ChangeLog
    2007-11-08  Andrew Cagney  <cagney@redhat.com>
    
    	* DebuginfoCommand.java: Extend ParameterizedCommand.
    	* WhichsetsCommand.java: Ditto.
    	* WhatCommand.java: Ditto.
    	* StepNextiCommand.java: Ditto.
    	* StepNextCommand.java: Ditto.
    	* StepInstructionCommand.java: Ditto.
    	* StepFinishCommand.java: Ditto.
    	* BreakpointCommand.java: Ditto.
    	* DefsetCommand.java: Ditto.
    	* DetachCommand.java: Ditto.
    	* DisplayCommand.java: Ditto.
    	* FocusCommand.java: Ditto.
    	* GoCommand.java: Ditto.
    	* HaltCommand.java: Ditto.
    	* QuitCommand.java: Ditto.
    	* RegsCommand.java: Ditto.
    	* SetCommand.java: Ditto.
    	* StepCommand.java: Ditto.

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

Summary of changes:
 frysk-core/frysk/hpd/BreakpointCommand.java      |   17 ++++++++++-------
 frysk-core/frysk/hpd/ChangeLog                   |   19 +++++++++++++++++++
 frysk-core/frysk/hpd/DebuginfoCommand.java       |   14 ++++++++------
 frysk-core/frysk/hpd/DefsetCommand.java          |   15 +++++++++------
 frysk-core/frysk/hpd/DetachCommand.java          |   14 ++++++++------
 frysk-core/frysk/hpd/DisplayCommand.java         |   11 ++++++++---
 frysk-core/frysk/hpd/FocusCommand.java           |   14 ++++++++------
 frysk-core/frysk/hpd/GoCommand.java              |   15 ++++++++-------
 frysk-core/frysk/hpd/HaltCommand.java            |   14 ++++++++------
 frysk-core/frysk/hpd/QuitCommand.java            |   10 ++++++++--
 frysk-core/frysk/hpd/RegsCommand.java            |   10 ++++++++--
 frysk-core/frysk/hpd/SetCommand.java             |   15 +++++++++------
 frysk-core/frysk/hpd/StepCommand.java            |   15 ++++++++-------
 frysk-core/frysk/hpd/StepFinishCommand.java      |   14 +++++++-------
 frysk-core/frysk/hpd/StepInstructionCommand.java |   16 ++++++++--------
 frysk-core/frysk/hpd/StepNextCommand.java        |   16 ++++++++--------
 frysk-core/frysk/hpd/StepNextiCommand.java       |   15 +++++++--------
 frysk-core/frysk/hpd/WhatCommand.java            |   20 +++++++++++---------
 frysk-core/frysk/hpd/WhichsetsCommand.java       |   15 +++++++++------
 19 files changed, 169 insertions(+), 110 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/BreakpointCommand.java b/frysk-core/frysk/hpd/BreakpointCommand.java
index 1cd2d4b..c00e240 100644
--- a/frysk-core/frysk/hpd/BreakpointCommand.java
+++ b/frysk-core/frysk/hpd/BreakpointCommand.java
@@ -53,8 +53,9 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import lib.dwfl.DwarfDie;
+import java.util.List;
 
-class BreakpointCommand extends Command {
+class BreakpointCommand extends ParameterizedCommand {
 
     private static final String full = "The break command defines a breakpoint "
 	    + "that will be triggered when some\n"
@@ -70,7 +71,7 @@ class BreakpointCommand extends Command {
 
     BreakpointCommand() {
 	super("break", descr,
-	      "break {proc | line | #file#line} [-stop stop-set]", full);
+	      "break {proc | line | #file#line}", full);
     }
 
     static private abstract class CLIBreakpointObserver implements
@@ -89,12 +90,8 @@ class BreakpointCommand extends Command {
                                        long address);
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object arguments) {
 	PTSet ptset = cli.getCommandPTSet(cmd);
-	if (cmd.size() != 1) {
-	    cli.printUsage(cmd);
-	    return;
-	}
 	String breakpt = cmd.parameter(0);
 	String fileName;
 	int lineNumber;
@@ -188,4 +185,10 @@ class BreakpointCommand extends Command {
 	}
 	outWriter.println();
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base, 
+		 List completions) {
+	return CompletionFactory.completeExpression(cli, ptset, incomplete,
+						    base, completions);
+    }
 }
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index a4781aa..2d36832 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -5,6 +5,25 @@
 
 2007-11-08  Andrew Cagney  <cagney@redhat.com>
 
+	* DebuginfoCommand.java: Extend ParameterizedCommand.
+	* WhichsetsCommand.java: Ditto.
+	* WhatCommand.java: Ditto.
+	* StepNextiCommand.java: Ditto.
+	* StepNextCommand.java: Ditto.
+	* StepInstructionCommand.java: Ditto.
+	* StepFinishCommand.java: Ditto.
+	* BreakpointCommand.java: Ditto.
+	* DefsetCommand.java: Ditto.
+	* DetachCommand.java: Ditto.
+	* DisplayCommand.java: Ditto.
+	* FocusCommand.java: Ditto.
+	* GoCommand.java: Ditto.
+	* HaltCommand.java: Ditto.
+	* QuitCommand.java: Ditto.
+	* RegsCommand.java: Ditto.
+	* SetCommand.java: Ditto.
+	* StepCommand.java: Ditto.
+
 	* ParameterizedCommand.java
 	(handleOption(Input,String,int,Object)): Fix off-by-one error.
 	(HelpException): Delete.
diff --git a/frysk-core/frysk/hpd/DebuginfoCommand.java b/frysk-core/frysk/hpd/DebuginfoCommand.java
index cca6ea5..bab4d3d 100644
--- a/frysk-core/frysk/hpd/DebuginfoCommand.java
+++ b/frysk-core/frysk/hpd/DebuginfoCommand.java
@@ -42,8 +42,9 @@ package frysk.hpd;
 import java.util.Iterator;
 import frysk.proc.Task;
 import frysk.util.DebuginfoPaths;
+import java.util.List;
 
-class DebuginfoCommand extends Command {
+class DebuginfoCommand extends ParameterizedCommand {
 
     DebuginfoCommand() {
 	super("debuginfo",
@@ -52,12 +53,13 @@ class DebuginfoCommand extends Command {
 	      + "for a process and its shared modules.");
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
+
+    public void interpret(CLI cli, Input cmd, Object options) {
 	PTSet ptset = cli.getCommandPTSet(cmd);
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
 	Iterator taskIter = ptset.getTasks();
 	while (taskIter.hasNext()) {
 	    Task task = (Task) taskIter.next();
diff --git a/frysk-core/frysk/hpd/DefsetCommand.java b/frysk-core/frysk/hpd/DefsetCommand.java
index abef7f6..6d57a71 100644
--- a/frysk-core/frysk/hpd/DefsetCommand.java
+++ b/frysk-core/frysk/hpd/DefsetCommand.java
@@ -39,7 +39,9 @@
 
 package frysk.hpd;
 
-class DefsetCommand extends Command {
+import java.util.List;
+
+class DefsetCommand extends ParameterizedCommand {
 
     private static final String full = "Associates a logical name with a "
 	    + "group of threads and/or processes,\n"
@@ -57,11 +59,7 @@ class DefsetCommand extends Command {
 	      "defset set-name p/t-set", full);
     }
 
-    public void interpret(CLI cli, Input cmd) {
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
+    public void interpret(CLI cli, Input cmd, Object options) {
 	String setname = null;
 	String setnot = null;
 	PTSet set = null;
@@ -84,4 +82,9 @@ class DefsetCommand extends Command {
 	    cli.printUsage(cmd);
 	}
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/DetachCommand.java b/frysk-core/frysk/hpd/DetachCommand.java
index 4f42853..acf26f0 100644
--- a/frysk-core/frysk/hpd/DetachCommand.java
+++ b/frysk-core/frysk/hpd/DetachCommand.java
@@ -43,8 +43,9 @@ import java.util.HashSet;
 import java.util.Iterator;
 import frysk.proc.Proc;
 import frysk.proc.Task;
+import java.util.List;
 
-class DetachCommand extends Command {
+class DetachCommand extends ParameterizedCommand {
 
     private static final String full = "The detach command detaches the debugger "
 	    + "from all processes in the\n"
@@ -61,12 +62,8 @@ class DetachCommand extends Command {
 	super("detach", "Detach from a running process.", "detach", full);
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object options) {
 	PTSet ptset = cli.getCommandPTSet(cmd);
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
 	HashSet procSet = new HashSet();
 	Iterator taskIter = ptset.getTasks();
 	while (taskIter.hasNext()) {
@@ -87,4 +84,9 @@ class DetachCommand extends Command {
 			proc, true);
 	}
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/DisplayCommand.java b/frysk-core/frysk/hpd/DisplayCommand.java
index ad04008..391385a 100644
--- a/frysk-core/frysk/hpd/DisplayCommand.java
+++ b/frysk-core/frysk/hpd/DisplayCommand.java
@@ -43,7 +43,6 @@ import java.io.PrintWriter;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-
 import frysk.proc.Task;
 import frysk.rt.DisplayManager;
 import frysk.rt.DisplayValueObserver;
@@ -58,7 +57,7 @@ import frysk.value.Value;
  * expression changes, the user will be notified.
  * 
  */
-public class DisplayCommand extends Command {
+public class DisplayCommand extends ParameterizedCommand {
 
     private List displays;
 
@@ -70,7 +69,7 @@ public class DisplayCommand extends Command {
     }
 
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object options) {
 	final PrintWriter output = cli.getPrintWriter();
 
 	PTSet ptset = cli.getCommandPTSet(cmd);
@@ -144,4 +143,10 @@ public class DisplayCommand extends Command {
 	    output.flush();
 	}
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return CompletionFactory.completeExpression(cli, ptset, incomplete,
+						    base, completions);
+    }
 }
diff --git a/frysk-core/frysk/hpd/FocusCommand.java b/frysk-core/frysk/hpd/FocusCommand.java
index aebf59e..9717e7e 100644
--- a/frysk-core/frysk/hpd/FocusCommand.java
+++ b/frysk-core/frysk/hpd/FocusCommand.java
@@ -44,8 +44,9 @@ import frysk.debuginfo.DebugInfo;
 import frysk.debuginfo.DebugInfoFrame;
 import frysk.debuginfo.DebugInfoStackFactory;
 import frysk.proc.Task;
+import java.util.List;
 
-class FocusCommand extends Command {
+class FocusCommand extends ParameterizedCommand {
     private static String full = "Changes the current p/t set. As a "
 	    + "consequence, subsequent commands will\n"
 	    + "apply to just the threads specified in the argument of this\n"
@@ -57,11 +58,7 @@ class FocusCommand extends Command {
 	      "focus [p/t-set]", full);
     }
 
-    public void interpret(CLI cli, Input cmd) {
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
+    public void interpret(CLI cli, Input cmd, Object options) {
 	if (cmd.size() <= 1) {
 	    if (cmd.size() == 1) {
 		cli.targetset = cli.createSet(cmd.parameter(0));
@@ -80,4 +77,9 @@ class FocusCommand extends Command {
 	    cli.printUsage(cmd);
 	}
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/GoCommand.java b/frysk-core/frysk/hpd/GoCommand.java
index 129f706..4bbcdbe 100644
--- a/frysk-core/frysk/hpd/GoCommand.java
+++ b/frysk-core/frysk/hpd/GoCommand.java
@@ -42,8 +42,9 @@ package frysk.hpd;
 import java.util.Iterator;
 import frysk.proc.Task;
 import frysk.stepping.SteppingEngine;
+import java.util.List;
 
-class GoCommand extends Command {
+class GoCommand extends ParameterizedCommand {
     private static String full = "Continue running a process, returning "
 	    + "without blocking.  The go command\n"
 	    + "resumes execution of a collection of processes. The prompt will "
@@ -55,13 +56,8 @@ class GoCommand extends Command {
 	super("go", "Continue a process.", "go", full);
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object options) {
 	PTSet ptset = cli.getCommandPTSet(cmd);
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
-
 	if (cli.steppingObserver != null) {
 	    Iterator taskIter = ptset.getTasks();
 	    SteppingEngine steppingEngine = cli.getSteppingEngine();
@@ -73,4 +69,9 @@ class GoCommand extends Command {
 	} else
 	    cli.addMessage("Not attached to any process", Message.TYPE_ERROR);
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/HaltCommand.java b/frysk-core/frysk/hpd/HaltCommand.java
index eac63b7..72cc051 100644
--- a/frysk-core/frysk/hpd/HaltCommand.java
+++ b/frysk-core/frysk/hpd/HaltCommand.java
@@ -43,8 +43,9 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import frysk.proc.Task;
 import frysk.stepping.SteppingEngine;
+import java.util.List;
 
-class HaltCommand extends Command {
+class HaltCommand extends ParameterizedCommand {
 
     private static String full = "Stop a process which is already attached. "
 	    + "The halt command temporarily\n"
@@ -54,12 +55,8 @@ class HaltCommand extends Command {
 	super("halt", "Stop a process.", "halt", full);
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object options) {
 	PTSet ptset = cli.getCommandPTSet(cmd);
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
 	SteppingEngine steppingEngine = cli.getSteppingEngine();
 	if (cli.steppingObserver != null) {
 	    Iterator taskIter = ptset.getTasks();
@@ -73,4 +70,9 @@ class HaltCommand extends Command {
 	} else
 	    cli.addMessage("Not attached to any process", Message.TYPE_ERROR);
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/QuitCommand.java b/frysk-core/frysk/hpd/QuitCommand.java
index bc44d4b..e0f0781 100644
--- a/frysk-core/frysk/hpd/QuitCommand.java
+++ b/frysk-core/frysk/hpd/QuitCommand.java
@@ -47,8 +47,9 @@ import frysk.proc.Proc;
 import frysk.sys.Signal;
 import frysk.sys.Sig;
 import frysk.util.CountDownLatch;
+import java.util.List;
 
-class QuitCommand extends Command {
+class QuitCommand extends ParameterizedCommand {
     // Do the killing in the event loop in order to not invalidate
     // operations that are already in flight in the event loop. This
     // avoids a race seen in testing where a "quit" command is sent as
@@ -94,7 +95,7 @@ class QuitCommand extends Command {
 	      "Terminate the debugging session.");
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object options) {
         CountDownLatch quitLatch = new CountDownLatch(1);
         new KillRequest(cli, quitLatch).request();
         try {
@@ -107,4 +108,9 @@ class QuitCommand extends Command {
 	Input command = new Input("detach").accept();
 	detachCommand.interpret(cli, command);
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/RegsCommand.java b/frysk-core/frysk/hpd/RegsCommand.java
index 8a12328..465c22d 100644
--- a/frysk-core/frysk/hpd/RegsCommand.java
+++ b/frysk-core/frysk/hpd/RegsCommand.java
@@ -46,8 +46,9 @@ import frysk.isa.ISA;
 import frysk.isa.RegisterGroup;
 import frysk.isa.Registers;
 import frysk.isa.RegistersFactory;
+import java.util.List;
 
-public class RegsCommand extends Command {
+public class RegsCommand extends ParameterizedCommand {
 
     public RegsCommand() {
 	super("regs", "print registers", "regs group", "print out "
@@ -55,7 +56,7 @@ public class RegsCommand extends Command {
 	      + "printed by default.");
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object options) {
 	PTSet ptset = cli.getCommandPTSet(cmd);
 	Iterator taskDataIter = ptset.getTaskData();
 	while (taskDataIter.hasNext()) {
@@ -98,4 +99,9 @@ public class RegsCommand extends Command {
 	    }
 	}
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/SetCommand.java b/frysk-core/frysk/hpd/SetCommand.java
index 28a3cd6..f06cedf 100644
--- a/frysk-core/frysk/hpd/SetCommand.java
+++ b/frysk-core/frysk/hpd/SetCommand.java
@@ -39,7 +39,9 @@
 
 package frysk.hpd;
 
-class SetCommand extends Command {
+import java.util.List;
+
+class SetCommand extends ParameterizedCommand {
     private static final String full = "The set command supports the viewing of "
 	    + "debugger state variables and the\n"
 	    + "assignment of new values to them.  When no arguments are "
@@ -62,11 +64,7 @@ class SetCommand extends Command {
 	this.dbgvars = dbgvars;
     }
 
-    public void interpret(CLI cli, Input cmd) {
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
+    public void interpret(CLI cli, Input cmd, Object options) {
 	String temp;
 	if (cmd.size() == 3 && (cmd.parameter(1)).equals("=")) {
 	    temp = cmd.parameter(0);
@@ -94,4 +92,9 @@ class SetCommand extends Command {
 	    cli.printUsage(cmd);
 	}
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/StepCommand.java b/frysk-core/frysk/hpd/StepCommand.java
index 76e1fc1..026c526 100644
--- a/frysk-core/frysk/hpd/StepCommand.java
+++ b/frysk-core/frysk/hpd/StepCommand.java
@@ -41,11 +41,11 @@ package frysk.hpd;
 
 import java.util.Iterator;
 import java.util.LinkedList;
-
+import java.util.List;
 import frysk.proc.Task;
 import frysk.debuginfo.DebugInfoFrame;
 
-public class StepCommand extends Command {
+public class StepCommand extends ParameterizedCommand {
     private static final String full = "Line step a process which has been "
 	    + "attached to, and is currently blocked.";
 
@@ -53,12 +53,8 @@ public class StepCommand extends Command {
 	super("step", "Step a process.", "step", full);
     }
 
-    public void interpret(CLI cli, Input cmd) {
+    public void interpret(CLI cli, Input cmd, Object options) {
 	PTSet ptset = cli.getCommandPTSet(cmd);
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
 	LinkedList taskList = new LinkedList();
 	Iterator taskIter = ptset.getTasks();
 	while (taskIter.hasNext()) {
@@ -92,4 +88,9 @@ public class StepCommand extends Command {
 	    cli.addMessage("Not attached to any process",
 		    Message.TYPE_ERROR);
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return -1;
+    }
 }
diff --git a/frysk-core/frysk/hpd/StepFinishCommand.java b/frysk-core/frysk/hpd/StepFinishCommand.java
index 9923799..96fe838 100644
--- a/frysk-core/frysk/hpd/StepFinishCommand.java
+++ b/frysk-core/frysk/hpd/StepFinishCommand.java


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]