From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17743 invoked by alias); 20 Dec 2007 10:43:58 -0000 Received: (qmail 17707 invoked by uid 9514); 20 Dec 2007 10:43:55 -0000 Date: Thu, 20 Dec 2007 10:43:00 -0000 Message-ID: <20071220104355.17679.qmail@sourceware.org> From: pmuldoon@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Add 'info' command to fhpd. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 033a6a74b58a3e0980b748360755ee13d9601a61 X-Git-Newrev: e77830491c7108b55f832ead5087f4decf54077f 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/msg00613.txt.bz2 The branch, master has been updated via e77830491c7108b55f832ead5087f4decf54077f (commit) from 033a6a74b58a3e0980b748360755ee13d9601a61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit e77830491c7108b55f832ead5087f4decf54077f Author: Phil Muldoon Date: Thu Dec 20 10:43:40 2007 +0000 Add 'info' command to fhpd. 2007-12-20 Phil Muldoon * InfoCommand.java: New. Add auxv, maps, debuginfo. * TopLevelCommand.java(TopLevelCommand): Add InfoCommand. Remove auxv, maps, debuginfo. * TestRegs.java (testRegsCommand): Add 'info regs' to test. * TestMapsCommand.java (testMapsCommand): Send 'info maps' to expect instead of 'maps'. * TestAuxvCommand.java (testAuxVCoreCommand): Send 'info auxv' to expect instead of 'auxv'. * TestHelp.java (TestHelp): Remove debuginfo, add info to array. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 14 +++++ .../{DebuginfoCommand.java => InfoCommand.java} | 57 +++++++++++--------- frysk-core/frysk/hpd/TestAuxvCommand.java | 2 +- frysk-core/frysk/hpd/TestHelp.java | 2 +- frysk-core/frysk/hpd/TestMapsCommand.java | 2 +- frysk-core/frysk/hpd/TestRegs.java | 25 +++++---- frysk-core/frysk/hpd/TopLevelCommand.java | 4 +- 7 files changed, 64 insertions(+), 42 deletions(-) copy frysk-core/frysk/hpd/{DebuginfoCommand.java => InfoCommand.java} (68%) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 789cd32..3dfa4e7 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,17 @@ +2007-12-20 Phil Muldoon + + * InfoCommand.java: New. Add auxv, maps, debuginfo. + * TopLevelCommand.java(TopLevelCommand): Add InfoCommand. + Remove auxv, maps, debuginfo. + * TestRegs.java (testRegsCommand): Add 'info regs' + to test. + * TestMapsCommand.java (testMapsCommand): Send 'info maps' + to expect instead of 'maps'. + * TestAuxvCommand.java (testAuxVCoreCommand): Send 'info auxv' + to expect instead of 'auxv'. + * TestHelp.java (TestHelp): Remove debuginfo, add + info to array. + 2007-12-18 Rick Moseley * TestLoadCommand.java: Fix regex symbols. diff --git a/frysk-core/frysk/hpd/DebuginfoCommand.java b/frysk-core/frysk/hpd/InfoCommand.java similarity index 68% copy from frysk-core/frysk/hpd/DebuginfoCommand.java copy to frysk-core/frysk/hpd/InfoCommand.java index 51c89b6..d8529cd 100644 --- a/frysk-core/frysk/hpd/DebuginfoCommand.java +++ b/frysk-core/frysk/hpd/InfoCommand.java @@ -36,34 +36,41 @@ // modification, you must delete this exception statement from your // version and license this file solely under the GPL without // exception. - package frysk.hpd; -import java.util.Iterator; -import frysk.proc.Task; -import frysk.util.DebuginfoPaths; import java.util.List; -class DebuginfoCommand extends ParameterizedCommand { - - DebuginfoCommand() { - super("Displays debuginfo install paths of a process.", "debuginfo", - "The debuginfo command lists the debuginfo paths " - + "for a process and its shared modules."); +public class InfoCommand extends MultiLevelCommand { + + private class Help extends Command { + Help() { + super("Display this help message.", "help [command]", + "Display help (possibly for a command.)"); + } + + public void interpret(CLI cli, Input cmd) { + InfoCommand.this.help(cli, cmd); + } + + /** + * Complete the line, throw problem back at the top level + * command. + */ + int complete(CLI cli, Input buffer, int cursor, List candidates) { + return InfoCommand.this.complete(cli, buffer, cursor, + candidates); + } } - - int completer(CLI cli, Input input, int cursor, List completions) { - return -1; - } - - void interpret(CLI cli, Input cmd, Object options) { - PTSet ptset = cli.getCommandPTSet(cmd); - Iterator taskIter = ptset.getTasks(); - while (taskIter.hasNext()) { - Task task = (Task) taskIter.next(); - DebuginfoPaths dbg = new DebuginfoPaths(task); - String dInfo = dbg.getDebuginfo(); - cli.outWriter.println(dInfo); - } + + + InfoCommand() { + super("info command", "info ", + "The info command displays useful information about " + + "various system and process level systems."); + add(new Help(), "help"); + add(new RegsCommand(),"regs"); + add(new DebuginfoCommand(),"debuginfo"); + add(new MapsCommand(),"maps"); + add(new AuxvCommand(),"auxv"); } -} \ No newline at end of file +} diff --git a/frysk-core/frysk/hpd/TestAuxvCommand.java b/frysk-core/frysk/hpd/TestAuxvCommand.java index 3b566b7..8434d36 100644 --- a/frysk-core/frysk/hpd/TestAuxvCommand.java +++ b/frysk-core/frysk/hpd/TestAuxvCommand.java @@ -75,7 +75,7 @@ public class TestAuxvCommand extends TestLib { e.send("core " + core.getPath() + " -noexe\n"); e.expect("Attached to core file.*"); - e.send("auxv\n"); + e.send("info auxv\n"); Iterator i = buildAuxv.auxvData.iterator(); while (i.hasNext()) e.equals((String)i.next()); diff --git a/frysk-core/frysk/hpd/TestHelp.java b/frysk-core/frysk/hpd/TestHelp.java index fd34afe..cb9414d 100644 --- a/frysk-core/frysk/hpd/TestHelp.java +++ b/frysk-core/frysk/hpd/TestHelp.java @@ -56,7 +56,6 @@ public class TestHelp "attach", "break", "core", - "debuginfo", "defset", "delete", "detach", @@ -72,6 +71,7 @@ public class TestHelp "go", "halt", "help", + "info", "list", "load", "next", diff --git a/frysk-core/frysk/hpd/TestMapsCommand.java b/frysk-core/frysk/hpd/TestMapsCommand.java index 51380af..3ac9e70 100644 --- a/frysk-core/frysk/hpd/TestMapsCommand.java +++ b/frysk-core/frysk/hpd/TestMapsCommand.java @@ -52,7 +52,7 @@ public class TestMapsCommand extends TestLib { e = new HpdTestbed(); e.send("attach " + proc.getPid() +"\n"); - e.send("maps\n"); + e.send("info maps\n"); for (int i=0; i< liveMaps.length; i++) e.equals(liveMaps[i].toString()); e.close(); diff --git a/frysk-core/frysk/hpd/TestRegs.java b/frysk-core/frysk/hpd/TestRegs.java index c3e90c2..46add1d 100644 --- a/frysk-core/frysk/hpd/TestRegs.java +++ b/frysk-core/frysk/hpd/TestRegs.java @@ -51,20 +51,23 @@ public class TestRegs extends TestLib { File exe = Config.getPkgLibFile("hpd-c"); ISA isa = ElfMap.getISA(exe); + String[] commandSet = {"regs\n", "info regs\n"}; // Regs - e.send("regs\n"); - - // Match the first register (with two values) and the last - // register. - if (isa == ISA.IA32) - e.expectPrompt("eax:\t[0-9][^\t]*\t0x.*esp:.*"); - else if (isa == ISA.X8664) - e.expectPrompt("rax:\t[0-9][^\t]*\t0x.*rip:.*"); - else - fail("Architecture " + isa + " unhandled"); + for (int i=0; i < commandSet.length; i++) { + e.send(commandSet[i]); + + // Match the first register (with two values) and the last + // register. + if (isa == ISA.IA32) + e.expectPrompt("eax:\t[0-9][^\t]*\t0x.*esp:.*"); + else if (isa == ISA.X8664) + e.expectPrompt("rax:\t[0-9][^\t]*\t0x.*rip:.*"); + else + fail("Architecture " + isa + " unhandled"); + } e.close(); } - + public void testRegsBlah() { e = HpdTestbed.attachXXX("hpd-c"); e.sendCommandExpectPrompt("regs blah", diff --git a/frysk-core/frysk/hpd/TopLevelCommand.java b/frysk-core/frysk/hpd/TopLevelCommand.java index f85e691..009ec4c 100644 --- a/frysk-core/frysk/hpd/TopLevelCommand.java +++ b/frysk-core/frysk/hpd/TopLevelCommand.java @@ -80,12 +80,10 @@ public class TopLevelCommand extends MultiLevelCommand { add(new AliasCommands.Alias(), "alias"); add(new AliasCommands.Unalias(), "unalias"); add(new AttachCommand(), "attach"); - add(new AuxvCommand(), "auxv"); add(new BreakpointCommand(), "b|reak"); add(new CoreCommand(), "core"); add(new DbgVariableCommands.Set(), "set"); add(new DbgVariableCommands.Unset(), "unset"); - add(new DebuginfoCommand(), "debuginfo"); add(new DetachCommand(), "detach"); add(new DisassembleCommand(), "disassemble"); add(new DisplayCommand(), "display"); @@ -95,10 +93,10 @@ public class TopLevelCommand extends MultiLevelCommand { add(new GoCommand(), "g|o"); add(new HaltCommand(), "h|alt"); add(new Help(), "help"); + add(new InfoCommand(), "info"); add(new KillCommand(), "k|ill"); add(new ListCommand(), "l|ist"); add(new LoadCommand(), "load"); - add(new MapsCommand(), "maps"); add(new PeekCommand(), "peek"); Command quit = new QuitCommand(); add(quit, "exit"); hooks/post-receive -- frysk system monitor/debugger