public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Start switch to CommandlineParser.parseCommandFIXME. Date: Wed, 27 Feb 2008 01:30:00 -0000 [thread overview] Message-ID: <20080227013054.4230.qmail@sourceware.org> (raw) The branch, master has been updated via 06bc3d3173c673eb2486c917fa60396893931a9c (commit) from 61fd2dad20bc97f51520127afbc3f9dc9de3b28a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 06bc3d3173c673eb2486c917fa60396893931a9c Author: Andrew Cagney <cagney@redhat.com> Date: Tue Feb 26 20:30:31 2008 -0500 Start switch to CommandlineParser.parseCommandFIXME. frysk-core/frysk/bindir/ChangeLog 2008-02-26 Andrew Cagney <cagney@redhat.com> * fauxv.java: Update to match ProcEvent. * fmaps.java: Ditto. * fexe.java: Ditto. * fcore.java: Ditto. * fdebuginfo.java: Ditto. * TestFcore.java: Match new error messages. frysk-core/frysk/event/ChangeLog 2008-02-26 Andrew Cagney <cagney@redhat.com> * ProcEvent.java (executeDead(Proc)): Replace executeDead(Proc,File). frysk-core/frysk/util/ChangeLog 2008-02-26 Andrew Cagney <cagney@redhat.com> * CommandlineParser.java (parse(String[])): Catch any exception. * ProcStopUtil.java (parseCores(Proc[])): Replace parseCoresFIXME(CoreExePair[]). (parseCommand(Proc)): Replace parseCommandFIXME(String[]). (failIfProcNull(Proc)): Delete. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 7 ++++ frysk-core/frysk/bindir/TestFcore.java | 2 +- frysk-core/frysk/bindir/TestFdebuginfo.java | 2 +- frysk-core/frysk/bindir/fauxv.java | 5 +-- frysk-core/frysk/bindir/fcore.java | 4 +-- frysk-core/frysk/bindir/fdebuginfo.java | 6 +-- frysk-core/frysk/bindir/fexe.java | 14 +++----- frysk-core/frysk/bindir/fmaps.java | 6 +-- frysk-core/frysk/event/ChangeLog | 4 ++ frysk-core/frysk/event/ProcEvent.java | 6 +-- frysk-core/frysk/util/ChangeLog | 6 +++ frysk-core/frysk/util/CommandlineParser.java | 2 +- frysk-core/frysk/util/ProcStopUtil.java | 47 ++++++-------------------- 13 files changed, 45 insertions(+), 66 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index b361474..506f506 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,5 +1,12 @@ 2008-02-26 Andrew Cagney <cagney@redhat.com> + * fauxv.java: Update to match ProcEvent. + * fmaps.java: Ditto. + * fexe.java: Ditto. + * fcore.java: Ditto. + * fdebuginfo.java: Ditto. + * TestFcore.java: Match new error messages. + * fcatch.java: Update to match CommandlineParser. * fstack.java: Ditto. * ftrace.java: Ditto. diff --git a/frysk-core/frysk/bindir/TestFcore.java b/frysk-core/frysk/bindir/TestFcore.java index 9847fdd..64e9d4c 100644 --- a/frysk-core/frysk/bindir/TestFcore.java +++ b/frysk-core/frysk/bindir/TestFcore.java @@ -54,7 +54,7 @@ public class TestFcore extends TestLib { Config.getBinFile("fcore").getAbsolutePath (), "this is a bad argument" }); - e.expect("File does not exist or is not readable or is not a file."); + e.expect("Error: "); } public void testBadConsoleParameter () { diff --git a/frysk-core/frysk/bindir/TestFdebuginfo.java b/frysk-core/frysk/bindir/TestFdebuginfo.java index 899250a..c8bcf29 100644 --- a/frysk-core/frysk/bindir/TestFdebuginfo.java +++ b/frysk-core/frysk/bindir/TestFdebuginfo.java @@ -75,7 +75,7 @@ public class TestFdebuginfo extends TestLib { Config.getBinFile("fdebuginfo").getAbsolutePath (), "this is a bad argument" }); - e.expect("File does not exist or is not readable or is not a file."); + e.expect("Error: "); } public void testInvalidArgument() { diff --git a/frysk-core/frysk/bindir/fauxv.java b/frysk-core/frysk/bindir/fauxv.java index 8cbd8d3..614a43e 100644 --- a/frysk-core/frysk/bindir/fauxv.java +++ b/frysk-core/frysk/bindir/fauxv.java @@ -43,7 +43,6 @@ import frysk.event.ProcEvent; import frysk.proc.Proc; import frysk.util.AuxvStringBuilder; import frysk.util.ProcStopUtil; -import java.io.File; public class fauxv { @@ -77,8 +76,8 @@ public class fauxv { } } - public void executeDead(Proc proc, File file) { - executeLive (proc); + public void executeDead(Proc proc) { + executeLive(proc); } } } diff --git a/frysk-core/frysk/bindir/fcore.java b/frysk-core/frysk/bindir/fcore.java index 4c8827a..a6a2239 100644 --- a/frysk-core/frysk/bindir/fcore.java +++ b/frysk-core/frysk/bindir/fcore.java @@ -40,8 +40,6 @@ package frysk.bindir; import java.util.logging.Logger; -import java.io.File; - import frysk.event.ProcEvent; import frysk.proc.Proc; @@ -160,7 +158,7 @@ public class fcore } } - public void executeDead(Proc proc, File coreFile) { + public void executeDead(Proc proc) { System.err.println ("Cannot create core file from dead process"); } } diff --git a/frysk-core/frysk/bindir/fdebuginfo.java b/frysk-core/frysk/bindir/fdebuginfo.java index 4d0c565..078ea55 100644 --- a/frysk-core/frysk/bindir/fdebuginfo.java +++ b/frysk-core/frysk/bindir/fdebuginfo.java @@ -39,8 +39,6 @@ package frysk.bindir; -import java.io.File; - import frysk.event.ProcEvent; import frysk.proc.Proc; import frysk.proc.Task; @@ -81,8 +79,8 @@ public final class fdebuginfo System.out.println("No packages found."); } - public void executeDead(Proc proc, File file) { - executeLive (proc); + public void executeDead(Proc proc) { + executeLive(proc); } } } \ No newline at end of file diff --git a/frysk-core/frysk/bindir/fexe.java b/frysk-core/frysk/bindir/fexe.java index 21cd424..3f203b8 100644 --- a/frysk-core/frysk/bindir/fexe.java +++ b/frysk-core/frysk/bindir/fexe.java @@ -46,7 +46,6 @@ import frysk.event.ProcEvent; import frysk.proc.Proc; import frysk.sys.proc.Exe; import gnu.classpath.tools.getopt.Option; -import java.io.File; public class fexe { @@ -81,17 +80,14 @@ public class fexe System.out.println(proc.getExe()); } - public void executeDead(Proc proc, File coreFile) { - if (coreFile == null) - System.out.println(proc.getExe()); - - else if (verbose) { - System.out.println( coreFile + public void executeDead(Proc proc) { + if (verbose) { + System.out.println(proc.getHost().getName() + " " + proc.getExe()); - } - else + } else { System.out.println(proc.getExe()); + } } } } diff --git a/frysk-core/frysk/bindir/fmaps.java b/frysk-core/frysk/bindir/fmaps.java index a3e2a12..63a29c2 100644 --- a/frysk-core/frysk/bindir/fmaps.java +++ b/frysk-core/frysk/bindir/fmaps.java @@ -39,8 +39,6 @@ package frysk.bindir; -import java.io.File; - import frysk.util.ProcStopUtil; import frysk.event.ProcEvent; import frysk.proc.Proc; @@ -64,8 +62,8 @@ public class fmaps { System.out.println(maps[i].toString()); } - public void executeDead(Proc proc, File file) { - executeLive (proc); + public void executeDead(Proc proc) { + executeLive(proc); } } } diff --git a/frysk-core/frysk/event/ChangeLog b/frysk-core/frysk/event/ChangeLog index 555191a..073394e 100644 --- a/frysk-core/frysk/event/ChangeLog +++ b/frysk-core/frysk/event/ChangeLog @@ -1,3 +1,7 @@ +2008-02-26 Andrew Cagney <cagney@redhat.com> + + * ProcEvent.java (executeDead(Proc)): Replace executeDead(Proc,File). + 2008-02-21 Teresa Thomas <tthomas@redhat.com> * ProcEvent.java (executeDead): New. diff --git a/frysk-core/frysk/event/ProcEvent.java b/frysk-core/frysk/event/ProcEvent.java index 993f669..bf7aac2 100644 --- a/frysk-core/frysk/event/ProcEvent.java +++ b/frysk-core/frysk/event/ProcEvent.java @@ -40,13 +40,11 @@ package frysk.event; import frysk.proc.Proc; -import java.io.File; /** * The proc event interface. Used by frysk utilities. */ -public interface ProcEvent -{ +public interface ProcEvent { void executeLive(Proc proc); - void executeDead(Proc proc, File file); + void executeDead(Proc proc); } diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog index 9b3d0c9..0a32f31 100644 --- a/frysk-core/frysk/util/ChangeLog +++ b/frysk-core/frysk/util/ChangeLog @@ -1,5 +1,11 @@ 2008-02-26 Andrew Cagney <cagney@redhat.com> + * CommandlineParser.java (parse(String[])): Catch any exception. + * ProcStopUtil.java (parseCores(Proc[])): Replace + parseCoresFIXME(CoreExePair[]). + (parseCommand(Proc)): Replace parseCommandFIXME(String[]). + (failIfProcNull(Proc)): Delete. + * Util.java (getProcFromExeFile(Host)): Delete. * CommandlineParser.java parseCommandFIXME(String[]): Replace diff --git a/frysk-core/frysk/util/CommandlineParser.java b/frysk-core/frysk/util/CommandlineParser.java index 529b68c..7d04366 100644 --- a/frysk-core/frysk/util/CommandlineParser.java +++ b/frysk-core/frysk/util/CommandlineParser.java @@ -137,7 +137,7 @@ public class CommandlineParser { String[] result = doParse(args); validate(); return result; - } catch (OptionException e) { + } catch (Exception e) { System.err.println("Error: " + e.getMessage()); System.exit(1); return null; // To fool Java diff --git a/frysk-core/frysk/util/ProcStopUtil.java b/frysk-core/frysk/util/ProcStopUtil.java index 869f37f..4188542 100644 --- a/frysk-core/frysk/util/ProcStopUtil.java +++ b/frysk-core/frysk/util/ProcStopUtil.java @@ -39,8 +39,6 @@ package frysk.util; -import java.io.File; - import frysk.event.Event; import frysk.event.ProcEvent; import frysk.proc.Manager; @@ -49,9 +47,7 @@ import frysk.proc.ProcBlockAction; import frysk.proc.ProcObserver; import frysk.proc.Task; import frysk.util.CommandlineParser; -import frysk.util.Util; import gnu.classpath.tools.getopt.Option; -import frysk.proc.dead.LinuxExeFactory; /** * Framework to be used for frysk utilities that, @@ -67,7 +63,7 @@ public class ProcStopUtil private CommandlineParser parser; public ProcStopUtil (String utilName, String[] args, - final ProcEvent procEvent) { + final ProcEvent procEvent) { this.args = args; parser = new CommandlineParser(utilName) { //@Override @@ -80,32 +76,19 @@ public class ProcStopUtil } } - //@Override - public void parseCoresFIXME(CoreExePair[] coreExePairs) { - for (int i = 0; i < coreExePairs.length; i++) - { - proc = Util.getProcFromCoreExePair(coreExePairs[i]); - failIfProcNull(proc); - procEvent.executeDead(proc, coreExePairs[i].coreFile); + //@Override + public void parseCores(Proc[] cores) { + for (int i = 0; i < cores.length; i++) { + Proc core = cores[i]; + procEvent.executeDead(core); + } } - } - //@Override - public void parseCommandFIXME(String[] command) { - File exeFile = new File(command[0]); - if (!exeFile.exists() || !exeFile.canRead() - || !exeFile.isFile()) { - System.err.println ("File does not exist or is " + - "not readable or is not a file."); - System.exit(1); - } else { - Manager.eventLoop.start(); - proc = LinuxExeFactory.createProc(exeFile, command); - failIfProcNull(proc); - procEvent.executeDead(proc, null); + //@Override + public void parseCommand(Proc command) { + procEvent.executeDead(proc); } - } - }; + }; } /** @@ -138,14 +121,6 @@ public class ProcStopUtil } } - private void failIfProcNull (Proc proc) { - if (proc == null) { - System.err.println("ERROR: Invalid argument."); - // Exit if no proc found. - System.exit(1); - } - } - private static class UtilAction implements ProcObserver.ProcAction { hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-02-27 1:30 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080227013054.4230.qmail@sourceware.org \ --to=cagney@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).