public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: cagney@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Merge branch 'master' of ssh://sourceware.org/git/frysk
Date: Thu, 08 Nov 2007 20:57:00 -0000	[thread overview]
Message-ID: <20071108205738.12727.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  d9bd1560c585138ab990d7ad0b65b3d9e6ad8ce1 (commit)
       via  f2f0a6b50c1d6adf0b8cf623ff48d7622db42a27 (commit)
      from  92e9c47e02ab8b02ccd29dac7763d286d4652353 (commit)

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

- Log -----------------------------------------------------------------
commit d9bd1560c585138ab990d7ad0b65b3d9e6ad8ce1
Merge: f2f0a6b50c1d6adf0b8cf623ff48d7622db42a27 92e9c47e02ab8b02ccd29dac7763d286d4652353
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Nov 8 15:56:13 2007 -0500

    Merge branch 'master' of ssh://sourceware.org/git/frysk

commit f2f0a6b50c1d6adf0b8cf623ff48d7622db42a27
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Nov 8 15:55:58 2007 -0500

    AttachCommand extends ParameterizedCommand; simplify.
    
    frysk-core/frysk/hpd/ChangeLog
    2007-11-08  Andrew Cagney  <cagney@redhat.com>
    
    	* CLI.java (doAttach(Task)): Delete.
    	(doAttach(Proc)): Replace doAttach(int,Proc,Task).
    	* RunCommand.java: Update.
    	* AttachCommand.java: Update; extend ParameterizedCommand; delete
    	-task option.

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

Summary of changes:
 frysk-core/frysk/hpd/AttachCommand.java |  101 +++++++++++--------------------
 frysk-core/frysk/hpd/CLI.java           |   23 +++-----
 frysk-core/frysk/hpd/ChangeLog          |    6 ++
 frysk-core/frysk/hpd/RunCommand.java    |   14 ++---
 4 files changed, 55 insertions(+), 89 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/AttachCommand.java b/frysk-core/frysk/hpd/AttachCommand.java
index 6271354..b87ec91 100644
--- a/frysk-core/frysk/hpd/AttachCommand.java
+++ b/frysk-core/frysk/hpd/AttachCommand.java
@@ -39,15 +39,14 @@
 
 package frysk.hpd;
 
-import java.util.Iterator;
 import frysk.proc.Proc;
 import frysk.proc.ProcId;
-import frysk.proc.Task;
 import frysk.proc.Manager;
 import frysk.proc.FindProc;
+import java.util.List;
+
+class AttachCommand extends ParameterizedCommand {
 
-class AttachCommand
-    extends Command {
     private class ProcFinder implements FindProc {
 	Proc proc = null;
 
@@ -66,75 +65,47 @@ class AttachCommand
 	}
     }
 
-    private static final String full = "The attach command causes the debugger "
-	    + "to attach to an existing\n"
-	    + "process(es), making it possible to continue the process' "
-	    + "execution under\n"
-	    + "debugger control. The command applies at the process level; all "
-	    + "threads\n"
-	    + "corresponding to the process will be attached by the operation. "
-	    + "It is\n"
-	    + "the user's responsibility to ensure that the process(es) "
-	    + "actually is\n" + "executing the specified executable.";
-
     AttachCommand() {
 	super("attach", "Attach to a running process.",
-	      "attach [executable] pid [-task tid]", full);
+	      "attach <pid> ...",
+	      ("The attach command causes the debugger to attach to an"
+	       + " existing process(es), making it possible to continue"
+	       + " the process' execution under debugger control.  The"
+	       + " command applies at the process level; all threads"
+	       + " corresponding to the process will be attached by the"
+	       + " operation.  It is the user's responsibility to ensure"
+	       + " that the process(es) actually is executing the specified"
+	       + " executable."));
     }
 
