The branch, master has been updated via 1916e00aa7394b36d0231ec093d7badaf736141d (commit) from d443263a441416ab56f7c0f070abbea6b6f037ce (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 1916e00aa7394b36d0231ec093d7badaf736141d Author: Rick Moseley <rmoseley@dhcp-215.hsv.redhat.com> Date: Tue Jun 10 10:34:42 2008 -0500 * StartRun.java: Do not kill core procs. * CoreCommand.java: Redo hash keys for core proc HashMap. * TestCoreCommand.java: Add test cases. * ../testbed/CorefileFactory.java: Add method to pass args to. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 6 ++++++ frysk-core/frysk/hpd/CoreCommand.java | 4 ++-- frysk-core/frysk/hpd/StartRun.java | 14 ++++++++------ frysk-core/frysk/hpd/TestCoreCommand.java | 19 +++++++++++++++++++ frysk-core/frysk/testbed/ChangeLog | 4 ++++ frysk-core/frysk/testbed/CorefileFactory.java | 15 +++++++++++++++ 6 files changed, 54 insertions(+), 8 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 61bfb02..8b619f7 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,9 @@ +2008-06-10 Rick Moseley <rmoseley@redhat.com> + + * StartRun.java: Do not kill core procs. + * CoreCommand.java: Redo hash keys for core proc HashMap. + * TestCoreCommand.java: Add test cases. + 2008-06-06 Sami Wagiaalla <swagiaal@redhat.com> * TestFhpdThreads.java diff --git a/frysk-core/frysk/hpd/CoreCommand.java b/frysk-core/frysk/hpd/CoreCommand.java index ced6d22..eda33ff 100644 --- a/frysk-core/frysk/hpd/CoreCommand.java +++ b/frysk-core/frysk/hpd/CoreCommand.java @@ -119,7 +119,7 @@ public class CoreCommand extends ParameterizedCommand { } public static void load(Proc coreProc, CLI cli) { - load(coreProc, cli, null); + load(coreProc, cli, null); } public static void load(Proc coreProc, CLI cli, String sysroot) { @@ -139,7 +139,7 @@ public class CoreCommand extends ParameterizedCommand { } // Finally, done. synchronized (cli) { - cli.coreProcs.put(coreProc, new Integer(procID)); + cli.coreProcs.put(new Integer(procID), coreProc); cli.ptsetParams.put(new Integer(procID), coreProc.getCmdLine()); } cli.outWriter.println("Attached to core file: " diff --git a/frysk-core/frysk/hpd/StartRun.java b/frysk-core/frysk/hpd/StartRun.java index 56bdc50..8a25ad1 100644 --- a/frysk-core/frysk/hpd/StartRun.java +++ b/frysk-core/frysk/hpd/StartRun.java @@ -168,11 +168,9 @@ abstract class StartRun extends ParameterizedCommand { cli.loadedProcs.remove(task.getProc()); } } - // Take care of core procs - // XXX: need to take care of parameters here that were passed into the - // process that created the core file + // Take care of core procs else if (!cli.coreProcs.isEmpty() && - cli.coreProcs.containsKey(task.getProc())) { + cli.coreProcs.containsKey(new Integer(taskData.getParentID()))) { run(cli, cmd, task.getProc().getExeFile().getSysRootedPath(), runToBreak, taskData.getParentID()); synchronized (cli) { @@ -265,8 +263,12 @@ abstract class StartRun extends ParameterizedCommand { while (foo.hasNext()) { taskData = (TaskData) foo.next(); Task task = taskData.getTask(); - if (task.getProc().getPid() != oldPid && - task.getProc().getPid() > 0) { + // Kill a proc only once + if (task.getProc().getPid() != oldPid && + // Don't kill loaded procs, don't have a PID assigned yet + task.getProc().getPid() > 0 && + // Don't kill core procs either, they have the old PID number + cli.coreProcs.get(new Integer(taskData.getParentID())) == null) { cli.execCommand("kill " + task.getProc().getPid() + "\n"); oldPid = task.getProc().getPid(); } diff --git a/frysk-core/frysk/hpd/TestCoreCommand.java b/frysk-core/frysk/hpd/TestCoreCommand.java index 787edf8..0722d8b 100644 --- a/frysk-core/frysk/hpd/TestCoreCommand.java +++ b/frysk-core/frysk/hpd/TestCoreCommand.java @@ -42,7 +42,9 @@ package frysk.hpd; import java.io.File; import frysk.testbed.CorefileFactory; import frysk.testbed.SlaveOffspring; +//import frysk.testbed.DaemonBlockedAtSignal; import frysk.config.Prefix; +//import frysk.proc.Proc; public class TestCoreCommand extends TestLib { @@ -106,4 +108,21 @@ public class TestCoreCommand extends TestLib { e.expect("Quitting\\.\\.\\."); e.close(); } + + public void testCoreLoadedParamsTwo() { + + if (unresolved(6614)) + return; +// File exe = new File("/bin/echo"); + File exe = Prefix.pkgLibFile("funit-hello"); + File core = CorefileFactory.constructCoreAtSignal(exe, new String[] {"abcd"}); + e = new HpdTestbed(); + e.sendCommandExpectPrompt("core " + core.getPath(), "Attached to core.*"); + e.sendCommandExpectPrompt("info args", "output"); + e.sendCommandExpectPrompt("run", "running.*abcd.*" + + "Attached to process ([0-9]+).*" + "Running process ([0-9]+).*"); + e.send("quit\n"); + e.expect("Quitting\\.\\.\\."); + e.close(); + } } diff --git a/frysk-core/frysk/testbed/ChangeLog b/frysk-core/frysk/testbed/ChangeLog index 1babdc8..4952a98 100644 --- a/frysk-core/frysk/testbed/ChangeLog +++ b/frysk-core/frysk/testbed/ChangeLog @@ -1,3 +1,7 @@ +2008-06-10 Rick Moseley <rmoseley@redhat.com> + + * CorefileFactory.java: Add method to pass args. + 2008-06-06 Rick Moseley <rmoseley@redhat.com> * SlaveOffspring.java: Add methods to accept commandline args. diff --git a/frysk-core/frysk/testbed/CorefileFactory.java b/frysk-core/frysk/testbed/CorefileFactory.java index 18d9354..ad305ed 100644 --- a/frysk-core/frysk/testbed/CorefileFactory.java +++ b/frysk-core/frysk/testbed/CorefileFactory.java @@ -74,6 +74,21 @@ public class CorefileFactory extends TestLib { = new DaemonBlockedAtSignal(exeFile).getMainTask().getProc(); return constructCore(ackProc); } + + /** + * Given a path to an executable it will run it until it sigfaults + * then extracts a corefile at that point, and return a File + * representing that core file. + */ + public static File constructCoreAtSignal(File exeFile, String[] args) { + String[] newargs = new String[args.length + 1]; + newargs[0] = exeFile.getAbsolutePath(); + for (int i = 0; i < args.length; i++) + newargs[i+1] = args[i]; + final Proc ackProc + = new DaemonBlockedAtSignal(newargs).getMainTask().getProc(); + return constructCore(ackProc); + } /** * Given a path to an executable it will run it until it sigfaults hooks/post-receive -- frysk system monitor/debugger