public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: rmoseley@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM] master: Add ability to "run" core commands that have executables specified.
Date: Thu, 29 Nov 2007 01:32:00 -0000 [thread overview]
Message-ID: <20071129013234.25683.qmail@sourceware.org> (raw)
The branch, master has been updated
via 2db907516bfc9f5f893e64b795ec2ffed349d6f8 (commit)
from ee243016c11937ddbfb0ba23e0f6f4376708998a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 2db907516bfc9f5f893e64b795ec2ffed349d6f8
Author: Rick Moseley <rmoseley@localhost.localdomain>
Date: Wed Nov 28 19:29:06 2007 -0600
Add ability to "run" core commands that have executables specified.
* RunCommand.java: Added code to implement the ability to run
core files loaded with the core command with a path-to-
executable parameter.
* CLI.java: Ditto.
* CoreCommand.java: Ditto.
* TestCoreCommand.java: Test above changes.
* LoadCommand.java: Move output of "Loaded*" message until
after debuginfo has been retrieved.
-----------------------------------------------------------------------
Summary of changes:
frysk-core/frysk/hpd/CLI.java | 11 ++++++
frysk-core/frysk/hpd/ChangeLog | 11 ++++++
frysk-core/frysk/hpd/CoreCommand.java | 10 +++++-
frysk-core/frysk/hpd/LoadCommand.java | 8 ++---
frysk-core/frysk/hpd/RunCommand.java | 57 +++++++++++++++++++----------
frysk-core/frysk/hpd/TestCoreCommand.java | 31 ++++++++++++++++
6 files changed, 102 insertions(+), 26 deletions(-)
First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/CLI.java b/frysk-core/frysk/hpd/CLI.java
index 032caa3..1e072b1 100644
--- a/frysk-core/frysk/hpd/CLI.java
+++ b/frysk-core/frysk/hpd/CLI.java
@@ -74,6 +74,8 @@ public class CLI {
final HashSet runningProcs = new HashSet();
//Processes loaded with load command
final HashMap loadedProcs = new HashMap();
+ //Processes loaded with core command
+ final HashMap coreProcs = new HashMap();
//Task ID to use
int taskID = -1;
@@ -455,6 +457,15 @@ public class CLI {
return loadedProcs;
}
+ /**
+ * Get the set of processes (Proc) started by the core command. Access to the
+ * CLI object should be synchronized when using the set.
+ * @return the set
+ */
+ public HashMap getCoreProcs() {
+ return coreProcs;
+ }
+
SteppingEngine getSteppingEngine () {
return this.steppingEngine;
}
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 5043737..1970598 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,14 @@
+2007-11-29 Rick Moseley <rmoseley@redhat.com>
+
+ * RunCommand.java: Added code to implement the ability to run
+ core files loaded with the core command with a path-to-
+ executable parameter.
+ * CLI.java: Ditto.
+ * CoreCommand.java: Ditto.
+ * TestCoreCommand.java: Test above changes.
+ * LoadCommand.java: Move output of "Loaded*" message until
+ after debuginfo has been retrieved.
+
2007-11-28 Andrew Cagney <cagney@redhat.com>
* RegsCommand.java: Update; Registers .getDefaultRegisterGroup
diff --git a/frysk-core/frysk/hpd/CoreCommand.java b/frysk-core/frysk/hpd/CoreCommand.java
index 31d75b6..7ebd163 100644
--- a/frysk-core/frysk/hpd/CoreCommand.java
+++ b/frysk-core/frysk/hpd/CoreCommand.java
@@ -92,7 +92,8 @@ public class CoreCommand extends ParameterizedCommand {
parseCommandLine(cmd);
// Does the corefile exist?
- if ((!coreFile.exists()) || (!coreFile.canRead()))
+ if ((!coreFile.exists()) || (!coreFile.canRead()
+ || coreFile.isDirectory()))
throw new InvalidCommandException(
"No core file found, or cannot read corefile");
@@ -117,6 +118,7 @@ public class CoreCommand extends ParameterizedCommand {
// 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();
@@ -131,6 +133,12 @@ public class CoreCommand extends ParameterizedCommand {
// Finally, done.
cli.addMessage("Attached to core file: " + cmd.parameter(0),
Message.TYPE_NORMAL);
+ // See if there was an executable specified
+ if (coreHost.getStatus().hasExe == false)
+ return;
+ synchronized (cli) {
+ cli.getCoreProcs().put(coreProc, new Integer(procID));
+ }
}
diff --git a/frysk-core/frysk/hpd/LoadCommand.java b/frysk-core/frysk/hpd/LoadCommand.java
index 8ec7fd8..312c084 100644
--- a/frysk-core/frysk/hpd/LoadCommand.java
+++ b/frysk-core/frysk/hpd/LoadCommand.java
@@ -80,12 +80,8 @@ public class LoadCommand extends ParameterizedCommand {
Proc exeProc = frysk.util.Util.getProcFromExeFile(exeHost);
int procID = cli.idManager.reserveProcID();
-
cli.idManager.manageProc(exeProc, procID);
- cli.addMessage("Loaded executable file: " + cmd.parameter(0),
- Message.TYPE_NORMAL);
-
Iterator foo = cli.targetset.getTasks();
while (foo.hasNext()) {
Task task = (Task) foo.next();
@@ -100,9 +96,11 @@ public class LoadCommand extends ParameterizedCommand {
synchronized (cli) {
cli.getLoadedProcs().put(exeProc, new Integer(procID));
}
+
+ cli.addMessage("Loaded executable file: " + cmd.parameter(0),
+ Message.TYPE_NORMAL);
}
-
int completer(CLI cli, Input input, int cursor, List completions) {
return CompletionFactory.completeFileName(cli, input, cursor,
completions);
diff --git a/frysk-core/frysk/hpd/RunCommand.java b/frysk-core/frysk/hpd/RunCommand.java
index edc4501..5ae9fd3 100644
--- a/frysk-core/frysk/hpd/RunCommand.java
+++ b/frysk-core/frysk/hpd/RunCommand.java
@@ -127,9 +127,9 @@ class RunCommand extends ParameterizedCommand {
public void interpret(CLI cli, Input cmd, Object options) {
/* If the run command is given no args, check to see if
any procs were loaded with the load command or loaded
- when fhpd was started */
+ when fhpd was started or loaded with the core command*/
if (cmd.size() < 1) {
- if (cli.runningProcs.isEmpty() && cli.loadedProcs.isEmpty())
+ if (cli.coreProcs.isEmpty() && cli.loadedProcs.isEmpty())
throw new InvalidCommandException("missing program");
}
@@ -140,32 +140,27 @@ class RunCommand extends ParameterizedCommand {
}
/* If we made it here, a run command was given with no parameters
- * and there should be either running procs or loaded procs
+ * and there should be either running procs or loaded procs or
+ * core procs
*/
-
+
/* This is the case where there are loaded procs */
if (!cli.loadedProcs.isEmpty()) {
Set procSet = cli.loadedProcs.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();
- synchronized(cli) {
- cli.taskID = taskid.intValue();
- }
- cli.execCommand("run " + proc.getExe());
- synchronized(cli) {
- cli.taskID = -1;
- }
- }
+ runProcs(cli, procSet);
synchronized (cli) {
cli.loadedProcs.clear();
}
}
- // Found no loaded procs, print usage message
- // XXX Need to fix, add core files and running proc handling
- else throw new InvalidCommandException("missing program");
+
+ /* Check to see if there were procs loaded from a core command */
+ if (!cli.coreProcs.isEmpty()) {
+ Set coreSet = cli.coreProcs.entrySet();
+ runProcs(cli, coreSet);
+ synchronized (cli) {
+ cli.coreProcs.clear();
+ }
+ }
}
private void run(CLI cli, Input cmd) {
@@ -183,6 +178,28 @@ class RunCommand extends ParameterizedCommand {
runner.launchedTask.requestUnblock(runner);
}
+ /*
+ * runProcs does as the name implies, it runs procs found to be loaded by a
+ * load or a core command.
+ */
+ private void runProcs(CLI cli, Set procs) {
+ Iterator foo = procs.iterator();
+ while (foo.hasNext()) {
+ Map.Entry me = (Map.Entry) foo.next();
+ Proc proc = (Proc) me.getKey();
+ Integer taskid = (Integer) me.getValue();
+ // Set the TaskID to be used to what was used when the
+ // proc was loaded with the core or load commands
+ synchronized (cli) {
+ cli.taskID = taskid.intValue();
+ }
+ cli.execCommand("run " + proc.getExe());
+ synchronized (cli) {
+ cli.taskID = -1;
+ }
+ }
+ }
+
int completer(CLI cli, Input input, int cursor, List completions) {
return CompletionFactory.completeFileName(cli, input, cursor,
completions);
diff --git a/frysk-core/frysk/hpd/TestCoreCommand.java b/frysk-core/frysk/hpd/TestCoreCommand.java
index 505513e..834ce6c 100644
--- a/frysk-core/frysk/hpd/TestCoreCommand.java
+++ b/frysk-core/frysk/hpd/TestCoreCommand.java
@@ -55,6 +55,22 @@ public class TestCoreCommand extends TestLib {
e.expect(5, "Attached to core file.*");
e.close();
}
+
+ public void testCoreCommandError() {
+ e = new HpdTestbed();
+ e.send("core " + Config.getPkgDataFile("test-core-x86").getPath()
+ + "\n");
+ e.expect(5, "Error:*");
+ e.close();
+ }
+
+ public void testCoreCommandErrorTwo() {
+ e = new HpdTestbed();
+ e.send("core " + Config.getPkgDataFile("test-core-x86").getPath()
+ + "foo\n");
+ e.expect(5, "Error:*");
+ e.close();
+ }
public void testCoreExeCommand() {
TestLinuxCore tester = new TestLinuxCore();
@@ -68,4 +84,19 @@ public class TestCoreCommand extends TestLib {
e.close();
core.delete();
}
+
+ public void testCoreThenRunCommand() {
+ TestLinuxCore tester = new TestLinuxCore();
+ SlaveOffspring funit = SlaveOffspring.createDaemon();
+ Proc funitProc = funit.assertFindProcAndTasks();
+ File core = new File(tester.constructCore(funitProc));
+ e = new HpdTestbed();
+ e.send("core " + core.getPath() + " "
+ + SlaveOffspring.getExecutable().getPath() + "\n");
+ e.expect(5, "Attached to core file.*");
+ e.send("run\n");
+ e.expect(5, "Attached to process*");
+ e.close();
+ core.delete();
+ }
}
hooks/post-receive
--
frysk system monitor/debugger
reply other threads:[~2007-11-29 1:32 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=20071129013234.25683.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: link
Be 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).