public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: rmoseley@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Fix bz 6696(problem with kill command).
Date: Thu, 26 Jun 2008 18:17:00 -0000	[thread overview]
Message-ID: <20080626181731.2672.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  6769775d04e116c60ba53d52d7e509ceb4cbbbdb (commit)
      from  4ee203efb3be5d328cfe419d1f9c24f17e7ea32e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 6769775d04e116c60ba53d52d7e509ceb4cbbbdb
Author: Rick Moseley <rmoseley@localhost.localdomain>
Date:   Thu Jun 26 13:16:38 2008 -0500

    Fix bz 6696(problem with kill command).
    
    * CLI.java: Fix bz 6696.
    * DetachCommand.java: Ditto.
    * KillCommand.java: Ditto.
    * TestKillCommand.java: Add test for fix.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/hpd/CLI.java             |    4 +++
 frysk-core/frysk/hpd/ChangeLog            |    8 +++++++
 frysk-core/frysk/hpd/DetachCommand.java   |    7 ++++-
 frysk-core/frysk/hpd/KillCommand.java     |   12 +++++-----
 frysk-core/frysk/hpd/TestKillCommand.java |   31 +++++++++++++++++++++++++++++
 5 files changed, 54 insertions(+), 8 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/CLI.java b/frysk-core/frysk/hpd/CLI.java
index dd1f97f..eb1533c 100644
--- a/frysk-core/frysk/hpd/CLI.java
+++ b/frysk-core/frysk/hpd/CLI.java
@@ -185,6 +185,10 @@ public class CLI {
         // Assign this proc to the passed in procID 
         else
             idManager.manageProc(proc, this.taskID);
+        // Add this process to the runningProcs table
+        synchronized (this) {
+		this.runningProcs.add(proc);
+	    }
     }
 
     /**
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 5678226..87a1322 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-26  Rick Moseley  <rmoseley@redhat.com>
+
+	* CLI.java: Fix bz 6696.
+	* DetachCommand.java: Ditto.
+	* KillCommand.java: Ditto.
+	* TestKillCommand.java: Add test for fix.
+
+
 2008-06-17  Teresa Thomas  <tthomas@redhat.com>
 
 	* TestWatchCommand.java (testWritePrevValue): New test.
diff --git a/frysk-core/frysk/hpd/DetachCommand.java b/frysk-core/frysk/hpd/DetachCommand.java
index b76a603..e98e5a3 100644
--- a/frysk-core/frysk/hpd/DetachCommand.java
+++ b/frysk-core/frysk/hpd/DetachCommand.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2005, 2006, 2007 Red Hat Inc.
+// Copyright 2005, 2006, 2007, 2008 Red Hat Inc.
 //
 // FRYSK is free software; you can redistribute it and/or modify it
 // under the terms of the GNU General Public License as published by
@@ -72,12 +72,15 @@ class DetachCommand extends ParameterizedCommand {
 	    synchronized (cli) {
 		startedByRun = cli.runningProcs.contains(proc);
 	    }
-	    if (startedByRun)
+	    if (!startedByRun)
 		continue;
 	    // Delete all breakpoints.
 	    if (cli.steppingObserver != null)
 		cli.getSteppingEngine().removeObserver(cli.steppingObserver,
 			proc, true);
+	    synchronized (cli) {
+		cli.runningProcs.remove(proc);
+	    }
 	}
     }
 
diff --git a/frysk-core/frysk/hpd/KillCommand.java b/frysk-core/frysk/hpd/KillCommand.java
index a05f1cf..cf7dabc 100644
--- a/frysk-core/frysk/hpd/KillCommand.java
+++ b/frysk-core/frysk/hpd/KillCommand.java
@@ -156,6 +156,9 @@ public class KillCommand extends ParameterizedCommand {
 		procPID = proc.getPid();
 		// Now, call the Proc object to kill off the executable(s)
 		proc.requestKill();
+		synchronized (cli) {
+		    cli.runningProcs.remove(proc);
+		}
 		if ((pid > 0))
 		    return true;
 	    }
@@ -202,17 +205,14 @@ public class KillCommand extends ParameterizedCommand {
 			+ " that was created from " + proc.getExeFile().getSysRootedPath(),
 			Message.TYPE_NORMAL);
 		    proc.requestKill();
+		    synchronized (cli) {
+			cli.runningProcs.remove(proc);
+		    }
 		    tempId = procId;
 		    returnProc = true;
 		}
 	    }
 	}
-	if (returnProc) {
-	    synchronized (cli) {
-		// Clear the running procs set
-		cli.runningProcs.clear();
-	    }
-	}
 	return returnProc;
     }
 
diff --git a/frysk-core/frysk/hpd/TestKillCommand.java b/frysk-core/frysk/hpd/TestKillCommand.java
index 4a5446c..e3711d9 100644
--- a/frysk-core/frysk/hpd/TestKillCommand.java
+++ b/frysk-core/frysk/hpd/TestKillCommand.java
@@ -196,6 +196,37 @@ java.lang.NullPointerException
     }
     
     /**
+     * Test killing of a single proc NOT using the PID
+     */
+    public void testKillAfterAttach() {
+	SlaveOffspring newProc = SlaveOffspring.createDaemon();
+	int pid = newProc.getPid().intValue();
+	e = new HpdTestbed();
+	e.sendCommandExpectPrompt("attach " + pid, "Attached to process " + pid + ".*");
+	e.sendCommandExpectPrompt("kill", "Killing process " + pid + ".*");
+	try { Thread.sleep(500); } catch (Exception e) { }
+	e.send("quit\n");
+	e.expect("Quitting\\.\\.\\..*");
+	e.close();
+    }
+    
+    /**
+     * Test killing of a single proc and then running
+     */
+    public void testKillAfterAttachThenRun() {
+	SlaveOffspring newProc = SlaveOffspring.createDaemon();
+	int pid = newProc.getPid().intValue();
+	e = new HpdTestbed();
+	e.sendCommandExpectPrompt("attach " + pid, "Attached to process " + pid + ".*");
+	e.sendCommandExpectPrompt("kill", "Killing process " + pid + ".*");
+	try { Thread.sleep(500); } catch (Exception e) { }
+	e.sendCommandExpectPrompt("run", "running with this command.*");
+	e.send("quit\n");
+	e.expect("Quitting\\.\\.\\..*");
+	e.close();
+    }
+    
+    /**
      * Test entering a non-integer as a PID
      */
     public void testKillError() {


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2008-06-26 18:17 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=20080626181731.2672.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).