Mercurial > hg > graal-compiler
annotate agent/src/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java @ 6203:04ade88d9712
6294277: java -Xdebug crashes on SourceDebugExtension attribute larger than 64K
Reviewed-by: sspitsyn, dholmes, coleenp, kamg
author | fparain |
---|---|
date | Mon, 09 Jul 2012 01:28:37 -0700 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.jdi; | |
26 | |
27 import com.sun.jdi.connect.*; | |
28 import com.sun.jdi.Bootstrap; | |
29 import com.sun.jdi.VirtualMachine; | |
30 import com.sun.jdi.VirtualMachineManager; | |
31 | |
32 import java.io.*; | |
33 import java.lang.reflect.*; | |
34 import java.net.*; | |
35 import java.util.*; | |
36 | |
37 public class SADebugServerAttachingConnector extends ConnectorImpl implements AttachingConnector { | |
38 | |
39 static final String ARG_DEBUG_SERVER_NAME = "debugServerName"; | |
40 private Transport transport; | |
41 | |
42 public SADebugServerAttachingConnector(com.sun.tools.jdi.VirtualMachineManagerService ignored) { | |
43 this(); | |
44 } | |
45 | |
46 public SADebugServerAttachingConnector() { | |
47 // fixme jjh create resources for the these strings, | |
48 addStringArgument( | |
49 ARG_DEBUG_SERVER_NAME, | |
50 "Debug Server", //getString("sa.debugServer.label"), | |
51 "Name of a remote SA Debug Server", //getString("sa.debugServer.description"); | |
52 "", | |
53 true); | |
54 transport = new Transport() { | |
55 public String name() { | |
56 return "RMI"; | |
57 } | |
58 }; | |
59 } | |
60 | |
61 private VirtualMachine createVirtualMachine(Class vmImplClass, | |
62 String debugServerName) | |
63 throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { | |
64 java.lang.reflect.Method connectByServerMethod = | |
65 vmImplClass.getMethod( | |
66 "createVirtualMachineForServer", | |
67 new Class[] { | |
68 VirtualMachineManager.class, | |
69 String.class, | |
70 Integer.TYPE | |
71 }); | |
72 return (VirtualMachine) connectByServerMethod.invoke(null, | |
73 new Object[] { | |
74 Bootstrap.virtualMachineManager(), | |
75 debugServerName, | |
76 new Integer(0) | |
77 }); | |
78 } | |
79 | |
80 public VirtualMachine attach(Map arguments) throws IOException, | |
81 IllegalConnectorArgumentsException { | |
82 String debugServerName = argument(ARG_DEBUG_SERVER_NAME, arguments).value(); | |
83 if (debugServerName == null || debugServerName.equals("")) { | |
84 throw new IllegalConnectorArgumentsException("debugServerName should be non-null and non-empty", | |
85 ARG_DEBUG_SERVER_NAME); | |
86 } | |
87 VirtualMachine myVM; | |
88 try { | |
89 try { | |
90 Class vmImplClass = loadVirtualMachineImplClass(); | |
91 myVM = createVirtualMachine(vmImplClass, debugServerName); | |
92 } catch (InvocationTargetException ite) { | |
93 Class vmImplClass = handleVMVersionMismatch(ite); | |
94 if (vmImplClass != null) { | |
95 return createVirtualMachine(vmImplClass, debugServerName); | |
96 } else { | |
97 throw ite; | |
98 } | |
99 } | |
100 } catch (Exception ee) { | |
101 if (DEBUG) { | |
102 System.out.println("VirtualMachineImpl() got an exception:"); | |
103 ee.printStackTrace(); | |
104 System.out.println("debug server name = " + debugServerName); | |
105 } | |
106 throw (IOException) new IOException().initCause(ee); | |
107 } | |
108 setVMDisposeObserver(myVM); | |
109 return myVM; | |
110 } | |
111 | |
112 public String name() { | |
113 return "sun.jvm.hotspot.jdi.SADebugServerAttachingConnector"; | |
114 } | |
115 | |
116 public String description() { | |
117 return getString("This connector allows you to attach to a Java Process via a debug server with the Serviceability Agent"); | |
118 } | |
119 | |
120 public Transport transport() { | |
121 return transport; | |
122 } | |
123 } |