-    public void interpret(CLI cli, Input cmd) {
-	int pid = 0;
-	int tid = 0;
-	if (cmd.size() == 1 && cmd.parameter(0).equals("-help")) {
-	    cli.printUsage(cmd);
-	    return;
-	}
-
-	if (cmd.size() < 1) {
-	    cli.printUsage(cmd);
-	    return;
-	}
-
-	for (int idx = 0; idx < cmd.size(); idx++) {
-	    if (cmd.parameter(idx).equals("-task")) {
-		idx += 1;
-		tid = Integer.parseInt(cmd.parameter(idx));
-	    } else if (cmd.parameter(idx).indexOf('-') == 0) {
-		cli.printUsage(cmd);
-		return;
-	    } else if (cmd.parameter(idx).matches("[0-9]+"))
-		pid = Integer.parseInt(cmd.parameter(idx));
+    public void interpret(CLI cli, Input cmd, Object options) {
+	if (cmd.size() == 0) {
+	    throw new InvalidCommandException("Missing process ID");
 	}
-
-	ProcFinder findProc = new ProcFinder();
-	Manager.host.requestFindProc(new ProcId(pid), findProc);
-	synchronized (findProc) {
-	    while (!findProc.procSearchFinished) {
-		try {
-		    findProc.wait();
-		} catch (InterruptedException ie) {
-		    findProc.proc = null;
+	for (int i = 0; i < cmd.size(); i++) {
+	    int pid = Integer.parseInt(cmd.parameter(i));
+	    ProcFinder findProc = new ProcFinder();
+	    Manager.host.requestFindProc(new ProcId(pid), findProc);
+	    synchronized (findProc) {
+		while (!findProc.procSearchFinished) {
+		    try {
+			findProc.wait();
+		    } catch (InterruptedException ie) {
+			findProc.proc = null;
+		    }
 		}
 	    }
-	}
-	if (findProc.proc == null) {
-	    cli.addMessage("Couldn't find process " + pid, Message.TYPE_ERROR);
-	    return;
-	}
-	int procID = cli.idManager.reserveProcID();
-	Task task = null;
-	if (pid == tid || tid == 0)
-	    task = findProc.proc.getMainTask();
-	else
-	    for (Iterator i = findProc.proc.getTasks().iterator(); i.hasNext();) {
-		task = (Task) i.next();
-		if (task.getTid() == tid)
-		    break;
+	    if (findProc.proc == null) {
+		cli.outWriter.print("Couldn't find process ");
+		cli.outWriter.println(pid);
+		continue;
 	    }
-	cli.doAttach(pid, findProc.proc, task);
-        cli.getSteppingEngine().getBreakpointManager()
-            .manageProcess(findProc.proc);
-	cli.idManager.manageProc(findProc.proc, procID);
+	    cli.doAttach(findProc.proc);
+	}
+    }
 
+    int complete(CLI cli, PTSet ptset, String input, int base,
+		 List completions) {
+	return -1;
     }
 }
diff --git a/frysk-core/frysk/hpd/CLI.java b/frysk-core/frysk/hpd/CLI.java
index 70871e3..e077073 100644
--- a/frysk-core/frysk/hpd/CLI.java
+++ b/frysk-core/frysk/hpd/CLI.java
@@ -132,37 +132,30 @@ public class CLI {
     /*
      * Command handlers
      */
-
-    public void doAttach(int pid, Proc proc, Task task) {
-        Proc[] temp = new Proc[1];
-        temp[0] = proc;
+    public void doAttach(Proc proc) {
         synchronized (this) {
             attached = -1;
             attachedLatch = new CountDownLatch(1);
         }
         steppingEngine.addProc(proc);
-                // Wait till we are attached.
+	// Wait till we are attached.
         try {
             attachedLatch.await();
-            addMessage("Attached to process " + attached, Message.TYPE_NORMAL);
-        }
-        catch (InterruptedException ie) {
+	    outWriter.print("Attached to process ");
+	    outWriter.println(attached);
+        } catch (InterruptedException ie) {
             addMessage("Attach interrupted.", Message.TYPE_ERROR);
             return;
-        }
-        finally {
+        } finally {
             synchronized (this) {
                 attached = -1;
                 attachedLatch = null;
             }
         }
+        steppingEngine.getBreakpointManager().manageProcess(proc);
+        idManager.manageProc(proc, idManager.reserveProcID());
     }
 
-    public void doAttach(Task task) {
-        Proc proc = task.getProc();
-        doAttach(proc.getPid(), proc, task);
-    }
-    
     //private static PrintStream out = null;// = System.out;
     final PrintWriter outWriter;
     private Preprocessor prepro;
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 347cd06..9c2e773 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,5 +1,11 @@
 2007-11-08  Andrew Cagney  <cagney@redhat.com>
 
+	* CLI.java (doAttach(Task)): Delete.
+	(doAttach(Proc)): Replace doAttach(int,Proc,Task).
+	* RunCommand.java: Update.
+	* AttachCommand.java: Update; extend ParameterizedCommand; delete
+	-task option.
+	
 	* TestAliasCommands.java: New file.
 
 	* AliasCommands.java: New.
diff --git a/frysk-core/frysk/hpd/RunCommand.java b/frysk-core/frysk/hpd/RunCommand.java
index f5e0c6c..d70035a 100644
--- a/frysk-core/frysk/hpd/RunCommand.java
+++ b/frysk-core/frysk/hpd/RunCommand.java
@@ -116,8 +116,8 @@ class RunCommand extends Command {
 
     public void interpret(CLI cli, Input cmd) {
 	if (cmd.size() < 1) {
-	    cli.printUsage(cmd);
-	    return;
+	    // XXX: should default to previous values.
+	    throw new InvalidCommandException("missing program");
 	}
 	Runner runner = new Runner(cli);
 	Manager.host.requestCreateAttachedProc(cmd.stringArrayValue(), runner);
@@ -126,12 +126,8 @@ class RunCommand extends Command {
         } catch (InterruptedException e) {
             return;
         }
-        // register with SteppingEngine
-	cli.doAttach(runner.launchedTask);
-        cli.getSteppingEngine().getBreakpointManager()
-            .manageProcess(runner.launchedTask.getProc());
-        cli.idManager.manageProc(runner.launchedTask.getProc(),
-				 cli.idManager.reserveProcID());
-        runner.launchedTask.requestUnblock(runner);
+        // register with SteppingEngine et.al.
+	cli.doAttach(runner.launchedTask.getProc());
+	runner.launchedTask.requestUnblock(runner);
     }
 }


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


             reply	other threads:[~2007-11-08 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08 20:57 cagney [this message]
2007-11-20 17:23 cagney
2007-11-27  2:15 pzhao
2008-04-19  0:32 scox
2008-05-07 15:23 tthomas
2008-05-29 15:51 tthomas

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=20071108205738.12727.qmail@sourceware.org \
    --to=cagney@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).