public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: scox@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Add sysroot option to CommandlineParser. Date: Fri, 29 Feb 2008 21:20:00 -0000 [thread overview] Message-ID: <20080229212011.12112.qmail@sourceware.org> (raw) The branch, master has been updated via 5b833702426e587b5ca96e851d338d1a1b948709 (commit) from 148d1359cf791171d7f346d4fca35c1fc36aca8c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 5b833702426e587b5ca96e851d338d1a1b948709 Author: Stan Cox <scox@redhat.com> Date: Fri Feb 29 16:06:37 2008 -0500 Add sysroot option to CommandlineParser. * CommandlineParser.java (CommandlineParser): Add new option sysroot. (parseSysroot): Use it. * DwflCache.java (setDefaultSysroot): New. (getDwfl): Use it. * fhpd.java (main): Remove -sysroot option. * LoadCommand.java (load): Add no sysroot variant. * CoreCommand.java (load): Likewise. * AttachCommand.java (attach): Likewise. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 6 ++++++ frysk-core/frysk/bindir/fhpd.java | 21 +++------------------ frysk-core/frysk/dwfl/ChangeLog | 5 +++++ frysk-core/frysk/dwfl/DwflCache.java | 18 +++++++++++++++--- frysk-core/frysk/hpd/AttachCommand.java | 4 ++++ frysk-core/frysk/hpd/ChangeLog | 6 ++++++ frysk-core/frysk/hpd/CoreCommand.java | 4 ++++ frysk-core/frysk/hpd/LoadCommand.java | 4 ++++ frysk-core/frysk/util/ChangeLog | 5 +++++ frysk-core/frysk/util/CommandlineParser.java | 15 +++++++++++++++ 10 files changed, 67 insertions(+), 21 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index 4f2f4dd..60c069d 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,3 +1,9 @@ +2008-02-29 Stan Cox <scox@redhat.com> + + * fhpd.java (main): Remove -sysroot option. + (CommandLine.run): Use no sysroot variant of AttachCommand, CoreCommand, + and LoadCommand. + 2008-02-29 Andrew Cagney <cagney@redhat.com> * ftrace.java: Move Rule, SymbolRule and MyFtraceController to diff --git a/frysk-core/frysk/bindir/fhpd.java b/frysk-core/frysk/bindir/fhpd.java index ed2dc6c..efc8520 100644 --- a/frysk-core/frysk/bindir/fhpd.java +++ b/frysk-core/frysk/bindir/fhpd.java @@ -57,8 +57,6 @@ import frysk.util.FlowControlWriter; import frysk.proc.Manager; import frysk.util.CommandlineParser; import frysk.util.ObservingTerminal; -import gnu.classpath.tools.getopt.Option; -import gnu.classpath.tools.getopt.OptionException; import frysk.sys.FileDescriptor; import frysk.proc.Proc; @@ -66,7 +64,6 @@ public class fhpd { private static Proc[] pids; private static Proc command; private static Proc[] cores; - private static String sysroot; private static int exitStatus; final static class FhpdCompletor implements Completor { @@ -131,14 +128,14 @@ public class fhpd { // Prime the CLI based on the parameters. if (pids != null) { for (int i = 0; i < pids.length; i++) { - AttachCommand.attach(pids[i], cli, sysroot); + AttachCommand.attach(pids[i], cli); } } else if (cores != null) { for (int i = 0; i < cores.length; i++) { - CoreCommand.load(cores[i], cli, sysroot); + CoreCommand.load(cores[i], cli); } } else if (command != null) { - LoadCommand.load(command, cli, sysroot); + LoadCommand.load(command, cli); } try { @@ -172,18 +169,6 @@ public class fhpd { fhpd.cores = cores; } }; - parser.add(new Option("sysroot", 's', - "Assume the executable is from a sysroot build ", - "SysRoot-Path") { - public void parsed(String sysrootValue) throws OptionException { - try { - sysroot = sysrootValue; - } catch (IllegalArgumentException e) { - throw new OptionException("Invalid sysroot parameter " - + sysrootValue); - } - } - }); parser.setHeader("Usage: fhpd <PID> || fhpd <EXEFILE> || fhpd <COREFILE> [<EXEFILE>]"); parser.parse(args); diff --git a/frysk-core/frysk/dwfl/ChangeLog b/frysk-core/frysk/dwfl/ChangeLog index 21787a1..583f4f2 100644 --- a/frysk-core/frysk/dwfl/ChangeLog +++ b/frysk-core/frysk/dwfl/ChangeLog @@ -1,3 +1,8 @@ +2008-02-29 Stan Cox <scox@redhat.com> + + * DwflCache.java (setDefaultSysroot): New. + (getDwfl): Use it. + 2008-02-28 Andrew Cagney <cagney@redhat.com> * DwflCache.java: Use frysk.rsl. diff --git a/frysk-core/frysk/dwfl/DwflCache.java b/frysk-core/frysk/dwfl/DwflCache.java index c440cd0..5a57f98 100644 --- a/frysk-core/frysk/dwfl/DwflCache.java +++ b/frysk-core/frysk/dwfl/DwflCache.java @@ -137,8 +137,11 @@ public class DwflCache { if (!modMap.containsKey(task)) { fine.log("creating new dwfl for task", task); String sysroot = (String)sysrootMap.get(task.getProc().getCommand()); - if (sysroot == null) - sysroot = "/"; + if (sysroot == null) { + sysroot = (String)sysrootMap.get("default"); + if (sysroot == null) + sysroot = "/"; + } File sysrootFile = new File(sysroot); File relativeSysroot = getRelativeSysRoot(task.getProc().getExe(), sysrootFile); Dwfl dwfl = new Dwfl(relativeSysroot.getPath()); @@ -167,7 +170,7 @@ public class DwflCache { /** * set the sysroot corresponding to a {@link frysk.proc.Task}. * - * @param task is the task. + * @param task is the task. * @param sysroot is this task's sysroot. */ public static void setSysroot(Task task, String sysroot) { @@ -175,6 +178,15 @@ public class DwflCache { } /** + * set the default sysroot + * + * @param sysroot is the default special root directory + */ + public static void setDefaultSysroot(String sysroot) { + sysrootMap.put("default", sysroot); + } + + /** * return a sysroot File for a {@link frysk.proc.Task}. * * @param task is the task. diff --git a/frysk-core/frysk/hpd/AttachCommand.java b/frysk-core/frysk/hpd/AttachCommand.java index d48ee15..684ad8a 100644 --- a/frysk-core/frysk/hpd/AttachCommand.java +++ b/frysk-core/frysk/hpd/AttachCommand.java @@ -121,6 +121,10 @@ public class AttachCommand extends ParameterizedCommand { } } + public static void attach(Proc proc, CLI cli) { + attach(proc, cli, null); + } + public static void attach(Proc proc, CLI cli, String sysroot) { DwflCache.setSysroot(proc.getMainTask(), sysroot); cli.doAttach(proc, false); diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 5233344..2759746 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,9 @@ +2008-02-29 Stan Cox <scox@redhat.com> + + * LoadCommand.java (load): Add no sysroot variant. + * CoreCommand.java (load): Likewise. + * AttachCommand.java (attach): Likewise. + 2008-02-29 Rick Moseley <rmoseley@redhat.com> * TestKillCommand.java: Add test that points to bz 5615. diff --git a/frysk-core/frysk/hpd/CoreCommand.java b/frysk-core/frysk/hpd/CoreCommand.java index 4439dab..6d85bb7 100644 --- a/frysk-core/frysk/hpd/CoreCommand.java +++ b/frysk-core/frysk/hpd/CoreCommand.java @@ -119,6 +119,10 @@ public class CoreCommand extends ParameterizedCommand { load(coreProc, cli, options.sysroot); } + public static void load(Proc coreProc, CLI cli) { + load(coreProc, cli, null); + } + public static void load(Proc coreProc, CLI cli, String sysroot) { // All checks are done. Host is built. Now start reserving // space in the sets. diff --git a/frysk-core/frysk/hpd/LoadCommand.java b/frysk-core/frysk/hpd/LoadCommand.java index 2493f1d..c39ae2c 100644 --- a/frysk-core/frysk/hpd/LoadCommand.java +++ b/frysk-core/frysk/hpd/LoadCommand.java @@ -113,6 +113,10 @@ public class LoadCommand extends ParameterizedCommand { load(exeProc, cli, o.sysroot); } + public static void load(Proc exeProc, CLI cli) { + load(exeProc, cli, null); + } + public static void load(Proc exeProc, CLI cli, String sysroot) { int procID; if (cli.taskID < 0) diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog index ad11190..172839c 100644 --- a/frysk-core/frysk/util/ChangeLog +++ b/frysk-core/frysk/util/ChangeLog @@ -1,3 +1,8 @@ +2008-02-29 Stan Cox <scox@redhat.com> + + * CommandlineParser.java (CommandlineParser): Add new option sysroot. + (parseSysroot): Use it. + 2008-02-29 Petr Machata <pmachata@redhat.com> * Glob.java (compile(String, int)): New method. diff --git a/frysk-core/frysk/util/CommandlineParser.java b/frysk-core/frysk/util/CommandlineParser.java index 7d005ae..318d4fa 100644 --- a/frysk-core/frysk/util/CommandlineParser.java +++ b/frysk-core/frysk/util/CommandlineParser.java @@ -50,6 +50,7 @@ import gnu.classpath.tools.getopt.Parser; import frysk.Config; import frysk.rsl.LogOption; import frysk.rsl.Log; +import frysk.dwfl.DwflCache; import frysk.proc.dead.LinuxCoreFactory; import frysk.proc.dead.LinuxExeFactory; import frysk.proc.Proc; @@ -72,6 +73,11 @@ public class CommandlineParser { extendedCore = false; } }); + add(new Option("sysroot", "special root directory", "Path of special root directory") { + public void parsed(String arg) throws OptionException { + parseSysroot(arg); + } + }); } public CommandlineParser(String programName) { @@ -111,6 +117,15 @@ public class CommandlineParser { System.exit(1); } + /** + * Callback function. Sets the default sysroot + * + * @param sysrootPath The special root directory + */ + public void parseSysroot(String sysrootPath) { + DwflCache.setDefaultSysroot(sysrootPath); + } + public String[] parse(String[] args) { try { fine.log(this, "parse", args); hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-02-29 21:20 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=20080229212011.12112.qmail@sourceware.org \ --to=scox@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).