Initial Commit
[packages] / xemacs-packages / jde / java / src / jde / debugger / command / AttachSocket.java
1 /*
2  * Copyright (c) 2000, 2001, 2003    Paul Kinnucan
3  *
4  * $Revision: 1.5 $
5  */
6
7 package jde.debugger.command;
8
9 import jde.debugger.Debugger;
10 import jde.debugger.JDEException;
11 import jde.debugger.SessionManager;
12
13
14 /**
15  * Attaches to an already running application through a socket.
16  * <p>
17  *
18  * <b>Syntax:</b>
19  * <pre>
20  * attach_socket app_id -port p_value [-host h_value]
21  * </pre>
22  *
23  * <b>Comments:</b>
24  * <ul>
25  * <li> The debugee vm has to have been launched with the right parameters.
26  * See the <italic>Connection and Invocation</italic> section of the
27  * JPDA documentation.
28  * </ul>
29  *
30  * @author Paul Kinnucan
31  * @version $Revision: 1.5 $
32  */
33 public class AttachSocket extends DebugSessionCommand {
34
35   /**
36    *
37    * @exception jde.debugger.JDEException <description>
38    */
39   protected void doCommand() throws JDEException {
40     // XXX - fix the 'true' here, and define a better way to determine
41     // whether to use a GUI or not.
42     Debugger debugger = new Debugger(m_targetProcessID, true);
43         
44     SessionManager.registerDebugger(debugger);
45         
46     try {
47       debugger.attachVMSocket(m_args);
48       debugger.start();
49     }
50     catch (JDEException e) {
51       SessionManager.deregisterDebugger(debugger);
52       throw e;
53     }
54         
55     debugger.signalCommandResult(m_cmdID, null, CMD_OK);
56   }
57
58   public Object clone() {return new AttachSocket();}
59  
60   
61 } // AttachSocket
62
63
64 /*
65  * $Log: AttachSocket.java,v $
66  * Revision 1.5  2003/01/15 05:56:26  paulk
67  * Add Petter Mahlen's changes.
68  *
69  * Revision 1.4  2001/03/24 05:42:36  paulk
70  * Updated to reflect reorganization of debugger code.
71  *
72  * Revision 1.3  2000/08/09 03:43:07  paulk
73  * Fixed bug where JDEBug would not attach to a process running on a remote host because it was setting the wrong connector argument (host instead of hostname). Thanks to Matthew Conway <matt_conway@i2.com>.
74  *
75  * Revision 1.2  2000/02/02 05:58:12  paulk
76  * Added command succeeded messages.
77  *
78  * Revision 1.1  2000/01/31 12:45:08  paulk
79  * Attach existing application through socket.
80  *
81  */
82
83 // End of AttachSocket.java