public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: pmuldoon@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] frysk system monitor/debugger branch, master, updated. 9db08d018eb772dc97a7244e1c8bde3fbd523f8d Date: Thu, 08 Nov 2007 12:04:00 -0000 [thread overview] Message-ID: <20071108120453.20806.qmail@sourceware.org> (raw) The branch, master has been updated via 9db08d018eb772dc97a7244e1c8bde3fbd523f8d (commit) from 5dfe33d429e0f1c08a271e91bc7aa2e44ed938c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 9db08d018eb772dc97a7244e1c8bde3fbd523f8d Author: Phil Muldoon <pmuldoon@redhat.com> Date: Thu Nov 8 12:04:46 2007 +0000 Reformat to SUN style, and remove errant System.out ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/CoreCommand.java | 221 +++++++++++++++++---------------- 1 files changed, 112 insertions(+), 109 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/CoreCommand.java b/frysk-core/frysk/hpd/CoreCommand.java index c33e0bf..2b2935e 100644 --- a/frysk-core/frysk/hpd/CoreCommand.java +++ b/frysk-core/frysk/hpd/CoreCommand.java @@ -53,122 +53,125 @@ import frysk.proc.dead.LinuxHost; public class CoreCommand extends ParameterizedCommand { File coreFile = null; + File exeFile = null; + boolean noExeOption = false; - - CoreCommand() { - super("core", "core <core-file> [ <executable> ] [ -noexe ]", - "open a core file"); - - - add(new CommandOption("noexe", - "Do not attempt to load executable ") { - void parse(String argument, Object options) { - System.out.println("Trigger noexe"); - noExeOption = true; - } - }); - - } - - void interpret(CLI cli, Input cmd, Object options) { - - Proc coreProc; - LinuxHost coreHost = null; - - // If > 2 parameter, then too many parameters. - if (cmd.size() > 2) { - throw new InvalidCommandException("Too many parameters, a maximum of two should be specified."); - } - - // If < 1 parameter, then not enough parameters. - if (cmd.size() < 1) { - throw new InvalidCommandException("Please specify a corefile with the core command"); + + CoreCommand() { + super("core", "core <core-file> [ <executable> ] [ -noexe ]", + "open a core file"); + + add(new CommandOption("noexe", "Do not attempt to load executable ") { + void parse(String argument, Object options) { + noExeOption = true; + } + }); + } - // Command line seems, sane parse. - parseCommandLine(cmd); - - // Does the corefile exist? - if ((!coreFile.exists()) || (!coreFile.canRead())) - throw new InvalidCommandException("No core file found, or cannot read corefile"); - - // Build Core. Move any exceptions up to cli and print to user. - try { - coreHost = getHost(coreFile, exeFile, noExeOption); - } catch (Exception e) { - cli.addMessage("An error has occured while loading corefile: '" + coreFile.getAbsolutePath() - + "'. Error message is: " + e.getMessage(), Message.TYPE_ERROR); - return; + void interpret(CLI cli, Input cmd, Object options) { + + Proc coreProc; + LinuxHost coreHost = null; + + // If > 2 parameter, then too many parameters. + if (cmd.size() > 2) { + throw new InvalidCommandException( + "Too many parameters, a maximum of two should be specified."); + } + + // If < 1 parameter, then not enough parameters. + if (cmd.size() < 1) { + throw new InvalidCommandException( + "Please specify a corefile with the core command"); + } + + // Command line seems, sane parse. + parseCommandLine(cmd); + + // Does the corefile exist? + if ((!coreFile.exists()) || (!coreFile.canRead())) + throw new InvalidCommandException( + "No core file found, or cannot read corefile"); + + // Build Core. Move any exceptions up to cli and print to user. + try { + coreHost = getHost(coreFile, exeFile, noExeOption); + } catch (Exception e) { + cli.addMessage("An error has occured while loading corefile: '" + + coreFile.getAbsolutePath() + "'. Error message is: " + + e.getMessage(), Message.TYPE_ERROR); + return; + } + + // Get the core proc. + coreProc = getProc(coreHost); + + // Error out if no exe found, and -noexe option specified + if ((noExeOption == false) && (coreHost.getStatus().hasExe == false)) { + cli.addMessage( + "Could not find executable: '" + + coreProc.getExe()+ "' specified for corefile. " + + "You can specify one with the core command. E.g: core core.file yourexefile. Alternatively " + + "you can tell fhpd to ignore the executable with -noexe. E.g core core.file -noexe. No " + + "corefile has been loaded at this time.", + Message.TYPE_ERROR); + return; + } + + // All checks are done. Host is built. Now start reserving space in the sets + int procID = cli.idManager.reserveProcID(); + cli.idManager.manageProc(coreProc, procID); + + // Build debug info for each task and frame. + Iterator foo = cli.targetset.getTasks(); + while (foo.hasNext()) { + Task task = (Task) foo.next(); + DebugInfoFrame frame = DebugInfoStackFactory + .createVirtualStackTrace(task); + cli.setTaskFrame(task, frame); + cli.setTaskDebugInfo(task, new DebugInfo(frame)); + } + + // Finally, done. + cli.addMessage("Attached to core file: " + cmd.parameter(0), + Message.TYPE_NORMAL); + } - - // Get the core proc. - coreProc = getProc(coreHost); - - // Error out if no exe found, and -noexe option specified - if ((noExeOption == false) && (coreHost.getStatus().hasExe == false)) - { - cli.addMessage("Could not find executable: '"+coreProc.getExe()+"' specified for corefile. "+ - "You can specify one with the core command. E.g: core core.file yourexefile. Alternatively " + - "you can tell fhpd to ignore the executable with -noexe. E.g core core.file -noexe. No " + - "corefile has been loaded at this time.", Message.TYPE_ERROR); - return; + + // Build Correct Host on options. + private LinuxHost getHost(File coreFile, File executable, boolean loadExe) { + LinuxHost coreHost = null; + if (executable == null) + if (!loadExe) + coreHost = new LinuxHost(Manager.eventLoop, coreFile); + else + coreHost = new LinuxHost(Manager.eventLoop, coreFile, null); + else + coreHost = new LinuxHost(Manager.eventLoop, coreFile, executable); + + return coreHost; } - // All checks are done. Host is built. Now start reserving space in the sets - int procID = cli.idManager.reserveProcID(); - cli.idManager.manageProc(coreProc, procID); - - // Build debug info for each task and frame. - Iterator foo = cli.targetset.getTasks(); - while (foo.hasNext()) { - Task task = (Task) foo.next(); - DebugInfoFrame frame = DebugInfoStackFactory - .createVirtualStackTrace(task); - cli.setTaskFrame(task, frame); - cli.setTaskDebugInfo(task, new DebugInfo( - frame)); + // From a Host, get a Proc + private Proc getProc(LinuxHost coreHost) { + // Get an iterator to the one process + Iterator i = coreHost.getProcIterator(); + + // Find process, if not error out and return. + if (i.hasNext()) + return (Proc) i.next(); + else + return null; } - // Finally, done. - cli.addMessage("Attached to core file: " + cmd.parameter(0), - Message.TYPE_NORMAL); - - - } - - // Build Correct Host on options. - private LinuxHost getHost(File coreFile, File executable, boolean loadExe) { - LinuxHost coreHost = null; - if (executable == null) - if (!loadExe) - coreHost = new LinuxHost(Manager.eventLoop, coreFile); - else - coreHost = new LinuxHost(Manager.eventLoop, coreFile, null); - else - coreHost = new LinuxHost(Manager.eventLoop, coreFile, executable); - - return coreHost; - } - - // From a Host, get a Proc - private Proc getProc(LinuxHost coreHost) { - // Get an iterator to the one process - Iterator i = coreHost.getProcIterator(); - - // Find process, if not error out and return. - if (i.hasNext()) - return (Proc) i.next(); - else - return null; - } - - // Parse the option commandline - private void parseCommandLine(Input cli) { - coreFile = new File(cli.parameter(0)); - if (cli.size() == 1) - return; - else - exeFile = new File(cli.parameter(1)); - } + // Parse the option commandline + private void parseCommandLine(Input cli) { + coreFile = new File(cli.parameter(0)); + if (cli.size() == 1) + return; + else + exeFile = new File(cli.parameter(1)); + } } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2007-11-08 12:04 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=20071108120453.20806.qmail@sourceware.org \ --to=pmuldoon@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).