111 if (address == null) {
112 throw new IOException("Not a debuggee, or not listening for debugger to attach");
113 }
114 int pos = address.indexOf(':');
115 if (pos < 1) {
116 throw new IOException("Unable to determine transport endpoint");
117 }
118
119 // parse into transport library name and address
120
121 final String lib = address.substring(0, pos);
122 address = address.substring(pos+1, address.length());
123
124 TransportService ts = null;
125 if (lib.equals("dt_socket")) {
126 ts = new SocketTransportService();
127 } else {
128 if (lib.equals("dt_shmem")) {
129 try {
130 Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
131 ts = (TransportService)c.newInstance();
132 } catch (Exception x) { }
133 }
134 }
135 if (ts == null) {
136 throw new IOException("Transport " + lib + " not recognized");
137 }
138
139 // connect to the debuggee
140
141 Connection connection = ts.attach(address, timeout, 0);
142 return Bootstrap.virtualMachineManager().createVirtualMachine(connection);
143 }
144
145 public String name() {
146 return "com.sun.jdi.ProcessAttach";
147 }
148
149 public String description() {
150 return getString("process_attaching.description");
151 }
|
111 if (address == null) {
112 throw new IOException("Not a debuggee, or not listening for debugger to attach");
113 }
114 int pos = address.indexOf(':');
115 if (pos < 1) {
116 throw new IOException("Unable to determine transport endpoint");
117 }
118
119 // parse into transport library name and address
120
121 final String lib = address.substring(0, pos);
122 address = address.substring(pos+1, address.length());
123
124 TransportService ts = null;
125 if (lib.equals("dt_socket")) {
126 ts = new SocketTransportService();
127 } else {
128 if (lib.equals("dt_shmem")) {
129 try {
130 Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
131 @SuppressWarnings("deprecation")
132 Object tmp = c.newInstance();
133 ts = (TransportService)tmp;
134 } catch (Exception x) { }
135 }
136 }
137 if (ts == null) {
138 throw new IOException("Transport " + lib + " not recognized");
139 }
140
141 // connect to the debuggee
142
143 Connection connection = ts.attach(address, timeout, 0);
144 return Bootstrap.virtualMachineManager().createVirtualMachine(connection);
145 }
146
147 public String name() {
148 return "com.sun.jdi.ProcessAttach";
149 }
150
151 public String description() {
152 return getString("process_attaching.description");
153 }
|