From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30741 invoked by alias); 4 Feb 2008 20:49:53 -0000 Received: (qmail 30713 invoked by uid 9519); 4 Feb 2008 20:49:51 -0000 Date: Mon, 04 Feb 2008 20:49:00 -0000 Message-ID: <20080204204951.30697.qmail@sourceware.org> From: rmoseley@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Added 2008 to copyright in header. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 496a057743a2b939fcc0ddbf10e82876aebdac24 X-Git-Newrev: 7c08b13dc4b83fc468190c889ba3de2f7d8e83f7 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/msg00152.txt.bz2 The branch, master has been updated via 7c08b13dc4b83fc468190c889ba3de2f7d8e83f7 (commit) via c9c5b84e14fa23eeffaf6757c8605c47b2929662 (commit) from 496a057743a2b939fcc0ddbf10e82876aebdac24 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 7c08b13dc4b83fc468190c889ba3de2f7d8e83f7 Author: Rick Moseley Date: Mon Feb 4 14:49:40 2008 -0600 Added 2008 to copyright in header. TestLoadCommand.java: Changed copyright to include 2008. commit c9c5b84e14fa23eeffaf6757c8605c47b2929662 Author: Rick Moseley Date: Mon Feb 4 14:46:20 2008 -0600 Have load command print out loaded procs if no parameters are entered. * LoadCommand.java: Show loaded procs when no parameters are entered. * TestLoadCommand.java: Added 2 new tests for above. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 5 ++++ frysk-core/frysk/hpd/LoadCommand.java | 37 +++++++++++++++++++++++++--- frysk-core/frysk/hpd/TestLoadCommand.java | 22 ++++++++++++++++- 3 files changed, 59 insertions(+), 5 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 8694e49..1cd9387 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,8 @@ +2008-02-04 Rick Moseley + + * LoadCommand.java: Show loaded procs when no parameters are entered. + * TestLoadCommand.java: Added 2 new tests for above. + 2008-02-04 Tim Moore * BreakpointCommand.java (interpret): Print out hex address when breakpoint is hit. diff --git a/frysk-core/frysk/hpd/LoadCommand.java b/frysk-core/frysk/hpd/LoadCommand.java index f2ff5ae..dd552e4 100644 --- a/frysk-core/frysk/hpd/LoadCommand.java +++ b/frysk-core/frysk/hpd/LoadCommand.java @@ -40,7 +40,10 @@ package frysk.hpd; import java.io.File; +import java.util.HashMap; import java.util.Iterator; +import java.util.Map; +import java.util.Set; import frysk.debuginfo.DebugInfo; import frysk.debuginfo.DebugInfoFrame; import frysk.debuginfo.DebugInfoStackFactory; @@ -62,13 +65,16 @@ public class LoadCommand extends ParameterizedCommand { LoadCommand() { super("load", - "load path-to-executable [ -sysroot Path ]", + "load [ path-to-executable ] [ -sysroot Path ]", "The load command lets the user examine information about" + " an executable file without actually running it. An" + " executable must be loaded with this command before it" + " can be run with either the 'start' or 'run' command." - + " No arguments are entered here, they are passed to the" - + " process via the 'start'/'run' commands."); + + " If no args are entered a list of the loaded procs(if any)" + + " is displayed.\nNo arguments to be passed to the proc are" + + " entered here. Those arguments are passed to the proc(s)" + + " via the 'start' or 'run' commands."); + add(new CommandOption("sysroot", "pathname to use as a sysroot", "Pathname") { void parse(String args, Object options) { @@ -90,7 +96,9 @@ public class LoadCommand extends ParameterizedCommand { if (cmd.size() > 2) { throw new InvalidCommandException("Too many parameters"); } else if (cmd.size() < 1) { - throw new InvalidCommandException("missing arguments"); + // List the loaded procs if no parameters entered + listLoadedProcs(cli); + return; } File executableFile = new File(cmd.parameter(0)); @@ -125,6 +133,27 @@ public class LoadCommand extends ParameterizedCommand { cli.addMessage("Loaded executable file: " + cmd.parameter(0), Message.TYPE_NORMAL); } + + /** + * listLoadedProcs lists the currently loaded procs + * + * @param cli is the current commandline interface object + */ + private void listLoadedProcs(CLI cli) { + HashMap listLoaded = cli.getLoadedProcs(); + if (listLoaded.isEmpty()) { + cli.addMessage("No loaded procs currently", Message.TYPE_NORMAL); + return; + } + Set procSet = listLoaded.entrySet(); + Iterator foo = procSet.iterator(); + while (foo.hasNext()) { + Map.Entry me = (Map.Entry) foo.next(); + Proc proc = (Proc) me.getKey(); + Integer taskId = (Integer) me.getValue(); + cli.addMessage("Task Id " + taskId + " = " + proc.getExe(), Message.TYPE_NORMAL); + } + } int completer(CLI cli, Input input, int cursor, List completions) { return CompletionFactory.completeFileName(cli, input, cursor, diff --git a/frysk-core/frysk/hpd/TestLoadCommand.java b/frysk-core/frysk/hpd/TestLoadCommand.java index b2abe24..164ef1c 100644 --- a/frysk-core/frysk/hpd/TestLoadCommand.java +++ b/frysk-core/frysk/hpd/TestLoadCommand.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007 Red Hat Inc. +// Copyright 2007, 2008 Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -94,4 +94,24 @@ public class TestLoadCommand extends TestLib { e.expect("Quitting..."); e.close(); } + + public void testLoadNoneLoaded() { + e = new HpdTestbed(); + e.sendCommandExpectPrompt("load", "No loaded procs currently.*"); + e.send("quit\n"); + e.expect("Quitting..."); + e.close(); + } + + public void testLoadDisplay() { + e = new HpdTestbed(); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(), + "Loaded executable file.*"); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-hello").getPath(), + "Loaded executable file.*"); + e.sendCommandExpectPrompt("load", "Task Id ([0-9]+).*Task Id ([0-9]+).*"); + e.send("quit\n"); + e.expect("Quitting..."); + e.close(); + } } hooks/post-receive -- frysk system monitor/debugger