From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26246 invoked by alias); 18 Nov 2007 05:04:05 -0000 Received: (qmail 26193 invoked by uid 367); 18 Nov 2007 05:04:03 -0000 Date: Sun, 18 Nov 2007 05:04:00 -0000 Message-ID: <20071118050403.26178.qmail@sourceware.org> From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Fold "plocation", "ptype", and "examine" commands into "print". X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: b3adba000519e004a2de1f4094fa7628c17fe3cf X-Git-Newrev: 11b29ff932127e58a13743509f930d118c25f02f 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: 2007-q4/txt/msg00391.txt.bz2 The branch, master has been updated via 11b29ff932127e58a13743509f930d118c25f02f (commit) via af6a8ab4e12c0e3d33ada30b422ae0343f03d6ac (commit) via 87fbda00526042d6f53a7b39921ce22706db9dce (commit) from b3adba000519e004a2de1f4094fa7628c17fe3cf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 11b29ff932127e58a13743509f930d118c25f02f Author: Andrew Cagney Date: Sun Nov 18 00:01:27 2007 -0500 Fold "plocation", "ptype", and "examine" commands into "print". frysk-core/frysk/hpd/ChangeLog 2007-11-17 Andrew Cagney * EvalCommands.java (Printer): New. (Options): Replace dumpTree with printer; (EvalCommands(String,String,String)): Add options -location, -type, -value, -tree, and -raw. * TestEvalCommands.java (testPrintLocation()): New. (testPrintLocationFails()): New. (testPrintType()): New. (testPrintTypeFails()): New. * TestPtypeCommand.java: Delete. * TestPlocationCommand.java: Delete. * PtypeCommand.java: Delete. * PlocationCommand.java: Delete. * TestExamineCommand.java: Delete. * ExamineCommand.java: Delete. * TopLevelCommand.java: Update. * TestHelp.java: Update. commit af6a8ab4e12c0e3d33ada30b422ae0343f03d6ac Author: Andrew Cagney Date: Sat Nov 17 23:12:08 2007 -0500 Eliminate unused name member. frysk-core/frysk/hpd/ChangeLog 2007-11-17 Andrew Cagney * Command.java (Command(String,String,String)): Replace Command(String,String,String,String); name dropped. (interpret(CLI,Input)): Make package private. * WhichsetsCommand.java: Update. * WhatCommand.java: Update. * ViewsetCommand.java: Update. * UndefsetCommand.java: Update. * StepNextCommand.java: Update. * TopLevelCommand.java: Update. * TestParameterizedCommand.java: Update. * StepNextiCommand.java: Update. * StepFinishCommand.java: Update. * StepInstructionCommand.java: Update. * StepCommand.java: Update. * StackCommands.java: Update. * RunCommand.java: Update. * RegsCommand.java: Update. * QuitCommand.java: Update. * PtypeCommand.java: Update. * PlocationCommand.java: Update. * ListCommand.java: Update. * HaltCommand.java: Update. * GoCommand.java: Update. * FocusCommand.java: Update. * MultiLevelCommand.java: Update. * ParameterizedCommand.java: Update. * AliasCommands.java: Update. * AttachCommand.java: Update. * BreakpointCommand.java: Update. * DbgVariableCommands.java: Update. * DebuginfoCommand.java: Update. * DefsetCommand.java: Update. * DetachCommand.java: Update. * DisassembleCommand.java: Update. * DisplayCommand.java: Update. * EvalCommands.java: Update. commit 87fbda00526042d6f53a7b39921ce22706db9dce Author: Andrew Cagney Date: Sat Nov 17 22:37:26 2007 -0500 Add an abbreviated command mechanism. frysk-core/frysk/hpd/ChangeLog 2007-11-17 Andrew Cagney * Command.java (name): Delete. (getName()): Delete. * MultiLevelCommand.java (add(Command)): Delete. (add(Command,String)): New. (abbrevs): New. (addAbbrev): New. (lookup(String)): Use abbrevs. (complete(CLI,Input,int,List)): Use lookup(String). * TopLevelCommand.java: Update. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/AliasCommands.java | 11 +- frysk-core/frysk/hpd/AttachCommand.java | 2 +- frysk-core/frysk/hpd/BreakpointCommand.java | 25 ++--- frysk-core/frysk/hpd/ChangeLog | 64 ++++++++++ frysk-core/frysk/hpd/Command.java | 10 +-- frysk-core/frysk/hpd/DbgVariableCommands.java | 9 +- frysk-core/frysk/hpd/DebuginfoCommand.java | 5 +- frysk-core/frysk/hpd/DefsetCommand.java | 5 +- frysk-core/frysk/hpd/DetachCommand.java | 22 ++-- frysk-core/frysk/hpd/DisassembleCommand.java | 4 +- frysk-core/frysk/hpd/DisplayCommand.java | 8 +- frysk-core/frysk/hpd/EvalCommands.java | 123 +++++++++++++++----- frysk-core/frysk/hpd/ExamineCommand.java | 85 -------------- frysk-core/frysk/hpd/FocusCommand.java | 4 +- frysk-core/frysk/hpd/GoCommand.java | 4 +- frysk-core/frysk/hpd/HaltCommand.java | 4 +- frysk-core/frysk/hpd/ListCommand.java | 2 +- frysk-core/frysk/hpd/MultiLevelCommand.java | 51 ++++++--- frysk-core/frysk/hpd/ParameterizedCommand.java | 11 +- frysk-core/frysk/hpd/PlocationCommand.java | 91 --------------- frysk-core/frysk/hpd/PtypeCommand.java | 90 -------------- frysk-core/frysk/hpd/QuitCommand.java | 7 +- frysk-core/frysk/hpd/RegsCommand.java | 4 +- frysk-core/frysk/hpd/RunCommand.java | 5 +- frysk-core/frysk/hpd/StackCommands.java | 28 ++--- frysk-core/frysk/hpd/StepCommand.java | 9 +- frysk-core/frysk/hpd/StepFinishCommand.java | 2 +- frysk-core/frysk/hpd/StepInstructionCommand.java | 2 +- frysk-core/frysk/hpd/StepNextCommand.java | 14 +- frysk-core/frysk/hpd/StepNextiCommand.java | 16 ++-- frysk-core/frysk/hpd/TestEvalCommands.java | 26 ++++ frysk-core/frysk/hpd/TestExamineCommand.java | 55 --------- frysk-core/frysk/hpd/TestHelp.java | 3 - frysk-core/frysk/hpd/TestParameterizedCommand.java | 2 +- frysk-core/frysk/hpd/TestPlocationCommand.java | 65 ---------- frysk-core/frysk/hpd/TestPtypeCommand.java | 62 ---------- frysk-core/frysk/hpd/TopLevelCommand.java | 93 ++++++++-------- frysk-core/frysk/hpd/UndefsetCommand.java | 3 +- frysk-core/frysk/hpd/ViewsetCommand.java | 2 +- frysk-core/frysk/hpd/WhatCommand.java | 19 ++-- frysk-core/frysk/hpd/WhichsetsCommand.java | 3 +- 41 files changed, 370 insertions(+), 680 deletions(-) delete mode 100644 frysk-core/frysk/hpd/ExamineCommand.java delete mode 100644 frysk-core/frysk/hpd/PlocationCommand.java delete mode 100644 frysk-core/frysk/hpd/PtypeCommand.java delete mode 100644 frysk-core/frysk/hpd/TestExamineCommand.java delete mode 100644 frysk-core/frysk/hpd/TestPlocationCommand.java delete mode 100644 frysk-core/frysk/hpd/TestPtypeCommand.java First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/AliasCommands.java b/frysk-core/frysk/hpd/AliasCommands.java index d099c85..6c9037a 100644 --- a/frysk-core/frysk/hpd/AliasCommands.java +++ b/frysk-core/frysk/hpd/AliasCommands.java @@ -56,14 +56,13 @@ abstract class AliasCommands extends ParameterizedCommand { return incomplete.absolute(0); } - AliasCommands(String name, String description, String syntax, - String full) { - super(name, description, syntax, full); + AliasCommands(String description, String syntax, String full) { + super(description, syntax, full); } static class Alias extends AliasCommands { Alias() { - super("alias", "create or view user-defined commands", + super("create or view user-defined commands", ("alias -- define an alias\n" + "alias [ ] -- view an alias"), ("The alias command associates a " @@ -117,7 +116,7 @@ abstract class AliasCommands extends ParameterizedCommand { return new Options(); } Unalias() { - super("unalias", "Create or view user-define commands.", + super("Create or view user-define commands.", "unalias [ command-name | -all -", ("The unalias command removes the alias that was" + " previously established for the specified" @@ -129,7 +128,7 @@ abstract class AliasCommands extends ParameterizedCommand { }); } - public void interpret(CLI cli, Input input, Object o) { + void interpret(CLI cli, Input input, Object o) { Options options = (Options)o; if (options.deleteAll) { if (input.size() != 0) diff --git a/frysk-core/frysk/hpd/AttachCommand.java b/frysk-core/frysk/hpd/AttachCommand.java index dd3e519..b19a6c9 100644 --- a/frysk-core/frysk/hpd/AttachCommand.java +++ b/frysk-core/frysk/hpd/AttachCommand.java @@ -66,7 +66,7 @@ class AttachCommand extends ParameterizedCommand { } AttachCommand() { - super("attach", "Attach to a running process.", + super("Attach to a running process.", "attach ...", ("The attach command causes the debugger to attach to an" + " existing process(es), making it possible to continue" diff --git a/frysk-core/frysk/hpd/BreakpointCommand.java b/frysk-core/frysk/hpd/BreakpointCommand.java index fcc95b8..928ab1d 100644 --- a/frysk-core/frysk/hpd/BreakpointCommand.java +++ b/frysk-core/frysk/hpd/BreakpointCommand.java @@ -57,21 +57,16 @@ import java.util.List; class BreakpointCommand extends ParameterizedCommand { - private static final String full = "The break command defines a breakpoint " - + "that will be triggered when some\n" - + "thread(s) in the trigger set arrives at the specified location " - + "during\n" - + "program execution. When that occurs, the process(es) containing " - + "the\n" - + "triggering thread(s) plus all processes in the stop set will be " - + "forcibly\n" - + "stopped so the user can examine program state information."; - - private static final String descr = "Define a breakpoint"; - BreakpointCommand() { - super("break", descr, - "break {proc | line | #file#line}", full); + super("Define a breakpoint", + "break {proc | line | #file#line}", + ("The break command defines a breakpoint that will be" + + " triggered when some thread(s) in the trigger set" + + " arrives at the specified location during program" + + " execution. When that occurs, the process(es) containing" + + " the triggering thread(s) plus all processes in the" + + " stop set will be forcibly stopped so the user can" + + " examine program state information.")); } static private abstract class CLIBreakpointObserver implements @@ -90,7 +85,7 @@ class BreakpointCommand extends ParameterizedCommand { long address); } - public void interpret(CLI cli, Input cmd, Object arguments) { + void interpret(CLI cli, Input cmd, Object arguments) { PTSet ptset = cli.getCommandPTSet(cmd); String breakpt = cmd.parameter(0); String fileName; diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index e5dd9e4..29d6c82 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,5 +1,69 @@ 2007-11-17 Andrew Cagney + * EvalCommands.java (Printer): New. + (Options): Replace dumpTree with printer; + (EvalCommands(String,String,String)): Add options -location, + -type, -value, -tree, and -raw. + * TestEvalCommands.java (testPrintLocation()): New. + (testPrintLocationFails()): New. + (testPrintType()): New. + (testPrintTypeFails()): New. + * TestPtypeCommand.java: Delete. + * TestPlocationCommand.java: Delete. + * PtypeCommand.java: Delete. + * PlocationCommand.java: Delete. + * TestExamineCommand.java: Delete. + * ExamineCommand.java: Delete. + * TopLevelCommand.java: Update. + * TestHelp.java: Update. + + * Command.java (Command(String,String,String)): Replace + Command(String,String,String,String); name dropped. + (interpret(CLI,Input)): Make package private. + * WhichsetsCommand.java: Update. + * WhatCommand.java: Update. + * ViewsetCommand.java: Update. + * UndefsetCommand.java: Update. + * StepNextCommand.java: Update. + * TopLevelCommand.java: Update. + * TestParameterizedCommand.java: Update. + * StepNextiCommand.java: Update. + * StepFinishCommand.java: Update. + * StepInstructionCommand.java: Update. + * StepCommand.java: Update. + * StackCommands.java: Update. + * RunCommand.java: Update. + * RegsCommand.java: Update. + * QuitCommand.java: Update. + * PtypeCommand.java: Update. + * PlocationCommand.java: Update. + * ListCommand.java: Update. + * HaltCommand.java: Update. + * GoCommand.java: Update. + * FocusCommand.java: Update. + * MultiLevelCommand.java: Update. + * ParameterizedCommand.java: Update. + * AliasCommands.java: Update. + * AttachCommand.java: Update. + * BreakpointCommand.java: Update. + * DbgVariableCommands.java: Update. + * DebuginfoCommand.java: Update. + * DefsetCommand.java: Update. + * DetachCommand.java: Update. + * DisassembleCommand.java: Update. + * DisplayCommand.java: Update. + * EvalCommands.java: Update. + + * Command.java (name): Delete. + (getName()): Delete. + * MultiLevelCommand.java (add(Command)): Delete. + (add(Command,String)): New. + (abbrevs): New. + (addAbbrev): New. + (lookup(String)): Use abbrevs. + (complete(CLI,Input,int,List)): Use lookup(String). + * TopLevelCommand.java: Update. + * CommandHelp.java: Delete. * Command.java (getHelp()): Delete. (help): Delete. diff --git a/frysk-core/frysk/hpd/Command.java b/frysk-core/frysk/hpd/Command.java index 2a09e55..ecbb374 100644 --- a/frysk-core/frysk/hpd/Command.java +++ b/frysk-core/frysk/hpd/Command.java @@ -46,23 +46,17 @@ import java.util.List; */ public abstract class Command { - private final String name; private final String description; private final String syntax; private final String full; - - public String getName() { - return name; - } - Command (String name, String description, String syntax, String full) { - this.name = name; + Command (String description, String syntax, String full) { this.description = description; this.syntax = syntax; this.full = full; } - public abstract void interpret(CLI cli, Input cmd); + abstract void interpret(CLI cli, Input cmd); /** * Fill CANDIDATES with the possible completion strings and return diff --git a/frysk-core/frysk/hpd/DbgVariableCommands.java b/frysk-core/frysk/hpd/DbgVariableCommands.java index 0145d5c..f893422 100644 --- a/frysk-core/frysk/hpd/DbgVariableCommands.java +++ b/frysk-core/frysk/hpd/DbgVariableCommands.java @@ -43,9 +43,8 @@ import java.util.List; abstract class DbgVariableCommands extends ParameterizedCommand { - DbgVariableCommands(String name, String description, - String syntax, String full) { - super(name, description, syntax, full); + DbgVariableCommands(String description, String syntax, String full) { + super(description, syntax, full); } int completer(CLI cli, Input input, int cursor, List completions) { @@ -58,7 +57,7 @@ abstract class DbgVariableCommands extends ParameterizedCommand { static class Set extends DbgVariableCommands { Set() { - super("set", "Change or view a debugger variable.", + super("Change or view a debugger variable.", "set debugger-var = value\nset [debugger-var]", ("The set command supports the viewing of debugger state" + " variables and the assignment of new values to them. When" @@ -111,7 +110,7 @@ abstract class DbgVariableCommands extends ParameterizedCommand { static class Unset extends DbgVariableCommands { Unset() { - super("unset", "Revert variable value to default.", + super("Revert variable value to default.", "unset [ | -all ]", ("The unset command reverses the effects of any previous" + " set operations, restoring the debugger state" diff --git a/frysk-core/frysk/hpd/DebuginfoCommand.java b/frysk-core/frysk/hpd/DebuginfoCommand.java index 687ec7c..51c89b6 100644 --- a/frysk-core/frysk/hpd/DebuginfoCommand.java +++ b/frysk-core/frysk/hpd/DebuginfoCommand.java @@ -47,8 +47,7 @@ import java.util.List; class DebuginfoCommand extends ParameterizedCommand { DebuginfoCommand() { - super("debuginfo", - "Displays debuginfo install paths of a process.", "debuginfo", + super("Displays debuginfo install paths of a process.", "debuginfo", "The debuginfo command lists the debuginfo paths " + "for a process and its shared modules."); } @@ -57,7 +56,7 @@ class DebuginfoCommand extends ParameterizedCommand { return -1; } - public void interpret(CLI cli, Input cmd, Object options) { + void interpret(CLI cli, Input cmd, Object options) { PTSet ptset = cli.getCommandPTSet(cmd); Iterator taskIter = ptset.getTasks(); while (taskIter.hasNext()) { diff --git a/frysk-core/frysk/hpd/DefsetCommand.java b/frysk-core/frysk/hpd/DefsetCommand.java index de21d8d..0c5834f 100644 --- a/frysk-core/frysk/hpd/DefsetCommand.java +++ b/frysk-core/frysk/hpd/DefsetCommand.java @@ -44,8 +44,7 @@ import java.util.List; class DefsetCommand extends ParameterizedCommand { DefsetCommand() { - super("defset", - "Assign a set name to a group of processes/threads", + super("Assign a set name to a group of processes/threads", "defset set-name p/t-set", ("Associates a logical name with a group of threads and/or" + " processes, creating a user-defined set. Once a" @@ -56,7 +55,7 @@ class DefsetCommand extends ParameterizedCommand { + " of processes and threads.")); } - public void interpret(CLI cli, Input cmd, Object options) { + void interpret(CLI cli, Input cmd, Object options) { String setname = null; String setnot = null; PTSet set = null; diff --git a/frysk-core/frysk/hpd/DetachCommand.java b/frysk-core/frysk/hpd/DetachCommand.java index 32e5140..b76a603 100644 --- a/frysk-core/frysk/hpd/DetachCommand.java +++ b/frysk-core/frysk/hpd/DetachCommand.java @@ -47,22 +47,18 @@ import java.util.List; class DetachCommand extends ParameterizedCommand { - private static final String full = "The detach command detaches the debugger " - + "from all processes in the\n" - + "affected set. This serves to undo the effects of attaching the " - + "debugger\n" - + "to a running process; that is, the debugger releases all " - + "control over\n" - + "the process, eliminates all debugger state information related " - + "to it,\n" - + "and allows it to continue execution in the normal run-time\n" - + "environment. "; - DetachCommand() { - super("detach", "Detach from a running process.", "detach", full); + super("Detach from a running process.", "detach", + ("The detach command detaches the debugger from all" + + " processes in the affected set. This serves to undo" + + " the effects of attaching the debugger to a running" + + " process; that is, the debugger releases all control" + + " over the process, eliminates all debugger state" + + " information related to it, and allows it to continue" + + " execution in the normal run-time environment.")); } - public void interpret(CLI cli, Input cmd, Object options) { + void interpret(CLI cli, Input cmd, Object options) { PTSet ptset = cli.getCommandPTSet(cmd); HashSet procSet = new HashSet(); Iterator taskIter = ptset.getTasks(); diff --git a/frysk-core/frysk/hpd/DisassembleCommand.java b/frysk-core/frysk/hpd/DisassembleCommand.java index 207c53e..19f19e0 100644 --- a/frysk-core/frysk/hpd/DisassembleCommand.java +++ b/frysk-core/frysk/hpd/DisassembleCommand.java @@ -51,7 +51,7 @@ import lib.opcodes.Instruction; public class DisassembleCommand extends ParameterizedCommand { public DisassembleCommand() { - super("disassemble", "disassemble a section of memory", + super("disassemble a section of memory", "disassemble [startAddress] [--] [OPTIONS]||\n" + "disassemble " + " [--] [-OPTIONS]", @@ -92,7 +92,7 @@ public class DisassembleCommand extends ParameterizedCommand { symbol = true; } - public void interpret(CLI cli, Input cmd, Object options) { + void interpret(CLI cli, Input cmd, Object options) { reset(); PTSet ptset = cli.getCommandPTSet(cmd); Iterator taskDataIter = ptset.getTaskData(); diff --git a/frysk-core/frysk/hpd/DisplayCommand.java b/frysk-core/frysk/hpd/DisplayCommand.java index 5932d4e..87bc38e 100644 --- a/frysk-core/frysk/hpd/DisplayCommand.java +++ b/frysk-core/frysk/hpd/DisplayCommand.java @@ -57,19 +57,17 @@ import frysk.value.Value; * expression changes, the user will be notified. * */ -public class DisplayCommand extends ParameterizedCommand { +class DisplayCommand extends ParameterizedCommand { private List displays; - private static final String desc = "creates a display on an expression"; - DisplayCommand() { - super("display", desc, "display expr", desc); + super("creates a display on an expression", "display expr"); displays = new LinkedList(); } - public void interpret(CLI cli, Input cmd, Object options) { + void interpret(CLI cli, Input cmd, Object options) { final PrintWriter output = cli.getPrintWriter(); PTSet ptset = cli.getCommandPTSet(cmd); diff --git a/frysk-core/frysk/hpd/EvalCommands.java b/frysk-core/frysk/hpd/EvalCommands.java index 98b83cc..1d6082a 100644 --- a/frysk-core/frysk/hpd/EvalCommands.java +++ b/frysk-core/frysk/hpd/EvalCommands.java @@ -39,6 +39,7 @@ package frysk.hpd; +import inua.eio.ByteBuffer; import frysk.value.Format; import java.util.Iterator; import frysk.proc.Task; @@ -46,29 +47,104 @@ import frysk.value.PointerType; import frysk.value.Type; import java.util.List; import frysk.expr.Expression; +import java.io.PrintWriter; /** * Evaluate an expression; in various forms. */ abstract class EvalCommands extends ParameterizedCommand { + private static abstract class Printer { + abstract void print(Expression e, PrintWriter writer, Format format, + ByteBuffer memory); + static final Printer VALUE = new Printer() { + void print(Expression e, PrintWriter writer, Format format, + ByteBuffer memory) { + // XXX: Should be in type? + Type t = e.getType(); + if (t instanceof PointerType) { + writer.print("("); + t.toPrint(writer); + writer.print(") "); + } + e.getValue().toPrint(writer, memory, format); + writer.println(); + } + }; + static final Printer LOCATION = new Printer() { + void print(Expression e, PrintWriter writer, Format format, + ByteBuffer memory) { + e.getLocation().toPrint(writer); + writer.println(); + } + }; + static final Printer TYPE = new Printer() { + void print(Expression e, PrintWriter writer, Format format, + ByteBuffer memory) { + e.getType().toPrint(writer); + writer.println(); + } + }; + static final Printer TREE = new Printer() { + void print(Expression e, PrintWriter writer, Format format, + ByteBuffer memory) { + e.toPrint(writer); + writer.println(); + } + }; + static final Printer RAW = new Printer() { + void print(Expression e, PrintWriter writer, Format format, + ByteBuffer memory) { + byte[] bytes = e.getLocation().toByteArray(); + for (int i = 0; i < bytes.length; i++) { + writer.print(i); + writer.print(": "); + writer.print(bytes[i]); + writer.println(); + } + } + }; + } + private class Options { Format format = Format.NATURAL; - boolean dumpTree = false; + Printer printer = Printer.VALUE; } Object options() { return new Options(); } - EvalCommands(String name, String description, String syntax, String full) { - super(name, description, syntax, full); + EvalCommands(String description, String syntax, String full) { + super(description, syntax, full); add(new CommandOption.FormatOption() { void set(Object options, Format format) { ((Options)options).format = format; } }); - add(new CommandOption("dump-tree", "dump the expression AST") { + add(new CommandOption("tree", "print the expression's AST") { + void parse(String arg, Object options) { + ((Options)options).printer = Printer.TREE; + } + }); + add(new CommandOption("location", "print the expression's location") { void parse(String arg, Object options) { - ((Options)options).dumpTree = true; + ((Options)options).printer = Printer.LOCATION; + } + }); + add(new CommandOption("type", "print the expression's type") { + void parse(String arg, Object options) { + ((Options)options).printer = Printer.TYPE; + } + }); + add(new CommandOption("value", + "print the expression's value (default)") { + void parse(String arg, Object options) { + ((Options)options).printer = Printer.VALUE; + } + }); + add(new CommandOption("raw", + "print the expression's raw value") { + void parse(String arg, Object options) { + ((Options)options).printer = Printer.RAW; } }); } @@ -99,35 +175,22 @@ abstract class EvalCommands extends ParameterizedCommand { cli.printError(e); continue; } - if (options.dumpTree) { - result.toPrint(cli.outWriter); - } else { - Type t = result.getType(); - if (t instanceof PointerType) { - cli.outWriter.print("("); - t.toPrint(cli.outWriter); - cli.outWriter.print(") "); hooks/post-receive -- frysk system monitor/debugger