public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: rmoseley@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Merge branch 'master' of ssh://sources.redhat.com/git/frysk Date: Thu, 05 Jun 2008 15:33:00 -0000 [thread overview] Message-ID: <20080605153336.32380.qmail@sourceware.org> (raw) The branch, master has been updated via ad36974015d8a9f2404e3deb5c537a8e8f89dea0 (commit) via 36be80f0873e0dd9255e99c3b995aecc0fdd0863 (commit) from 0ef023547a5ee68baa4f7c6fc375dac6f886ddfb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit ad36974015d8a9f2404e3deb5c537a8e8f89dea0 Merge: 36be80f0873e0dd9255e99c3b995aecc0fdd0863 0ef023547a5ee68baa4f7c6fc375dac6f886ddfb Author: Rick Moseley <rmoseley@localhost.localdomain> Date: Thu Jun 5 10:33:12 2008 -0500 Merge branch 'master' of ssh://sources.redhat.com/git/frysk commit 36be80f0873e0dd9255e99c3b995aecc0fdd0863 Author: Rick Moseley <rmoseley@localhost.localdomain> Date: Thu Jun 5 10:27:07 2008 -0500 Fix UnloadCommand errors. * UnloadCommand.java: Fix errors for unloading processes. * TestUnloadCommand.java: Add tests for above fix. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 5 ++ frysk-core/frysk/hpd/TestUnloadCommand.java | 22 +++++++ frysk-core/frysk/hpd/UnloadCommand.java | 81 +++++++-------------------- 3 files changed, 47 insertions(+), 61 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 0b67fba..33e1546 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,8 @@ +2008-06-05 Rick Moseley <rmoseley@redhat.com> + + * UnloadCommand.java: Fix errors for unloading processes. + * TestUnloadCommand.java: Add tests for above fix. + 2008-06-01 Rick Moseley <rmoseley@redhat.com> * TestUnloadCommand.java: New. diff --git a/frysk-core/frysk/hpd/TestUnloadCommand.java b/frysk-core/frysk/hpd/TestUnloadCommand.java index e8cf5b4..39a76a4 100644 --- a/frysk-core/frysk/hpd/TestUnloadCommand.java +++ b/frysk-core/frysk/hpd/TestUnloadCommand.java @@ -58,4 +58,26 @@ public class TestUnloadCommand extends TestLib { e.expect("Quitting\\.\\.\\."); e.close(); } + + public void testUnloadSingle() { + e = new HpdTestbed(); + e.sendCommandExpectPrompt("load " + Prefix.pkgLibFile("funit-parameters").getPath() + + " abc def ghi", "\\[0\\.0\\] Loaded executable file.*"); + e.sendCommandExpectPrompt("unload -t 0", "Removed Target set \\[0\\].*"); + e.sendCommandExpectPrompt("load", "No loaded procs currently.*"); + e.send("quit\n"); + e.expect("Quitting\\.\\.\\."); + e.close(); + } + + public void testUnloadError() { + e = new HpdTestbed(); + e.sendCommandExpectPrompt("unload -t 0", "Error: Trying to remove a proc that has not been loaded.*"); + e.sendCommandExpectPrompt("unload", "No loaded procs currently.*"); + e.send("quit\n"); + e.expect("Quitting\\.\\.\\."); + e.close(); + } + + } \ No newline at end of file diff --git a/frysk-core/frysk/hpd/UnloadCommand.java b/frysk-core/frysk/hpd/UnloadCommand.java index 0e4c056..1ca36f8 100644 --- a/frysk-core/frysk/hpd/UnloadCommand.java +++ b/frysk-core/frysk/hpd/UnloadCommand.java @@ -39,13 +39,7 @@ package frysk.hpd; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Set; -import frysk.proc.Proc; -//import frysk.proc.Task; /** * UnloadCommand handles the unloading of processes that have been loaded @@ -71,13 +65,12 @@ public class UnloadCommand extends ParameterizedCommand { if (cmd.size() > 3) { throw new InvalidCommandException("Too many parameters"); - } else if (cmd.size() < 1 && !cli.loadedProcs.isEmpty()) { + } else if (cmd.size() < 1) { + if (!cli.loadedProcs.isEmpty()) // List the loaded procs if no parameters entered - LoadCommand.printLoop(cli, "Loaded Procs", cli.loadedProcs); - return; - } else if (cmd.size() < 1 && cli.loadedProcs.isEmpty()) { - cli.addMessage("No loaded procs currently, must load a proc before unloading", - Message.TYPE_NORMAL); + LoadCommand.printLoop(cli, "Loaded Procs", cli.loadedProcs); + else + cli.addMessage("No loaded procs currently", Message.TYPE_NORMAL); return; } @@ -85,63 +78,29 @@ public class UnloadCommand extends ParameterizedCommand { if (cmd.size() != 2) throw new InvalidCommandException("Not enough parameters"); int id = Integer.parseInt(cmd.parameter(1)); - Proc proc = cli.idManager.getProc(id); - if (proc == null) { - cli.addMessage("Trying to remove a proc that has not been loaded", Message.TYPE_ERROR); - return; - } - if (removeFromHashMap(proc, cli.loadedProcs, cli)) { - cli.targetset.removeProc(id); - cli.addMessage("Removed Target set [" + id + "]" , Message.TYPE_NORMAL); - } else { - cli.addMessage("Target id " + id + " could not be found", Message.TYPE_ERROR); + synchronized (cli) { + if (cli.loadedProcs.remove(new Integer(id)) == null) { + cli.addMessage( + "Trying to remove a proc that has not been loaded", + Message.TYPE_ERROR); + return; + } else { + cli.targetset.removeProc(id); + cli.addMessage("Removed Target set [" + id + "]" , Message.TYPE_NORMAL); + return; + } } - return; } if (cmd.parameter(0).equals("-all")) { - removeAllProcs(cli.loadedProcs, cli); + System.out.println("UnloadCommand.interpret: looking at -all"); + synchronized (cli) { + cli.loadedProcs.clear(); + } cli.addMessage("All loaded procs removed", Message.TYPE_NORMAL); return; } } - /** - * removeFromHashMap removes the designated process from the designated HashMap. - * - * @param proc is the proc object to be removed - * @param procMap is the HashMap of the procs to search for removal - * @param cli is the current command line interface object - */ - private boolean removeFromHashMap(Proc proc, HashMap procMap, CLI cli) { - Set procSet = procMap.entrySet(); - Iterator foo = procSet.iterator(); - while (foo.hasNext()) { - Map.Entry me = (Map.Entry) foo.next(); - Proc newProc = (Proc) me.getKey(); - if (proc.getExeFile().getSysRootedPath().equals(newProc.getExeFile().getSysRootedPath())) { - synchronized (cli) { - foo.remove(); - } - return true; - } - } - return false; - } - - /** - * removeAllProcs removes all of the procs loaded via the load command - * - * @param procMap is a HashMap of the set of procs to remove - * @param cli is the current command line interface object - * - */ - private void removeAllProcs(HashMap procMap, CLI cli) { - synchronized (cli) { - procMap.clear(); - } - - } - int completer(CLI cli, Input input, int cursor, List completions) { return CompletionFactory.completeFileName(cli, input, cursor, completions); hooks/post-receive -- frysk system monitor/debugger
next reply other threads:[~2008-06-05 15:33 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-06-05 15:33 rmoseley [this message] -- strict thread matches above, loose matches on Subject: below -- 2008-05-12 16:30 rmoseley 2008-05-12 16:07 pmuldoon 2008-05-09 17:29 rmoseley 2008-04-02 22:41 pmuldoon 2008-04-01 12:28 pmuldoon 2008-03-20 20:20 rmoseley 2008-03-18 16:22 pmuldoon 2008-02-26 15:32 pmuldoon 2008-01-24 19:23 rmoseley 2008-01-23 21:10 rmoseley 2008-01-03 16:55 pmuldoon 2007-12-13 20:18 rmoseley 2007-12-04 17:45 jflavio 2007-11-30 4:24 jflavio 2007-11-28 21:40 jflavio 2007-11-28 16:20 jflavio 2007-11-28 13:08 pmuldoon 2007-11-28 12:04 mark 2007-11-20 22:47 scox 2007-11-19 17:58 scox 2007-11-17 8:35 rmoseley 2007-11-16 15:59 scox 2007-11-16 14:59 pmuldoon 2007-11-14 2:38 scox 2007-11-14 2:09 jflavio 2007-11-13 0:41 scox 2007-11-10 14:47 jflavio 2007-11-10 0:34 scox 2007-11-09 14:59 jflavio
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080605153336.32380.qmail@sourceware.org \ --to=rmoseley@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).