History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/com/sun/tools/example/debug/tty (28 of 18352 files). Show all

Unified · Split

28 files
  1. java/pkg/com/sun/tools/example/debug/tty/AccessWatchpointSpec.java +58 −0
  2. java/pkg/com/sun/tools/example/debug/tty/AmbiguousMethodException.java +41 −0
  3. java/pkg/com/sun/tools/example/debug/tty/BreakpointSpec.java +382 −0
  4. java/pkg/com/sun/tools/example/debug/tty/Commands.java +2098 −0
  5. java/pkg/com/sun/tools/example/debug/tty/Env.java +322 −0
  6. java/pkg/com/sun/tools/example/debug/tty/EventHandler.java +277 −0
  7. java/pkg/com/sun/tools/example/debug/tty/EventNotifier.java +50 −0
  8. java/pkg/com/sun/tools/example/debug/tty/EventRequestSpec.java +210 −0
  9. java/pkg/com/sun/tools/example/debug/tty/EventRequestSpecList.java +166 −0
  10. java/pkg/com/sun/tools/example/debug/tty/ExceptionSpec.java +107 −0
  11. java/pkg/com/sun/tools/example/debug/tty/LineNotFoundException.java +41 −0
  12. java/pkg/com/sun/tools/example/debug/tty/MalformedMemberNameException.java +38 −0
  13. java/pkg/com/sun/tools/example/debug/tty/MessageOutput.java +196 −0
  14. java/pkg/com/sun/tools/example/debug/tty/ModificationWatchpointSpec.java +58 −0
  15. java/pkg/com/sun/tools/example/debug/tty/PatternReferenceTypeSpec.java +136 −0
  16. java/pkg/com/sun/tools/example/debug/tty/ReferenceTypeSpec.java +43 −0
  17. java/pkg/com/sun/tools/example/debug/tty/SourceMapper.java +138 −0
  18. java/pkg/com/sun/tools/example/debug/tty/TTY.java +1063 −0
  19. java/pkg/com/sun/tools/example/debug/tty/TTYResources.java +456 −0
  20. java/pkg/com/sun/tools/example/debug/tty/TTYResources_ja.java +327 −0
  21. java/pkg/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java +327 −0
  22. java/pkg/com/sun/tools/example/debug/tty/ThreadGroupIterator.java +104 −0
  23. java/pkg/com/sun/tools/example/debug/tty/ThreadInfo.java +287 −0
  24. java/pkg/com/sun/tools/example/debug/tty/ThreadIterator.java +73 −0
  25. java/pkg/com/sun/tools/example/debug/tty/VMConnection.java +376 −0
  26. java/pkg/com/sun/tools/example/debug/tty/VMNotConnectedException.java +39 −0
  27. java/pkg/com/sun/tools/example/debug/tty/WatchpointSpec.java +68 −0
  28. java/pkg/com/sun/tools/example/debug/tty/mkfile +34 −0
java/pkg/com/sun/tools/example/debug/tty/AccessWatchpointSpec.java+58−0
@@ -0,0 +1,58 @@
1+/*
2+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.request.*;
30+
31+class AccessWatchpointSpec extends WatchpointSpec {
32+
33+ AccessWatchpointSpec(ReferenceTypeSpec refSpec, String fieldId)
34+ throws MalformedMemberNameException {
35+ super(refSpec, fieldId);
36+ }
37+
38+ /**
39+ * The 'refType' is known to match, return the EventRequest.
40+ */
41+ @Override
42+ EventRequest resolveEventRequest(ReferenceType refType)
43+ throws NoSuchFieldException {
44+ Field field = refType.fieldByName(fieldId);
45+ EventRequestManager em = refType.virtualMachine().eventRequestManager();
46+ EventRequest wp = em.createAccessWatchpointRequest(field);
47+ wp.setSuspendPolicy(suspendPolicy);
48+ wp.enable();
49+ return wp;
50+ }
51+
52+ @Override
53+ public String toString() {
54+ return MessageOutput.format("watch accesses of",
55+ new Object [] {refSpec.toString(),
56+ fieldId});
57+ }
58+}
java/pkg/com/sun/tools/example/debug/tty/AmbiguousMethodException.java+41−0
@@ -0,0 +1,41 @@
1+/*
2+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+public class AmbiguousMethodException extends Exception
29+{
30+ private static final long serialVersionUID = -5372629264936918654L;
31+
32+ public AmbiguousMethodException()
33+ {
34+ super();
35+ }
36+
37+ public AmbiguousMethodException(String s)
38+ {
39+ super(s);
40+ }
41+}
java/pkg/com/sun/tools/example/debug/tty/BreakpointSpec.java+382−0
@@ -0,0 +1,382 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.request.*;
30+
31+import java.util.ArrayList;
32+import java.util.List;
33+
34+class BreakpointSpec extends EventRequestSpec {
35+ String methodId;
36+ List<String> methodArgs;
37+ int lineNumber;
38+
39+ BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber) {
40+ super(refSpec);
41+ this.methodId = null;
42+ this.methodArgs = null;
43+ this.lineNumber = lineNumber;
44+ }
45+
46+ BreakpointSpec(ReferenceTypeSpec refSpec, String methodId,
47+ List<String> methodArgs) throws MalformedMemberNameException {
48+ super(refSpec);
49+ this.methodId = methodId;
50+ this.methodArgs = methodArgs;
51+ this.lineNumber = 0;
52+ if (!isValidMethodName(methodId)) {
53+ throw new MalformedMemberNameException(methodId);
54+ }
55+ }
56+
57+ /**
58+ * The 'refType' is known to match, return the EventRequest.
59+ */
60+ @Override
61+ EventRequest resolveEventRequest(ReferenceType refType)
62+ throws AmbiguousMethodException,
63+ AbsentInformationException,
64+ InvalidTypeException,
65+ NoSuchMethodException,
66+ LineNotFoundException {
67+ Location location = location(refType);
68+ if (location == null) {
69+ throw new InvalidTypeException();
70+ }
71+ EventRequestManager em = refType.virtualMachine().eventRequestManager();
72+ EventRequest bp = em.createBreakpointRequest(location);
73+ bp.setSuspendPolicy(suspendPolicy);
74+ bp.enable();
75+ return bp;
76+ }
77+
78+ String methodName() {
79+ return methodId;
80+ }
81+
82+ int lineNumber() {
83+ return lineNumber;
84+ }
85+
86+ List<String> methodArgs() {
87+ return methodArgs;
88+ }
89+
90+ boolean isMethodBreakpoint() {
91+ return (methodId != null);
92+ }
93+
94+ @Override
95+ public int hashCode() {
96+ return refSpec.hashCode() + lineNumber +
97+ ((methodId != null) ? methodId.hashCode() : 0) +
98+ ((methodArgs != null) ? methodArgs.hashCode() : 0);
99+ }
100+
101+ @Override
102+ public boolean equals(Object obj) {
103+ if (obj instanceof BreakpointSpec) {
104+ BreakpointSpec breakpoint = (BreakpointSpec)obj;
105+
106+ return ((methodId != null) ?
107+ methodId.equals(breakpoint.methodId)
108+ : methodId == breakpoint.methodId) &&
109+ ((methodArgs != null) ?
110+ methodArgs.equals(breakpoint.methodArgs)
111+ : methodArgs == breakpoint.methodArgs) &&
112+ refSpec.equals(breakpoint.refSpec) &&
113+ (lineNumber == breakpoint.lineNumber);
114+ } else {
115+ return false;
116+ }
117+ }
118+
119+ @Override
120+ String errorMessageFor(Exception e) {
121+ if (e instanceof AmbiguousMethodException) {
122+ return (MessageOutput.format("Method is overloaded; specify arguments",
123+ methodName()));
124+ /*
125+ * TO DO: list the methods here
126+ */
127+ } else if (e instanceof NoSuchMethodException) {
128+ return (MessageOutput.format("No method in",
129+ new Object [] {methodName(),
130+ refSpec.toString()}));
131+ } else if (e instanceof AbsentInformationException) {
132+ return (MessageOutput.format("No linenumber information for",
133+ refSpec.toString()));
134+ } else if (e instanceof LineNotFoundException) {
135+ return (MessageOutput.format("No code at line",
136+ new Object [] {new Long (lineNumber()),
137+ refSpec.toString()}));
138+ } else if (e instanceof InvalidTypeException) {
139+ return (MessageOutput.format("Breakpoints can be located only in classes.",
140+ refSpec.toString()));
141+ } else {
142+ return super.errorMessageFor( e);
143+ }
144+ }
145+
146+ @Override
147+ public String toString() {
148+ StringBuffer buffer = new StringBuffer(refSpec.toString());
149+ if (isMethodBreakpoint()) {
150+ buffer.append('.');
151+ buffer.append(methodId);
152+ if (methodArgs != null) {
153+ boolean first = true;
154+ buffer.append('(');
155+ for (String arg : methodArgs) {
156+ if (!first) {
157+ buffer.append(',');
158+ }
159+ buffer.append(arg);
160+ first = false;
161+ }
162+ buffer.append(")");
163+ }
164+ } else {
165+ buffer.append(':');
166+ buffer.append(lineNumber);
167+ }
168+ return MessageOutput.format("breakpoint", buffer.toString());
169+ }
170+
171+ private Location location(ReferenceType refType) throws
172+ AmbiguousMethodException,
173+ AbsentInformationException,
174+ NoSuchMethodException,
175+ LineNotFoundException {
176+ Location location = null;
177+ if (isMethodBreakpoint()) {
178+ Method method = findMatchingMethod(refType);
179+ location = method.location();
180+ } else {
181+ // let AbsentInformationException be thrown
182+ List<Location> locs = refType.locationsOfLine(lineNumber());
183+ if (locs.size() == 0) {
184+ throw new LineNotFoundException();
185+ }
186+ // TO DO: handle multiple locations
187+ location = locs.get(0);
188+ if (location.method() == null) {
189+ throw new LineNotFoundException();
190+ }
191+ }
192+ return location;
193+ }
194+
195+ private boolean isValidMethodName(String s) {
196+ return isJavaIdentifier(s) ||
197+ s.equals("<init>") ||
198+ s.equals("<clinit>");
199+ }
200+
201+ /*
202+ * Compare a method's argument types with a Vector of type names.
203+ * Return true if each argument type has a name identical to the
204+ * corresponding string in the vector (allowing for varars)
205+ * and if the number of arguments in the method matches the
206+ * number of names passed
207+ */
208+ private boolean compareArgTypes(Method method, List<String> nameList) {
209+ List<String> argTypeNames = method.argumentTypeNames();
210+
211+ // If argument counts differ, we can stop here
212+ if (argTypeNames.size() != nameList.size()) {
213+ return false;
214+ }
215+
216+ // Compare each argument type's name
217+ int nTypes = argTypeNames.size();
218+ for (int i = 0; i < nTypes; ++i) {
219+ String comp1 = argTypeNames.get(i);
220+ String comp2 = nameList.get(i);
221+ if (! comp1.equals(comp2)) {
222+ /*
223+ * We have to handle varargs. EG, the
224+ * method's last arg type is xxx[]
225+ * while the nameList contains xxx...
226+ * Note that the nameList can also contain
227+ * xxx[] in which case we don't get here.
228+ */
229+ if (i != nTypes - 1 ||
230+ !method.isVarArgs() ||
231+ !comp2.endsWith("...")) {
232+ return false;
233+ }
234+ /*
235+ * The last types differ, it is a varargs
236+ * method and the nameList item is varargs.
237+ * We just have to compare the type names, eg,
238+ * make sure we don't have xxx[] for the method
239+ * arg type and yyy... for the nameList item.
240+ */
241+ int comp1Length = comp1.length();
242+ if (comp1Length + 1 != comp2.length()) {
243+ // The type names are different lengths
244+ return false;
245+ }
246+ // We know the two type names are the same length
247+ if (!comp1.regionMatches(0, comp2, 0, comp1Length - 2)) {
248+ return false;
249+ }
250+ // We do have xxx[] and xxx... as the last param type
251+ return true;
252+ }
253+ }
254+
255+ return true;
256+ }
257+
258+
259+ /*
260+ * Remove unneeded spaces and expand class names to fully
261+ * qualified names, if necessary and possible.
262+ */
263+ private String normalizeArgTypeName(String name) {
264+ /*
265+ * Separate the type name from any array modifiers,
266+ * stripping whitespace after the name ends
267+ */
268+ int i = 0;
269+ StringBuffer typePart = new StringBuffer();
270+ StringBuffer arrayPart = new StringBuffer();
271+ name = name.trim();
272+ int nameLength = name.length();
273+ /*
274+ * For varargs, there can be spaces before the ... but not
275+ * within the ... So, we will just ignore the ...
276+ * while stripping blanks.
277+ */
278+ boolean isVarArgs = name.endsWith("...");
279+ if (isVarArgs) {
280+ nameLength -= 3;
281+ }
282+ while (i < nameLength) {
283+ char c = name.charAt(i);
284+ if (Character.isWhitespace(c) || c == '[') {
285+ break; // name is complete
286+ }
287+ typePart.append(c);
288+ i++;
289+ }
290+ while (i < nameLength) {
291+ char c = name.charAt(i);
292+ if ( (c == '[') || (c == ']')) {
293+ arrayPart.append(c);
294+ } else if (!Character.isWhitespace(c)) {
295+ throw new IllegalArgumentException
296+ (MessageOutput.format("Invalid argument type name"));
297+ }
298+ i++;
299+ }
300+ name = typePart.toString();
301+
302+ /*
303+ * When there's no sign of a package name already, try to expand the
304+ * the name to a fully qualified class name
305+ */
306+ if ((name.indexOf('.') == -1) || name.startsWith("*.")) {
307+ try {
308+ ReferenceType argClass = Env.getReferenceTypeFromToken(name);
309+ if (argClass != null) {
310+ name = argClass.name();
311+ }
312+ } catch (IllegalArgumentException e) {
313+ // We'll try the name as is
314+ }
315+ }
316+ name += arrayPart.toString();
317+ if (isVarArgs) {
318+ name += "...";
319+ }
320+ return name;
321+ }
322+
323+ /*
324+ * Attempt an unambiguous match of the method name and
325+ * argument specification to a method. If no arguments
326+ * are specified, the method must not be overloaded.
327+ * Otherwise, the argument types much match exactly
328+ */
329+ private Method findMatchingMethod(ReferenceType refType)
330+ throws AmbiguousMethodException,
331+ NoSuchMethodException {
332+
333+ // Normalize the argument string once before looping below.
334+ List<String> argTypeNames = null;
335+ if (methodArgs() != null) {
336+ argTypeNames = new ArrayList<String>(methodArgs().size());
337+ for (String name : methodArgs()) {
338+ name = normalizeArgTypeName(name);
339+ argTypeNames.add(name);
340+ }
341+ }
342+
343+ // Check each method in the class for matches
344+ Method firstMatch = null; // first method with matching name
345+ Method exactMatch = null; // (only) method with same name & sig
346+ int matchCount = 0; // > 1 implies overload
347+ for (Method candidate : refType.methods()) {
348+ if (candidate.name().equals(methodName())) {
349+ matchCount++;
350+
351+ // Remember the first match in case it is the only one
352+ if (matchCount == 1) {
353+ firstMatch = candidate;
354+ }
355+
356+ // If argument types were specified, check against candidate
357+ if ((argTypeNames != null)
358+ && compareArgTypes(candidate, argTypeNames) == true) {
359+ exactMatch = candidate;
360+ break;
361+ }
362+ }
363+ }
364+
365+ // Determine method for breakpoint
366+ Method method = null;
367+ if (exactMatch != null) {
368+ // Name and signature match
369+ method = exactMatch;
370+ } else if ((argTypeNames == null) && (matchCount > 0)) {
371+ // At least one name matched and no arg types were specified
372+ if (matchCount == 1) {
373+ method = firstMatch; // Only one match; safe to use it
374+ } else {
375+ throw new AmbiguousMethodException();
376+ }
377+ } else {
378+ throw new NoSuchMethodException(methodName());
379+ }
380+ return method;
381+ }
382+}
java/pkg/com/sun/tools/example/debug/tty/Commands.java+2098−0
@@ -0,0 +1,2098 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.connect.Connector;
30+import com.sun.jdi.request.*;
31+import com.sun.tools.example.debug.expr.ExpressionParser;
32+import com.sun.tools.example.debug.expr.ParseException;
33+
34+import java.text.*;
35+import java.util.*;
36+import java.io.*;
37+
38+class Commands {
39+
40+ abstract class AsyncExecution {
41+ abstract void action();
42+
43+ AsyncExecution() {
44+ execute();
45+ }
46+
47+ void execute() {
48+ /*
49+ * Save current thread and stack frame. (BugId 4296031)
50+ */
51+ final ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
52+ final int stackFrame = threadInfo == null? 0 : threadInfo.getCurrentFrameIndex();
53+ Thread thread = new Thread("asynchronous jdb command") {
54+ @Override
55+ public void run() {
56+ try {
57+ action();
58+ } catch (UnsupportedOperationException uoe) {
59+ //(BugId 4453329)
60+ MessageOutput.println("Operation is not supported on the target VM");
61+ } catch (Exception e) {
62+ MessageOutput.println("Internal exception during operation:",
63+ e.getMessage());
64+ } finally {
65+ /*
66+ * This was an asynchronous command. Events may have been
67+ * processed while it was running. Restore the thread and
68+ * stack frame the user was looking at. (BugId 4296031)
69+ */
70+ if (threadInfo != null) {
71+ ThreadInfo.setCurrentThreadInfo(threadInfo);
72+ try {
73+ threadInfo.setCurrentFrameIndex(stackFrame);
74+ } catch (IncompatibleThreadStateException e) {
75+ MessageOutput.println("Current thread isnt suspended.");
76+ } catch (ArrayIndexOutOfBoundsException e) {
77+ MessageOutput.println("Requested stack frame is no longer active:",
78+ new Object []{new Integer(stackFrame)});
79+ }
80+ }
81+ MessageOutput.printPrompt();
82+ }
83+ }
84+ };
85+ thread.start();
86+ }
87+ }
88+
89+ Commands() {
90+ }
91+
92+ private Value evaluate(String expr) {
93+ Value result = null;
94+ ExpressionParser.GetFrame frameGetter = null;
95+ try {
96+ final ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
97+ if ((threadInfo != null) && (threadInfo.getCurrentFrame() != null)) {
98+ frameGetter = new ExpressionParser.GetFrame() {
99+ @Override
100+ public StackFrame get() throws IncompatibleThreadStateException {
101+ return threadInfo.getCurrentFrame();
102+ }
103+ };
104+ }
105+ result = ExpressionParser.evaluate(expr, Env.vm(), frameGetter);
106+ } catch (InvocationException ie) {
107+ MessageOutput.println("Exception in expression:",
108+ ie.exception().referenceType().name());
109+ } catch (Exception ex) {
110+ String exMessage = ex.getMessage();
111+ if (exMessage == null) {
112+ MessageOutput.printException(exMessage, ex);
113+ } else {
114+ String s;
115+ try {
116+ s = MessageOutput.format(exMessage);
117+ } catch (MissingResourceException mex) {
118+ s = ex.toString();
119+ }
120+ MessageOutput.printDirectln(s);// Special case: use printDirectln()
121+ }
122+ }
123+ return result;
124+ }
125+
126+ private String getStringValue() {
127+ Value val = null;
128+ String valStr = null;
129+ try {
130+ val = ExpressionParser.getMassagedValue();
131+ valStr = val.toString();
132+ } catch (ParseException e) {
133+ String msg = e.getMessage();
134+ if (msg == null) {
135+ MessageOutput.printException(msg, e);
136+ } else {
137+ String s;
138+ try {
139+ s = MessageOutput.format(msg);
140+ } catch (MissingResourceException mex) {
141+ s = e.toString();
142+ }
143+ MessageOutput.printDirectln(s);
144+ }
145+ }
146+ return valStr;
147+ }
148+
149+ private ThreadInfo doGetThread(String idToken) {
150+ ThreadInfo threadInfo = ThreadInfo.getThreadInfo(idToken);
151+ if (threadInfo == null) {
152+ MessageOutput.println("is not a valid thread id", idToken);
153+ }
154+ return threadInfo;
155+ }
156+
157+ String typedName(Method method) {
158+ StringBuffer buf = new StringBuffer();
159+ buf.append(method.name());
160+ buf.append("(");
161+
162+ List<String> args = method.argumentTypeNames();
163+ int lastParam = args.size() - 1;
164+ // output param types except for the last
165+ for (int ii = 0; ii < lastParam; ii++) {
166+ buf.append(args.get(ii));
167+ buf.append(", ");
168+ }
169+ if (lastParam >= 0) {
170+ // output the last param
171+ String lastStr = args.get(lastParam);
172+ if (method.isVarArgs()) {
173+ // lastParam is an array. Replace the [] with ...
174+ buf.append(lastStr.substring(0, lastStr.length() - 2));
175+ buf.append("...");
176+ } else {
177+ buf.append(lastStr);
178+ }
179+ }
180+ buf.append(")");
181+ return buf.toString();
182+ }
183+
184+ void commandConnectors(VirtualMachineManager vmm) {
185+ Collection<Connector> ccs = vmm.allConnectors();
186+ if (ccs.isEmpty()) {
187+ MessageOutput.println("Connectors available");
188+ }
189+ for (Connector cc : ccs) {
190+ String transportName =
191+ cc.transport() == null ? "null" : cc.transport().name();
192+ MessageOutput.println();
193+ MessageOutput.println("Connector and Transport name",
194+ new Object [] {cc.name(), transportName});
195+ MessageOutput.println("Connector description", cc.description());
196+
197+ for (Connector.Argument aa : cc.defaultArguments().values()) {
198+ MessageOutput.println();
199+
200+ boolean requiredArgument = aa.mustSpecify();
201+ if (aa.value() == null || aa.value() == "") {
202+ //no current value and no default.
203+ MessageOutput.println(requiredArgument ?
204+ "Connector required argument nodefault" :
205+ "Connector argument nodefault", aa.name());
206+ } else {
207+ MessageOutput.println(requiredArgument ?
208+ "Connector required argument default" :
209+ "Connector argument default",
210+ new Object [] {aa.name(), aa.value()});
211+ }
212+ MessageOutput.println("Connector description", aa.description());
213+
214+ }
215+ }
216+
217+ }
218+
219+ void commandClasses() {
220+ StringBuffer classList = new StringBuffer();
221+ for (ReferenceType refType : Env.vm().allClasses()) {
222+ classList.append(refType.name());
223+ classList.append("\n");
224+ }
225+ MessageOutput.print("** classes list **", classList.toString());
226+ }
227+
228+ void commandClass(StringTokenizer t) {
229+
230+ if (!t.hasMoreTokens()) {
231+ MessageOutput.println("No class specified.");
232+ return;
233+ }
234+
235+ String idClass = t.nextToken();
236+ boolean showAll = false;
237+
238+ if (t.hasMoreTokens()) {
239+ if (t.nextToken().toLowerCase().equals("all")) {
240+ showAll = true;
241+ } else {
242+ MessageOutput.println("Invalid option on class command");
243+ return;
244+ }
245+ }
246+ ReferenceType type = Env.getReferenceTypeFromToken(idClass);
247+ if (type == null) {
248+ MessageOutput.println("is not a valid id or class name", idClass);
249+ return;
250+ }
251+ if (type instanceof ClassType) {
252+ ClassType clazz = (ClassType)type;
253+ MessageOutput.println("Class:", clazz.name());
254+
255+ ClassType superclass = clazz.superclass();
256+ while (superclass != null) {
257+ MessageOutput.println("extends:", superclass.name());
258+ superclass = showAll ? superclass.superclass() : null;
259+ }
260+
261+ List<InterfaceType> interfaces =
262+ showAll ? clazz.allInterfaces() : clazz.interfaces();
263+ for (InterfaceType interfaze : interfaces) {
264+ MessageOutput.println("implements:", interfaze.name());
265+ }
266+
267+ for (ClassType sub : clazz.subclasses()) {
268+ MessageOutput.println("subclass:", sub.name());
269+ }
270+ for (ReferenceType nest : clazz.nestedTypes()) {
271+ MessageOutput.println("nested:", nest.name());
272+ }
273+ } else if (type instanceof InterfaceType) {
274+ InterfaceType interfaze = (InterfaceType)type;
275+ MessageOutput.println("Interface:", interfaze.name());
276+ for (InterfaceType superinterface : interfaze.superinterfaces()) {
277+ MessageOutput.println("extends:", superinterface.name());
278+ }
279+ for (InterfaceType sub : interfaze.subinterfaces()) {
280+ MessageOutput.println("subinterface:", sub.name());
281+ }
282+ for (ClassType implementor : interfaze.implementors()) {
283+ MessageOutput.println("implementor:", implementor.name());
284+ }
285+ for (ReferenceType nest : interfaze.nestedTypes()) {
286+ MessageOutput.println("nested:", nest.name());
287+ }
288+ } else { // array type
289+ ArrayType array = (ArrayType)type;
290+ MessageOutput.println("Array:", array.name());
291+ }
292+ }
293+
294+ void commandMethods(StringTokenizer t) {
295+ if (!t.hasMoreTokens()) {
296+ MessageOutput.println("No class specified.");
297+ return;
298+ }
299+
300+ String idClass = t.nextToken();
301+ ReferenceType cls = Env.getReferenceTypeFromToken(idClass);
302+ if (cls != null) {
303+ StringBuffer methodsList = new StringBuffer();
304+ for (Method method : cls.allMethods()) {
305+ methodsList.append(method.declaringType().name());
306+ methodsList.append(" ");
307+ methodsList.append(typedName(method));
308+ methodsList.append('\n');
309+ }
310+ MessageOutput.print("** methods list **", methodsList.toString());
311+ } else {
312+ MessageOutput.println("is not a valid id or class name", idClass);
313+ }
314+ }
315+
316+ void commandFields(StringTokenizer t) {
317+ if (!t.hasMoreTokens()) {
318+ MessageOutput.println("No class specified.");
319+ return;
320+ }
321+
322+ String idClass = t.nextToken();
323+ ReferenceType cls = Env.getReferenceTypeFromToken(idClass);
324+ if (cls != null) {
325+ List<Field> fields = cls.allFields();
326+ List<Field> visible = cls.visibleFields();
327+ StringBuffer fieldsList = new StringBuffer();
328+ for (Field field : fields) {
329+ String s;
330+ if (!visible.contains(field)) {
331+ s = MessageOutput.format("list field typename and name hidden",
332+ new Object [] {field.typeName(),
333+ field.name()});
334+ } else if (!field.declaringType().equals(cls)) {
335+ s = MessageOutput.format("list field typename and name inherited",
336+ new Object [] {field.typeName(),
337+ field.name(),
338+ field.declaringType().name()});
339+ } else {
340+ s = MessageOutput.format("list field typename and name",
341+ new Object [] {field.typeName(),
342+ field.name()});
343+ }
344+ fieldsList.append(s);
345+ }
346+ MessageOutput.print("** fields list **", fieldsList.toString());
347+ } else {
348+ MessageOutput.println("is not a valid id or class name", idClass);
349+ }
350+ }
351+
352+ private void printThreadGroup(ThreadGroupReference tg) {
353+ ThreadIterator threadIter = new ThreadIterator(tg);
354+
355+ MessageOutput.println("Thread Group:", tg.name());
356+ int maxIdLength = 0;
357+ int maxNameLength = 0;
358+ while (threadIter.hasNext()) {
359+ ThreadReference thr = threadIter.next();
360+ maxIdLength = Math.max(maxIdLength,
361+ Env.description(thr).length());
362+ maxNameLength = Math.max(maxNameLength,
363+ thr.name().length());
364+ }
365+
366+ threadIter = new ThreadIterator(tg);
367+ while (threadIter.hasNext()) {
368+ ThreadReference thr = threadIter.next();
369+ if (thr.threadGroup() == null) {
370+ continue;
371+ }
372+ // Note any thread group changes
373+ if (!thr.threadGroup().equals(tg)) {
374+ tg = thr.threadGroup();
375+ MessageOutput.println("Thread Group:", tg.name());
376+ }
377+
378+ /*
379+ * Do a bit of filling with whitespace to get thread ID
380+ * and thread names to line up in the listing, and also
381+ * allow for proper localization. This also works for
382+ * very long thread names, at the possible cost of lines
383+ * being wrapped by the display device.
384+ */
385+ StringBuffer idBuffer = new StringBuffer(Env.description(thr));
386+ for (int i = idBuffer.length(); i < maxIdLength; i++) {
387+ idBuffer.append(" ");
388+ }
389+ StringBuffer nameBuffer = new StringBuffer(thr.name());
390+ for (int i = nameBuffer.length(); i < maxNameLength; i++) {
391+ nameBuffer.append(" ");
392+ }
393+
394+ /*
395+ * Select the output format to use based on thread status
396+ * and breakpoint.
397+ */
398+ String statusFormat;
399+ switch (thr.status()) {
400+ case ThreadReference.THREAD_STATUS_UNKNOWN:
401+ if (thr.isAtBreakpoint()) {
402+ statusFormat = "Thread description name unknownStatus BP";
403+ } else {
404+ statusFormat = "Thread description name unknownStatus";
405+ }
406+ break;
407+ case ThreadReference.THREAD_STATUS_ZOMBIE:
408+ if (thr.isAtBreakpoint()) {
409+ statusFormat = "Thread description name zombieStatus BP";
410+ } else {
411+ statusFormat = "Thread description name zombieStatus";
412+ }
413+ break;
414+ case ThreadReference.THREAD_STATUS_RUNNING:
415+ if (thr.isAtBreakpoint()) {
416+ statusFormat = "Thread description name runningStatus BP";
417+ } else {
418+ statusFormat = "Thread description name runningStatus";
419+ }
420+ break;
421+ case ThreadReference.THREAD_STATUS_SLEEPING:
422+ if (thr.isAtBreakpoint()) {
423+ statusFormat = "Thread description name sleepingStatus BP";
424+ } else {
425+ statusFormat = "Thread description name sleepingStatus";
426+ }
427+ break;
428+ case ThreadReference.THREAD_STATUS_MONITOR:
429+ if (thr.isAtBreakpoint()) {
430+ statusFormat = "Thread description name waitingStatus BP";
431+ } else {
432+ statusFormat = "Thread description name waitingStatus";
433+ }
434+ break;
435+ case ThreadReference.THREAD_STATUS_WAIT:
436+ if (thr.isAtBreakpoint()) {
437+ statusFormat = "Thread description name condWaitstatus BP";
438+ } else {
439+ statusFormat = "Thread description name condWaitstatus";
440+ }
441+ break;
442+ default:
443+ throw new InternalError(MessageOutput.format("Invalid thread status."));
444+ }
445+ MessageOutput.println(statusFormat,
446+ new Object [] {idBuffer.toString(),
447+ nameBuffer.toString()});
448+ }
449+ }
450+
451+ void commandThreads(StringTokenizer t) {
452+ if (!t.hasMoreTokens()) {
453+ printThreadGroup(ThreadInfo.group());
454+ return;
455+ }
456+ String name = t.nextToken();
457+ ThreadGroupReference tg = ThreadGroupIterator.find(name);
458+ if (tg == null) {
459+ MessageOutput.println("is not a valid threadgroup name", name);
460+ } else {
461+ printThreadGroup(tg);
462+ }
463+ }
464+
465+ void commandThreadGroups() {
466+ ThreadGroupIterator it = new ThreadGroupIterator();
467+ int cnt = 0;
468+ while (it.hasNext()) {
469+ ThreadGroupReference tg = it.nextThreadGroup();
470+ ++cnt;
471+ MessageOutput.println("thread group number description name",
472+ new Object [] { new Integer (cnt),
473+ Env.description(tg),
474+ tg.name()});
475+ }
476+ }
477+
478+ void commandThread(StringTokenizer t) {
479+ if (!t.hasMoreTokens()) {
480+ MessageOutput.println("Thread number not specified.");
481+ return;
482+ }
483+ ThreadInfo threadInfo = doGetThread(t.nextToken());
484+ if (threadInfo != null) {
485+ ThreadInfo.setCurrentThreadInfo(threadInfo);
486+ }
487+ }
488+
489+ void commandThreadGroup(StringTokenizer t) {
490+ if (!t.hasMoreTokens()) {
491+ MessageOutput.println("Threadgroup name not specified.");
492+ return;
493+ }
494+ String name = t.nextToken();
495+ ThreadGroupReference tg = ThreadGroupIterator.find(name);
496+ if (tg == null) {
497+ MessageOutput.println("is not a valid threadgroup name", name);
498+ } else {
499+ ThreadInfo.setThreadGroup(tg);
500+ }
501+ }
502+
503+ void commandRun(StringTokenizer t) {
504+ /*
505+ * The 'run' command makes little sense in a
506+ * that doesn't support restarts or multiple VMs. However,
507+ * this is an attempt to emulate the behavior of the old
508+ * JDB as much as possible. For new users and implementations
509+ * it is much more straightforward to launch immedidately
510+ * with the -launch option.
511+ */
512+ VMConnection connection = Env.connection();
513+ if (!connection.isLaunch()) {
514+ if (!t.hasMoreTokens()) {
515+ commandCont();
516+ } else {
517+ MessageOutput.println("run <args> command is valid only with launched VMs");
518+ }
519+ return;
520+ }
521+ if (connection.isOpen()) {
522+ MessageOutput.println("VM already running. use cont to continue after events.");
523+ return;
524+ }
525+
526+ /*
527+ * Set the main class and any arguments. Note that this will work
528+ * only with the standard launcher, "com.sun.jdi.CommandLineLauncher"
529+ */
530+ String args;
531+ if (t.hasMoreTokens()) {
532+ args = t.nextToken("");
533+ boolean argsSet = connection.setConnectorArg("main", args);
534+ if (!argsSet) {
535+ MessageOutput.println("Unable to set main class and arguments");
536+ return;
537+ }
538+ } else {
539+ args = connection.connectorArg("main");
540+ if (args.length() == 0) {
541+ MessageOutput.println("Main class and arguments must be specified");
542+ return;
543+ }
544+ }
545+ MessageOutput.println("run", args);
546+
547+ /*
548+ * Launch the VM.
549+ */
550+ connection.open();
551+
552+ }
553+
554+ void commandLoad(StringTokenizer t) {
555+ MessageOutput.println("The load command is no longer supported.");
556+ }
557+
558+ private List<ThreadReference> allThreads(ThreadGroupReference group) {
559+ List<ThreadReference> list = new ArrayList<ThreadReference>();
560+ list.addAll(group.threads());
561+ for (ThreadGroupReference child : group.threadGroups()) {
562+ list.addAll(allThreads(child));
563+ }
564+ return list;
565+ }
566+
567+ void commandSuspend(StringTokenizer t) {
568+ if (!t.hasMoreTokens()) {
569+ Env.vm().suspend();
570+ MessageOutput.println("All threads suspended.");
571+ } else {
572+ while (t.hasMoreTokens()) {
573+ ThreadInfo threadInfo = doGetThread(t.nextToken());
574+ if (threadInfo != null) {
575+ threadInfo.getThread().suspend();
576+ }
577+ }
578+ }
579+ }
580+
581+ void commandResume(StringTokenizer t) {
582+ if (!t.hasMoreTokens()) {
583+ ThreadInfo.invalidateAll();
584+ Env.vm().resume();
585+ MessageOutput.println("All threads resumed.");
586+ } else {
587+ while (t.hasMoreTokens()) {
588+ ThreadInfo threadInfo = doGetThread(t.nextToken());
589+ if (threadInfo != null) {
590+ threadInfo.invalidate();
591+ threadInfo.getThread().resume();
592+ }
593+ }
594+ }
595+ }
596+
597+ void commandCont() {
598+ if (ThreadInfo.getCurrentThreadInfo() == null) {
599+ MessageOutput.println("Nothing suspended.");
600+ return;
601+ }
602+ ThreadInfo.invalidateAll();
603+ Env.vm().resume();
604+ }
605+
606+ void clearPreviousStep(ThreadReference thread) {
607+ /*
608+ * A previous step may not have completed on this thread;
609+ * if so, it gets removed here.
610+ */
611+ EventRequestManager mgr = Env.vm().eventRequestManager();
612+ for (StepRequest request : mgr.stepRequests()) {
613+ if (request.thread().equals(thread)) {
614+ mgr.deleteEventRequest(request);
615+ break;
616+ }
617+ }
618+ }
619+ /* step
620+ *
621+ */
622+ void commandStep(StringTokenizer t) {
623+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
624+ if (threadInfo == null) {
625+ MessageOutput.println("Nothing suspended.");
626+ return;
627+ }
628+ int depth;
629+ if (t.hasMoreTokens() &&
630+ t.nextToken().toLowerCase().equals("up")) {
631+ depth = StepRequest.STEP_OUT;
632+ } else {
633+ depth = StepRequest.STEP_INTO;
634+ }
635+
636+ clearPreviousStep(threadInfo.getThread());
637+ EventRequestManager reqMgr = Env.vm().eventRequestManager();
638+ StepRequest request = reqMgr.createStepRequest(threadInfo.getThread(),
639+ StepRequest.STEP_LINE, depth);
640+ if (depth == StepRequest.STEP_INTO) {
641+ Env.addExcludes(request);
642+ }
643+ // We want just the next step event and no others
644+ request.addCountFilter(1);
645+ request.enable();
646+ ThreadInfo.invalidateAll();
647+ Env.vm().resume();
648+ }
649+
650+ /* stepi
651+ * step instruction.
652+ */
653+ void commandStepi() {
654+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
655+ if (threadInfo == null) {
656+ MessageOutput.println("Nothing suspended.");
657+ return;
658+ }
659+ clearPreviousStep(threadInfo.getThread());
660+ EventRequestManager reqMgr = Env.vm().eventRequestManager();
661+ StepRequest request = reqMgr.createStepRequest(threadInfo.getThread(),
662+ StepRequest.STEP_MIN,
663+ StepRequest.STEP_INTO);
664+ Env.addExcludes(request);
665+ // We want just the next step event and no others
666+ request.addCountFilter(1);
667+ request.enable();
668+ ThreadInfo.invalidateAll();
669+ Env.vm().resume();
670+ }
671+
672+ void commandNext() {
673+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
674+ if (threadInfo == null) {
675+ MessageOutput.println("Nothing suspended.");
676+ return;
677+ }
678+ clearPreviousStep(threadInfo.getThread());
679+ EventRequestManager reqMgr = Env.vm().eventRequestManager();
680+ StepRequest request = reqMgr.createStepRequest(threadInfo.getThread(),
681+ StepRequest.STEP_LINE,
682+ StepRequest.STEP_OVER);
683+ Env.addExcludes(request);
684+ // We want just the next step event and no others
685+ request.addCountFilter(1);
686+ request.enable();
687+ ThreadInfo.invalidateAll();
688+ Env.vm().resume();
689+ }
690+
691+ void doKill(ThreadReference thread, StringTokenizer t) {
692+ if (!t.hasMoreTokens()) {
693+ MessageOutput.println("No exception object specified.");
694+ return;
695+ }
696+ String expr = t.nextToken("");
697+ Value val = evaluate(expr);
698+ if ((val != null) && (val instanceof ObjectReference)) {
699+ try {
700+ thread.stop((ObjectReference)val);
701+ MessageOutput.println("killed", thread.toString());
702+ } catch (InvalidTypeException e) {
703+ MessageOutput.println("Invalid exception object");
704+ }
705+ } else {
706+ MessageOutput.println("Expression must evaluate to an object");
707+ }
708+ }
709+
710+ void doKillThread(final ThreadReference threadToKill,
711+ final StringTokenizer tokenizer) {
712+ new AsyncExecution() {
713+ @Override
714+ void action() {
715+ doKill(threadToKill, tokenizer);
716+ }
717+ };
718+ }
719+
720+ void commandKill(StringTokenizer t) {
721+ if (!t.hasMoreTokens()) {
722+ MessageOutput.println("Usage: kill <thread id> <throwable>");
723+ return;
724+ }
725+ ThreadInfo threadInfo = doGetThread(t.nextToken());
726+ if (threadInfo != null) {
727+ MessageOutput.println("killing thread:", threadInfo.getThread().name());
728+ doKillThread(threadInfo.getThread(), t);
729+ return;
730+ }
731+ }
732+
733+ void listCaughtExceptions() {
734+ boolean noExceptions = true;
735+
736+ // Print a listing of the catch patterns currently in place
737+ for (EventRequestSpec spec : Env.specList.eventRequestSpecs()) {
738+ if (spec instanceof ExceptionSpec) {
739+ if (noExceptions) {
740+ noExceptions = false;
741+ MessageOutput.println("Exceptions caught:");
742+ }
743+ MessageOutput.println("tab", spec.toString());
744+ }
745+ }
746+ if (noExceptions) {
747+ MessageOutput.println("No exceptions caught.");
748+ }
749+ }
750+
751+ private EventRequestSpec parseExceptionSpec(StringTokenizer t) {
752+ String notification = t.nextToken();
753+ boolean notifyCaught = false;
754+ boolean notifyUncaught = false;
755+ EventRequestSpec spec = null;
756+ String classPattern = null;
757+
758+ if (notification.equals("uncaught")) {
759+ notifyCaught = false;
760+ notifyUncaught = true;
761+ } else if (notification.equals("caught")) {
762+ notifyCaught = true;
763+ notifyUncaught = false;
764+ } else if (notification.equals("all")) {
765+ notifyCaught = true;
766+ notifyUncaught = true;
767+ } else {
768+ /*
769+ * Handle the same as "all" for backward
770+ * compatibility with existing .jdbrc files.
771+ *
772+ * Insert an "all" and take the current token as the
773+ * intended classPattern
774+ *
775+ */
776+ notifyCaught = true;
777+ notifyUncaught = true;
778+ classPattern = notification;
779+ }
780+ if (classPattern == null && t.hasMoreTokens()) {
781+ classPattern = t.nextToken();
782+ }
783+ if ((classPattern != null) && (notifyCaught || notifyUncaught)) {
784+ try {
785+ spec = Env.specList.createExceptionCatch(classPattern,
786+ notifyCaught,
787+ notifyUncaught);
788+ } catch (ClassNotFoundException exc) {
789+ MessageOutput.println("is not a valid class name", classPattern);
790+ }
791+ }
792+ return spec;
793+ }
794+
795+ void commandCatchException(StringTokenizer t) {
796+ if (!t.hasMoreTokens()) {
797+ listCaughtExceptions();
798+ } else {
799+ EventRequestSpec spec = parseExceptionSpec(t);
800+ if (spec != null) {
801+ resolveNow(spec);
802+ } else {
803+ MessageOutput.println("Usage: catch exception");
804+ }
805+ }
806+ }
807+
808+ void commandIgnoreException(StringTokenizer t) {
809+ if (!t.hasMoreTokens()) {
810+ listCaughtExceptions();
811+ } else {
812+ EventRequestSpec spec = parseExceptionSpec(t);
813+ if (Env.specList.delete(spec)) {
814+ MessageOutput.println("Removed:", spec.toString());
815+ } else {
816+ if (spec != null) {
817+ MessageOutput.println("Not found:", spec.toString());
818+ }
819+ MessageOutput.println("Usage: ignore exception");
820+ }
821+ }
822+ }
823+
824+ void commandUp(StringTokenizer t) {
825+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
826+ if (threadInfo == null) {
827+ MessageOutput.println("Current thread not set.");
828+ return;
829+ }
830+
831+ int nLevels = 1;
832+ if (t.hasMoreTokens()) {
833+ String idToken = t.nextToken();
834+ int i;
835+ try {
836+ NumberFormat nf = NumberFormat.getNumberInstance();
837+ nf.setParseIntegerOnly(true);
838+ Number n = nf.parse(idToken);
839+ i = n.intValue();
840+ } catch (java.text.ParseException jtpe) {
841+ i = 0;
842+ }
843+ if (i <= 0) {
844+ MessageOutput.println("Usage: up [n frames]");
845+ return;
846+ }
847+ nLevels = i;
848+ }
849+
850+ try {
851+ threadInfo.up(nLevels);
852+ } catch (IncompatibleThreadStateException e) {
853+ MessageOutput.println("Current thread isnt suspended.");
854+ } catch (ArrayIndexOutOfBoundsException e) {
855+ MessageOutput.println("End of stack.");
856+ }
857+ }
858+
859+ void commandDown(StringTokenizer t) {
860+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
861+ if (threadInfo == null) {
862+ MessageOutput.println("Current thread not set.");
863+ return;
864+ }
865+
866+ int nLevels = 1;
867+ if (t.hasMoreTokens()) {
868+ String idToken = t.nextToken();
869+ int i;
870+ try {
871+ NumberFormat nf = NumberFormat.getNumberInstance();
872+ nf.setParseIntegerOnly(true);
873+ Number n = nf.parse(idToken);
874+ i = n.intValue();
875+ } catch (java.text.ParseException jtpe) {
876+ i = 0;
877+ }
878+ if (i <= 0) {
879+ MessageOutput.println("Usage: down [n frames]");
880+ return;
881+ }
882+ nLevels = i;
883+ }
884+
885+ try {
886+ threadInfo.down(nLevels);
887+ } catch (IncompatibleThreadStateException e) {
888+ MessageOutput.println("Current thread isnt suspended.");
889+ } catch (ArrayIndexOutOfBoundsException e) {
890+ MessageOutput.println("End of stack.");
891+ }
892+ }
893+
894+ private void dumpStack(ThreadInfo threadInfo, boolean showPC) {
895+ List<StackFrame> stack = null;
896+ try {
897+ stack = threadInfo.getStack();
898+ } catch (IncompatibleThreadStateException e) {
899+ MessageOutput.println("Current thread isnt suspended.");
900+ return;
901+ }
902+ if (stack == null) {
903+ MessageOutput.println("Thread is not running (no stack).");
904+ } else {
905+ int nFrames = stack.size();
906+ for (int i = threadInfo.getCurrentFrameIndex(); i < nFrames; i++) {
907+ StackFrame frame = stack.get(i);
908+ dumpFrame (i, showPC, frame);
909+ }
910+ }
911+ }
912+
913+ private void dumpFrame (int frameNumber, boolean showPC, StackFrame frame) {
914+ Location loc = frame.location();
915+ long pc = -1;
916+ if (showPC) {
917+ pc = loc.codeIndex();
918+ }
919+ Method meth = loc.method();
920+
921+ long lineNumber = loc.lineNumber();
922+ String methodInfo = null;
923+ if (meth.isNative()) {
924+ methodInfo = MessageOutput.format("native method");
925+ } else if (lineNumber != -1) {
926+ try {
927+ methodInfo = loc.sourceName() +
928+ MessageOutput.format("line number",
929+ new Object [] {new Long(lineNumber)});
930+ } catch (AbsentInformationException e) {
931+ methodInfo = MessageOutput.format("unknown");
932+ }
933+ }
934+ if (pc != -1) {
935+ MessageOutput.println("stack frame dump with pc",
936+ new Object [] {new Integer(frameNumber + 1),
937+ meth.declaringType().name(),
938+ meth.name(),
939+ methodInfo,
940+ new Long(pc)});
941+ } else {
942+ MessageOutput.println("stack frame dump",
943+ new Object [] {new Integer(frameNumber + 1),
944+ meth.declaringType().name(),
945+ meth.name(),
946+ methodInfo});
947+ }
948+ }
949+
950+ void commandWhere(StringTokenizer t, boolean showPC) {
951+ if (!t.hasMoreTokens()) {
952+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
953+ if (threadInfo == null) {
954+ MessageOutput.println("No thread specified.");
955+ return;
956+ }
957+ dumpStack(threadInfo, showPC);
958+ } else {
959+ String token = t.nextToken();
960+ if (token.toLowerCase().equals("all")) {
961+ for (ThreadInfo threadInfo : ThreadInfo.threads()) {
962+ MessageOutput.println("Thread:",
963+ threadInfo.getThread().name());
964+ dumpStack(threadInfo, showPC);
965+ }
966+ } else {
967+ ThreadInfo threadInfo = doGetThread(token);
968+ if (threadInfo != null) {
969+ ThreadInfo.setCurrentThreadInfo(threadInfo);
970+ dumpStack(threadInfo, showPC);
971+ }
972+ }
973+ }
974+ }
975+
976+ void commandInterrupt(StringTokenizer t) {
977+ if (!t.hasMoreTokens()) {
978+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
979+ if (threadInfo == null) {
980+ MessageOutput.println("No thread specified.");
981+ return;
982+ }
983+ threadInfo.getThread().interrupt();
984+ } else {
985+ ThreadInfo threadInfo = doGetThread(t.nextToken());
986+ if (threadInfo != null) {
987+ threadInfo.getThread().interrupt();
988+ }
989+ }
990+ }
991+
992+ void commandMemory() {
993+ MessageOutput.println("The memory command is no longer supported.");
994+ }
995+
996+ void commandGC() {
997+ MessageOutput.println("The gc command is no longer necessary.");
998+ }
999+
1000+ /*
1001+ * The next two methods are used by this class and by EventHandler
1002+ * to print consistent locations and error messages.
1003+ */
1004+ static String locationString(Location loc) {
1005+ return MessageOutput.format("locationString",
1006+ new Object [] {loc.declaringType().name(),
1007+ loc.method().name(),
1008+ new Integer (loc.lineNumber()),
1009+ new Long (loc.codeIndex())});
1010+ }
1011+
1012+ void listBreakpoints() {
1013+ boolean noBreakpoints = true;
1014+
1015+ // Print set breakpoints
1016+ for (EventRequestSpec spec : Env.specList.eventRequestSpecs()) {
1017+ if (spec instanceof BreakpointSpec) {
1018+ if (noBreakpoints) {
1019+ noBreakpoints = false;
1020+ MessageOutput.println("Breakpoints set:");
1021+ }
1022+ MessageOutput.println("tab", spec.toString());
1023+ }
1024+ }
1025+ if (noBreakpoints) {
1026+ MessageOutput.println("No breakpoints set.");
1027+ }
1028+ }
1029+
1030+
1031+ private void printBreakpointCommandUsage(String atForm, String inForm) {
1032+ MessageOutput.println("printbreakpointcommandusage",
1033+ new Object [] {atForm, inForm});
1034+ }
1035+
1036+ protected BreakpointSpec parseBreakpointSpec(StringTokenizer t,
1037+ String atForm, String inForm) {
1038+ BreakpointSpec breakpoint = null;
1039+ try {
1040+ String token = t.nextToken(":( \t\n\r");
1041+
1042+ // We can't use hasMoreTokens here because it will cause any leading
1043+ // paren to be lost.
1044+ String rest;
1045+ try {
1046+ rest = t.nextToken("").trim();
1047+ } catch (NoSuchElementException e) {
1048+ rest = null;
1049+ }
1050+
1051+ if ((rest != null) && rest.startsWith(":")) {
1052+ t = new StringTokenizer(rest.substring(1));
1053+ String classId = token;
1054+ String lineToken = t.nextToken();
1055+
1056+ NumberFormat nf = NumberFormat.getNumberInstance();
1057+ nf.setParseIntegerOnly(true);
1058+ Number n = nf.parse(lineToken);
1059+ int lineNumber = n.intValue();
1060+
1061+ if (t.hasMoreTokens()) {
1062+ printBreakpointCommandUsage(atForm, inForm);
1063+ return null;
1064+ }
1065+ try {
1066+ breakpoint = Env.specList.createBreakpoint(classId,
1067+ lineNumber);
1068+ } catch (ClassNotFoundException exc) {
1069+ MessageOutput.println("is not a valid class name", classId);
1070+ }
1071+ } else {
1072+ // Try stripping method from class.method token.
1073+ int idot = token.lastIndexOf(".");
1074+ if ( (idot <= 0) || /* No dot or dot in first char */
1075+ (idot >= token.length() - 1) ) { /* dot in last char */
1076+ printBreakpointCommandUsage(atForm, inForm);
1077+ return null;
1078+ }
1079+ String methodName = token.substring(idot + 1);
1080+ String classId = token.substring(0, idot);
1081+ List<String> argumentList = null;
1082+ if (rest != null) {
1083+ if (!rest.startsWith("(") || !rest.endsWith(")")) {
1084+ MessageOutput.println("Invalid method specification:",
1085+ methodName + rest);
1086+ printBreakpointCommandUsage(atForm, inForm);
1087+ return null;
1088+ }
1089+ // Trim the parens
1090+ rest = rest.substring(1, rest.length() - 1);
1091+
1092+ argumentList = new ArrayList<String>();
1093+ t = new StringTokenizer(rest, ",");
1094+ while (t.hasMoreTokens()) {
1095+ argumentList.add(t.nextToken());
1096+ }
1097+ }
1098+ try {
1099+ breakpoint = Env.specList.createBreakpoint(classId,
1100+ methodName,
1101+ argumentList);
1102+ } catch (MalformedMemberNameException exc) {
1103+ MessageOutput.println("is not a valid method name", methodName);
1104+ } catch (ClassNotFoundException exc) {
1105+ MessageOutput.println("is not a valid class name", classId);
1106+ }
1107+ }
1108+ } catch (Exception e) {
1109+ printBreakpointCommandUsage(atForm, inForm);
1110+ return null;
1111+ }
1112+ return breakpoint;
1113+ }
1114+
1115+ private void resolveNow(EventRequestSpec spec) {
1116+ boolean success = Env.specList.addEagerlyResolve(spec);
1117+ if (success && !spec.isResolved()) {
1118+ MessageOutput.println("Deferring.", spec.toString());
1119+ }
1120+ }
1121+
1122+ void commandStop(StringTokenizer t) {
1123+ String atIn;
1124+ byte suspendPolicy = EventRequest.SUSPEND_ALL;
1125+
1126+ if (t.hasMoreTokens()) {
1127+ atIn = t.nextToken();
1128+ if (atIn.equals("go") && t.hasMoreTokens()) {
1129+ suspendPolicy = EventRequest.SUSPEND_NONE;
1130+ atIn = t.nextToken();
1131+ } else if (atIn.equals("thread") && t.hasMoreTokens()) {
1132+ suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD;
1133+ atIn = t.nextToken();
1134+ }
1135+ } else {
1136+ listBreakpoints();
1137+ return;
1138+ }
1139+
1140+ BreakpointSpec spec = parseBreakpointSpec(t, "stop at", "stop in");
1141+ if (spec != null) {
1142+ // Enforcement of "at" vs. "in". The distinction is really
1143+ // unnecessary and we should consider not checking for this
1144+ // (and making "at" and "in" optional).
1145+ if (atIn.equals("at") && spec.isMethodBreakpoint()) {
1146+ MessageOutput.println("Use stop at to set a breakpoint at a line number");
1147+ printBreakpointCommandUsage("stop at", "stop in");
1148+ return;
1149+ }
1150+ spec.suspendPolicy = suspendPolicy;
1151+ resolveNow(spec);
1152+ }
1153+ }
1154+
1155+ void commandClear(StringTokenizer t) {
1156+ if (!t.hasMoreTokens()) {
1157+ listBreakpoints();
1158+ return;
1159+ }
1160+
1161+ BreakpointSpec spec = parseBreakpointSpec(t, "clear", "clear");
1162+ if (spec != null) {
1163+ if (Env.specList.delete(spec)) {
1164+ MessageOutput.println("Removed:", spec.toString());
1165+ } else {
1166+ MessageOutput.println("Not found:", spec.toString());
1167+ }
1168+ }
1169+ }
1170+
1171+ private List<WatchpointSpec> parseWatchpointSpec(StringTokenizer t) {
1172+ List<WatchpointSpec> list = new ArrayList<WatchpointSpec>();
1173+ boolean access = false;
1174+ boolean modification = false;
1175+ int suspendPolicy = EventRequest.SUSPEND_ALL;
1176+
1177+ String fieldName = t.nextToken();
1178+ if (fieldName.equals("go")) {
1179+ suspendPolicy = EventRequest.SUSPEND_NONE;
1180+ fieldName = t.nextToken();
1181+ } else if (fieldName.equals("thread")) {
1182+ suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD;
1183+ fieldName = t.nextToken();
1184+ }
1185+ if (fieldName.equals("access")) {
1186+ access = true;
1187+ fieldName = t.nextToken();
1188+ } else if (fieldName.equals("all")) {
1189+ access = true;
1190+ modification = true;
1191+ fieldName = t.nextToken();
1192+ } else {
1193+ modification = true;
1194+ }
1195+ int dot = fieldName.lastIndexOf('.');
1196+ if (dot < 0) {
1197+ MessageOutput.println("Class containing field must be specified.");
1198+ return list;
1199+ }
1200+ String className = fieldName.substring(0, dot);
1201+ fieldName = fieldName.substring(dot+1);
1202+
1203+ try {
1204+ WatchpointSpec spec;
1205+ if (access) {
1206+ spec = Env.specList.createAccessWatchpoint(className,
1207+ fieldName);
1208+ spec.suspendPolicy = suspendPolicy;
1209+ list.add(spec);
1210+ }
1211+ if (modification) {
1212+ spec = Env.specList.createModificationWatchpoint(className,
1213+ fieldName);
1214+ spec.suspendPolicy = suspendPolicy;
1215+ list.add(spec);
1216+ }
1217+ } catch (MalformedMemberNameException exc) {
1218+ MessageOutput.println("is not a valid field name", fieldName);
1219+ } catch (ClassNotFoundException exc) {
1220+ MessageOutput.println("is not a valid class name", className);
1221+ }
1222+ return list;
1223+ }
1224+
1225+ void commandWatch(StringTokenizer t) {
1226+ if (!t.hasMoreTokens()) {
1227+ MessageOutput.println("Field to watch not specified");
1228+ return;
1229+ }
1230+
1231+ for (WatchpointSpec spec : parseWatchpointSpec(t)) {
1232+ resolveNow(spec);
1233+ }
1234+ }
1235+
1236+ void commandUnwatch(StringTokenizer t) {
1237+ if (!t.hasMoreTokens()) {
1238+ MessageOutput.println("Field to unwatch not specified");
1239+ return;
1240+ }
1241+
1242+ for (WatchpointSpec spec : parseWatchpointSpec(t)) {
1243+ if (Env.specList.delete(spec)) {
1244+ MessageOutput.println("Removed:", spec.toString());
1245+ } else {
1246+ MessageOutput.println("Not found:", spec.toString());
1247+ }
1248+ }
1249+ }
1250+
1251+ void turnOnExitTrace(ThreadInfo threadInfo, int suspendPolicy) {
1252+ EventRequestManager erm = Env.vm().eventRequestManager();
1253+ MethodExitRequest exit = erm.createMethodExitRequest();
1254+ if (threadInfo != null) {
1255+ exit.addThreadFilter(threadInfo.getThread());
1256+ }
1257+ Env.addExcludes(exit);
1258+ exit.setSuspendPolicy(suspendPolicy);
1259+ exit.enable();
1260+
1261+ }
1262+
1263+ static String methodTraceCommand = null;
1264+
1265+ void commandTrace(StringTokenizer t) {
1266+ String modif;
1267+ int suspendPolicy = EventRequest.SUSPEND_ALL;
1268+ ThreadInfo threadInfo = null;
1269+ String goStr = " ";
1270+
1271+ /*
1272+ * trace [go] methods [thread]
1273+ * trace [go] method exit | exits [thread]
1274+ */
1275+ if (t.hasMoreTokens()) {
1276+ modif = t.nextToken();
1277+ if (modif.equals("go")) {
1278+ suspendPolicy = EventRequest.SUSPEND_NONE;
1279+ goStr = " go ";
1280+ if (t.hasMoreTokens()) {
1281+ modif = t.nextToken();
1282+ }
1283+ } else if (modif.equals("thread")) {
1284+ // this is undocumented as it doesn't work right.
1285+ suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD;
1286+ if (t.hasMoreTokens()) {
1287+ modif = t.nextToken();
1288+ }
1289+ }
1290+
1291+ if (modif.equals("method")) {
1292+ String traceCmd = null;
1293+
1294+ if (t.hasMoreTokens()) {
1295+ String modif1 = t.nextToken();
1296+ if (modif1.equals("exits") || modif1.equals("exit")) {
1297+ if (t.hasMoreTokens()) {
1298+ threadInfo = doGetThread(t.nextToken());
1299+ }
1300+ if (modif1.equals("exit")) {
1301+ StackFrame frame;
1302+ try {
1303+ frame = ThreadInfo.getCurrentThreadInfo().getCurrentFrame();
1304+ } catch (IncompatibleThreadStateException ee) {
1305+ MessageOutput.println("Current thread isnt suspended.");
1306+ return;
1307+ }
1308+ Env.setAtExitMethod(frame.location().method());
1309+ traceCmd = MessageOutput.format("trace" +
1310+ goStr + "method exit " +
1311+ "in effect for",
1312+ Env.atExitMethod().toString());
1313+ } else {
1314+ traceCmd = MessageOutput.format("trace" +
1315+ goStr + "method exits " +
1316+ "in effect");
1317+ }
1318+ commandUntrace(new StringTokenizer("methods"));
1319+ turnOnExitTrace(threadInfo, suspendPolicy);
1320+ methodTraceCommand = traceCmd;
1321+ return;
1322+ }
1323+ } else {
1324+ MessageOutput.println("Can only trace");
1325+ return;
1326+ }
1327+ }
1328+ if (modif.equals("methods")) {
1329+ // Turn on method entry trace
1330+ MethodEntryRequest entry;
1331+ EventRequestManager erm = Env.vm().eventRequestManager();
1332+ if (t.hasMoreTokens()) {
1333+ threadInfo = doGetThread(t.nextToken());
1334+ }
1335+ if (threadInfo != null) {
1336+ /*
1337+ * To keep things simple we want each 'trace' to cancel
1338+ * previous traces. However in this case, we don't do that
1339+ * to preserve backward compatibility with pre JDK 6.0.
1340+ * IE, you can currently do
1341+ * trace methods 0x21
1342+ * trace methods 0x22
1343+ * and you will get xxx traced just on those two threads
1344+ * But this feature is kind of broken because if you then do
1345+ * untrace 0x21
1346+ * it turns off both traces instead of just the one.
1347+ * Another bogosity is that if you do
1348+ * trace methods
1349+ * trace methods
1350+ * and you will get two traces.
1351+ */
1352+
1353+ entry = erm.createMethodEntryRequest();
1354+ entry.addThreadFilter(threadInfo.getThread());
1355+ } else {
1356+ commandUntrace(new StringTokenizer("methods"));
1357+ entry = erm.createMethodEntryRequest();
1358+ }
1359+ Env.addExcludes(entry);
1360+ entry.setSuspendPolicy(suspendPolicy);
1361+ entry.enable();
1362+ turnOnExitTrace(threadInfo, suspendPolicy);
1363+ methodTraceCommand = MessageOutput.format("trace" + goStr +
1364+ "methods in effect");
1365+
1366+ return;
1367+ }
1368+
1369+ MessageOutput.println("Can only trace");
1370+ return;
1371+ }
1372+
1373+ // trace all by itself.
1374+ if (methodTraceCommand != null) {
1375+ MessageOutput.printDirectln(methodTraceCommand);
1376+ }
1377+
1378+ // More trace lines can be added here.
1379+ }
1380+
1381+ void commandUntrace(StringTokenizer t) {
1382+ // untrace
1383+ // untrace methods
1384+
1385+ String modif = null;
1386+ EventRequestManager erm = Env.vm().eventRequestManager();
1387+ if (t.hasMoreTokens()) {
1388+ modif = t.nextToken();
1389+ }
1390+ if (modif == null || modif.equals("methods")) {
1391+ erm.deleteEventRequests(erm.methodEntryRequests());
1392+ erm.deleteEventRequests(erm.methodExitRequests());
1393+ Env.setAtExitMethod(null);
1394+ methodTraceCommand = null;
1395+ }
1396+ }
1397+
1398+ void commandList(StringTokenizer t) {
1399+ StackFrame frame = null;
1400+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
1401+ if (threadInfo == null) {
1402+ MessageOutput.println("No thread specified.");
1403+ return;
1404+ }
1405+ try {
1406+ frame = threadInfo.getCurrentFrame();
1407+ } catch (IncompatibleThreadStateException e) {
1408+ MessageOutput.println("Current thread isnt suspended.");
1409+ return;
1410+ }
1411+
1412+ if (frame == null) {
1413+ MessageOutput.println("No frames on the current call stack");
1414+ return;
1415+ }
1416+
1417+ Location loc = frame.location();
1418+ if (loc.method().isNative()) {
1419+ MessageOutput.println("Current method is native");
1420+ return;
1421+ }
1422+
1423+ String sourceFileName = null;
1424+ try {
1425+ sourceFileName = loc.sourceName();
1426+
1427+ ReferenceType refType = loc.declaringType();
1428+ int lineno = loc.lineNumber();
1429+
1430+ if (t.hasMoreTokens()) {
1431+ String id = t.nextToken();
1432+
1433+ // See if token is a line number.
1434+ try {
1435+ NumberFormat nf = NumberFormat.getNumberInstance();
1436+ nf.setParseIntegerOnly(true);
1437+ Number n = nf.parse(id);
1438+ lineno = n.intValue();
1439+ } catch (java.text.ParseException jtpe) {
1440+ // It isn't -- see if it's a method name.
1441+ List<Method> meths = refType.methodsByName(id);
1442+ if (meths == null || meths.size() == 0) {
1443+ MessageOutput.println("is not a valid line number or method name for",
1444+ new Object [] {id, refType.name()});
1445+ return;
1446+ } else if (meths.size() > 1) {
1447+ MessageOutput.println("is an ambiguous method name in",
1448+ new Object [] {id, refType.name()});
1449+ return;
1450+ }
1451+ loc = meths.get(0).location();
1452+ lineno = loc.lineNumber();
1453+ }
1454+ }
1455+ int startLine = Math.max(lineno - 4, 1);
1456+ int endLine = startLine + 9;
1457+ if (lineno < 0) {
1458+ MessageOutput.println("Line number information not available for");
1459+ } else if (Env.sourceLine(loc, lineno) == null) {
1460+ MessageOutput.println("is an invalid line number for",
1461+ new Object [] {new Integer (lineno),
1462+ refType.name()});
1463+ } else {
1464+ for (int i = startLine; i <= endLine; i++) {
1465+ String sourceLine = Env.sourceLine(loc, i);
1466+ if (sourceLine == null) {
1467+ break;
1468+ }
1469+ if (i == lineno) {
1470+ MessageOutput.println("source line number current line and line",
1471+ new Object [] {new Integer (i),
1472+ sourceLine});
1473+ } else {
1474+ MessageOutput.println("source line number and line",
1475+ new Object [] {new Integer (i),
1476+ sourceLine});
1477+ }
1478+ }
1479+ }
1480+ } catch (AbsentInformationException e) {
1481+ MessageOutput.println("No source information available for:", loc.toString());
1482+ } catch(FileNotFoundException exc) {
1483+ MessageOutput.println("Source file not found:", sourceFileName);
1484+ } catch(IOException exc) {
1485+ MessageOutput.println("I/O exception occurred:", exc.toString());
1486+ }
1487+ }
1488+
1489+ void commandLines(StringTokenizer t) { // Undocumented command: useful for testing
1490+ if (!t.hasMoreTokens()) {
1491+ MessageOutput.println("Specify class and method");
1492+ } else {
1493+ String idClass = t.nextToken();
1494+ String idMethod = t.hasMoreTokens() ? t.nextToken() : null;
1495+ try {
1496+ ReferenceType refType = Env.getReferenceTypeFromToken(idClass);
1497+ if (refType != null) {
1498+ List<Location> lines = null;
1499+ if (idMethod == null) {
1500+ lines = refType.allLineLocations();
1501+ } else {
1502+ for (Method method : refType.allMethods()) {
1503+ if (method.name().equals(idMethod)) {
1504+ lines = method.allLineLocations();
1505+ }
1506+ }
1507+ if (lines == null) {
1508+ MessageOutput.println("is not a valid method name", idMethod);
1509+ }
1510+ }
1511+ for (Location line : lines) {
1512+ MessageOutput.printDirectln(line.toString());// Special case: use printDirectln()
1513+ }
1514+ } else {
1515+ MessageOutput.println("is not a valid id or class name", idClass);
1516+ }
1517+ } catch (AbsentInformationException e) {
1518+ MessageOutput.println("Line number information not available for", idClass);
1519+ }
1520+ }
1521+ }
1522+
1523+ void commandClasspath(StringTokenizer t) {
1524+ if (Env.vm() instanceof PathSearchingVirtualMachine) {
1525+ PathSearchingVirtualMachine vm = (PathSearchingVirtualMachine)Env.vm();
1526+ MessageOutput.println("base directory:", vm.baseDirectory());
1527+ MessageOutput.println("classpath:", vm.classPath().toString());
1528+ MessageOutput.println("bootclasspath:", vm.bootClassPath().toString());
1529+ } else {
1530+ MessageOutput.println("The VM does not use paths");
1531+ }
1532+ }
1533+
1534+ /* Get or set the source file path list. */
1535+ void commandUse(StringTokenizer t) {
1536+ if (!t.hasMoreTokens()) {
1537+ MessageOutput.printDirectln(Env.getSourcePath());// Special case: use printDirectln()
1538+ } else {
1539+ /*
1540+ * Take the remainder of the command line, minus
1541+ * leading or trailing whitespace. Embedded
1542+ * whitespace is fine.
1543+ */
1544+ Env.setSourcePath(t.nextToken("").trim());
1545+ }
1546+ }
1547+
1548+ /* Print a stack variable */
1549+ private void printVar(LocalVariable var, Value value) {
1550+ MessageOutput.println("expr is value",
1551+ new Object [] {var.name(),
1552+ value == null ? "null" : value.toString()});
1553+ }
1554+
1555+ /* Print all local variables in current stack frame. */
1556+ void commandLocals() {
1557+ StackFrame frame;
1558+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
1559+ if (threadInfo == null) {
1560+ MessageOutput.println("No default thread specified:");
1561+ return;
1562+ }
1563+ try {
1564+ frame = threadInfo.getCurrentFrame();
1565+ if (frame == null) {
1566+ throw new AbsentInformationException();
1567+ }
1568+ List<LocalVariable> vars = frame.visibleVariables();
1569+
1570+ if (vars.size() == 0) {
1571+ MessageOutput.println("No local variables");
1572+ return;
1573+ }
1574+ Map<LocalVariable, Value> values = frame.getValues(vars);
1575+
1576+ MessageOutput.println("Method arguments:");
1577+ for (LocalVariable var : vars) {
1578+ if (var.isArgument()) {
1579+ Value val = values.get(var);
1580+ printVar(var, val);
1581+ }
1582+ }
1583+ MessageOutput.println("Local variables:");
1584+ for (LocalVariable var : vars) {
1585+ if (!var.isArgument()) {
1586+ Value val = values.get(var);
1587+ printVar(var, val);
1588+ }
1589+ }
1590+ } catch (AbsentInformationException aie) {
1591+ MessageOutput.println("Local variable information not available.");
1592+ } catch (IncompatibleThreadStateException exc) {
1593+ MessageOutput.println("Current thread isnt suspended.");
1594+ }
1595+ }
1596+
1597+ private void dump(ObjectReference obj, ReferenceType refType,
1598+ ReferenceType refTypeBase) {
1599+ for (Field field : refType.fields()) {
1600+ StringBuffer o = new StringBuffer();
1601+ o.append(" ");
1602+ if (!refType.equals(refTypeBase)) {
1603+ o.append(refType.name());
1604+ o.append(".");
1605+ }
1606+ o.append(field.name());
1607+ o.append(MessageOutput.format("colon space"));
1608+ o.append(obj.getValue(field));
1609+ MessageOutput.printDirectln(o.toString()); // Special case: use printDirectln()
1610+ }
1611+ if (refType instanceof ClassType) {
1612+ ClassType sup = ((ClassType)refType).superclass();
1613+ if (sup != null) {
1614+ dump(obj, sup, refTypeBase);
1615+ }
1616+ } else if (refType instanceof InterfaceType) {
1617+ for (InterfaceType sup : ((InterfaceType)refType).superinterfaces()) {
1618+ dump(obj, sup, refTypeBase);
1619+ }
1620+ } else {
1621+ /* else refType is an instanceof ArrayType */
1622+ if (obj instanceof ArrayReference) {
1623+ for (Iterator<Value> it = ((ArrayReference)obj).getValues().iterator();
1624+ it.hasNext(); ) {
1625+ MessageOutput.printDirect(it.next().toString());// Special case: use printDirect()
1626+ if (it.hasNext()) {
1627+ MessageOutput.printDirect(", ");// Special case: use printDirect()
1628+ }
1629+ }
1630+ MessageOutput.println();
1631+ }
1632+ }
1633+ }
1634+
1635+ /* Print a specified reference.
1636+ */
1637+ void doPrint(StringTokenizer t, boolean dumpObject) {
1638+ if (!t.hasMoreTokens()) {
1639+ MessageOutput.println("No objects specified.");
1640+ return;
1641+ }
1642+
1643+ while (t.hasMoreTokens()) {
1644+ String expr = t.nextToken("");
1645+ Value val = evaluate(expr);
1646+ if (val == null) {
1647+ MessageOutput.println("expr is null", expr.toString());
1648+ } else if (dumpObject && (val instanceof ObjectReference) &&
1649+ !(val instanceof StringReference)) {
1650+ ObjectReference obj = (ObjectReference)val;
1651+ ReferenceType refType = obj.referenceType();
1652+ MessageOutput.println("expr is value",
1653+ new Object [] {expr.toString(),
1654+ MessageOutput.format("grouping begin character")});
1655+ dump(obj, refType, refType);
1656+ MessageOutput.println("grouping end character");
1657+ } else {
1658+ String strVal = getStringValue();
1659+ if (strVal != null) {
1660+ MessageOutput.println("expr is value", new Object [] {expr.toString(),
1661+ strVal});
1662+ }
1663+ }
1664+ }
1665+ }
1666+
1667+ void commandPrint(final StringTokenizer t, final boolean dumpObject) {
1668+ new AsyncExecution() {
1669+ @Override
1670+ void action() {
1671+ doPrint(t, dumpObject);
1672+ }
1673+ };
1674+ }
1675+
1676+ void commandSet(final StringTokenizer t) {
1677+ String all = t.nextToken("");
1678+
1679+ /*
1680+ * Bare bones error checking.
1681+ */
1682+ if (all.indexOf('=') == -1) {
1683+ MessageOutput.println("Invalid assignment syntax");
1684+ MessageOutput.printPrompt();
1685+ return;
1686+ }
1687+
1688+ /*
1689+ * The set command is really just syntactic sugar. Pass it on to the
1690+ * print command.
1691+ */
1692+ commandPrint(new StringTokenizer(all), false);
1693+ }
1694+
1695+ void doLock(StringTokenizer t) {
1696+ if (!t.hasMoreTokens()) {
1697+ MessageOutput.println("No object specified.");
1698+ return;
1699+ }
1700+
1701+ String expr = t.nextToken("");
1702+ Value val = evaluate(expr);
1703+
1704+ try {
1705+ if ((val != null) && (val instanceof ObjectReference)) {
1706+ ObjectReference object = (ObjectReference)val;
1707+ String strVal = getStringValue();
1708+ if (strVal != null) {
1709+ MessageOutput.println("Monitor information for expr",
1710+ new Object [] {expr.trim(),
1711+ strVal});
1712+ }
1713+ ThreadReference owner = object.owningThread();
1714+ if (owner == null) {
1715+ MessageOutput.println("Not owned");
1716+ } else {
1717+ MessageOutput.println("Owned by:",
1718+ new Object [] {owner.name(),
1719+ new Integer (object.entryCount())});
1720+ }
1721+ List<ThreadReference> waiters = object.waitingThreads();
1722+ if (waiters.size() == 0) {
1723+ MessageOutput.println("No waiters");
1724+ } else {
1725+ for (ThreadReference waiter : waiters) {
1726+ MessageOutput.println("Waiting thread:", waiter.name());
1727+ }
1728+ }
1729+ } else {
1730+ MessageOutput.println("Expression must evaluate to an object");
1731+ }
1732+ } catch (IncompatibleThreadStateException e) {
1733+ MessageOutput.println("Threads must be suspended");
1734+ }
1735+ }
1736+
1737+ void commandLock(final StringTokenizer t) {
1738+ new AsyncExecution() {
1739+ @Override
1740+ void action() {
1741+ doLock(t);
1742+ }
1743+ };
1744+ }
1745+
1746+ private void printThreadLockInfo(ThreadInfo threadInfo) {
1747+ ThreadReference thread = threadInfo.getThread();
1748+ try {
1749+ MessageOutput.println("Monitor information for thread", thread.name());
1750+ List<ObjectReference> owned = thread.ownedMonitors();
1751+ if (owned.size() == 0) {
1752+ MessageOutput.println("No monitors owned");
1753+ } else {
1754+ for (ObjectReference monitor : owned) {
1755+ MessageOutput.println("Owned monitor:", monitor.toString());
1756+ }
1757+ }
1758+ ObjectReference waiting = thread.currentContendedMonitor();
1759+ if (waiting == null) {
1760+ MessageOutput.println("Not waiting for a monitor");
1761+ } else {
1762+ MessageOutput.println("Waiting for monitor:", waiting.toString());
1763+ }
1764+ } catch (IncompatibleThreadStateException e) {
1765+ MessageOutput.println("Threads must be suspended");
1766+ }
1767+ }
1768+
1769+ void commandThreadlocks(final StringTokenizer t) {
1770+ if (!t.hasMoreTokens()) {
1771+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
1772+ if (threadInfo == null) {
1773+ MessageOutput.println("Current thread not set.");
1774+ } else {
1775+ printThreadLockInfo(threadInfo);
1776+ }
1777+ return;
1778+ }
1779+ String token = t.nextToken();
1780+ if (token.toLowerCase().equals("all")) {
1781+ for (ThreadInfo threadInfo : ThreadInfo.threads()) {
1782+ printThreadLockInfo(threadInfo);
1783+ }
1784+ } else {
1785+ ThreadInfo threadInfo = doGetThread(token);
1786+ if (threadInfo != null) {
1787+ ThreadInfo.setCurrentThreadInfo(threadInfo);
1788+ printThreadLockInfo(threadInfo);
1789+ }
1790+ }
1791+ }
1792+
1793+ void doDisableGC(StringTokenizer t) {
1794+ if (!t.hasMoreTokens()) {
1795+ MessageOutput.println("No object specified.");
1796+ return;
1797+ }
1798+
1799+ String expr = t.nextToken("");
1800+ Value val = evaluate(expr);
1801+ if ((val != null) && (val instanceof ObjectReference)) {
1802+ ObjectReference object = (ObjectReference)val;
1803+ object.disableCollection();
1804+ String strVal = getStringValue();
1805+ if (strVal != null) {
1806+ MessageOutput.println("GC Disabled for", strVal);
1807+ }
1808+ } else {
1809+ MessageOutput.println("Expression must evaluate to an object");
1810+ }
1811+ }
1812+
1813+ void commandDisableGC(final StringTokenizer t) {
1814+ new AsyncExecution() {
1815+ @Override
1816+ void action() {
1817+ doDisableGC(t);
1818+ }
1819+ };
1820+ }
1821+
1822+ void doEnableGC(StringTokenizer t) {
1823+ if (!t.hasMoreTokens()) {
1824+ MessageOutput.println("No object specified.");
1825+ return;
1826+ }
1827+
1828+ String expr = t.nextToken("");
1829+ Value val = evaluate(expr);
1830+ if ((val != null) && (val instanceof ObjectReference)) {
1831+ ObjectReference object = (ObjectReference)val;
1832+ object.enableCollection();
1833+ String strVal = getStringValue();
1834+ if (strVal != null) {
1835+ MessageOutput.println("GC Enabled for", strVal);
1836+ }
1837+ } else {
1838+ MessageOutput.println("Expression must evaluate to an object");
1839+ }
1840+ }
1841+
1842+ void commandEnableGC(final StringTokenizer t) {
1843+ new AsyncExecution() {
1844+ @Override
1845+ void action() {
1846+ doEnableGC(t);
1847+ }
1848+ };
1849+ }
1850+
1851+ void doSave(StringTokenizer t) {// Undocumented command: useful for testing.
1852+ if (!t.hasMoreTokens()) {
1853+ MessageOutput.println("No save index specified.");
1854+ return;
1855+ }
1856+
1857+ String key = t.nextToken();
1858+
1859+ if (!t.hasMoreTokens()) {
1860+ MessageOutput.println("No expression specified.");
1861+ return;
1862+ }
1863+ String expr = t.nextToken("");
1864+ Value val = evaluate(expr);
1865+ if (val != null) {
1866+ Env.setSavedValue(key, val);
1867+ String strVal = getStringValue();
1868+ if (strVal != null) {
1869+ MessageOutput.println("saved", strVal);
1870+ }
1871+ } else {
1872+ MessageOutput.println("Expression cannot be void");
1873+ }
1874+ }
1875+
1876+ void commandSave(final StringTokenizer t) { // Undocumented command: useful for testing.
1877+ if (!t.hasMoreTokens()) {
1878+ Set<String> keys = Env.getSaveKeys();
1879+ if (keys.isEmpty()) {
1880+ MessageOutput.println("No saved values");
1881+ return;
1882+ }
1883+ for (String key : keys) {
1884+ Value value = Env.getSavedValue(key);
1885+ if ((value instanceof ObjectReference) &&
1886+ ((ObjectReference)value).isCollected()) {
1887+ MessageOutput.println("expr is value <collected>",
1888+ new Object [] {key, value.toString()});
1889+ } else {
1890+ if (value == null){
1891+ MessageOutput.println("expr is null", key);
1892+ } else {
1893+ MessageOutput.println("expr is value",
1894+ new Object [] {key, value.toString()});
1895+ }
1896+ }
1897+ }
1898+ } else {
1899+ new AsyncExecution() {
1900+ @Override
1901+ void action() {
1902+ doSave(t);
1903+ }
1904+ };
1905+ }
1906+
1907+ }
1908+
1909+ void commandBytecodes(final StringTokenizer t) { // Undocumented command: useful for testing.
1910+ if (!t.hasMoreTokens()) {
1911+ MessageOutput.println("No class specified.");
1912+ return;
1913+ }
1914+ String className = t.nextToken();
1915+
1916+ if (!t.hasMoreTokens()) {
1917+ MessageOutput.println("No method specified.");
1918+ return;
1919+ }
1920+ // Overloading is not handled here.
1921+ String methodName = t.nextToken();
1922+
1923+ List<ReferenceType> classes = Env.vm().classesByName(className);
1924+ // TO DO: handle multiple classes found
1925+ if (classes.size() == 0) {
1926+ if (className.indexOf('.') < 0) {
1927+ MessageOutput.println("not found (try the full name)", className);
1928+ } else {
1929+ MessageOutput.println("not found", className);
1930+ }
1931+ return;
1932+ }
1933+
1934+ ReferenceType rt = classes.get(0);
1935+ if (!(rt instanceof ClassType)) {
1936+ MessageOutput.println("not a class", className);
1937+ return;
1938+ }
1939+
1940+ byte[] bytecodes = null;
1941+ for (Method method : rt.methodsByName(methodName)) {
1942+ if (!method.isAbstract()) {
1943+ bytecodes = method.bytecodes();
1944+ break;
1945+ }
1946+ }
1947+
1948+ StringBuffer line = new StringBuffer(80);
1949+ line.append("0000: ");
1950+ for (int i = 0; i < bytecodes.length; i++) {
1951+ if ((i > 0) && (i % 16 == 0)) {
1952+ MessageOutput.printDirectln(line.toString());// Special case: use printDirectln()
1953+ line.setLength(0);
1954+ line.append(String.valueOf(i));
1955+ line.append(": ");
1956+ int len = line.length();
1957+ for (int j = 0; j < 6 - len; j++) {
1958+ line.insert(0, '0');
1959+ }
1960+ }
1961+ int val = 0xff & bytecodes[i];
1962+ String str = Integer.toHexString(val);
1963+ if (str.length() == 1) {
1964+ line.append('0');
1965+ }
1966+ line.append(str);
1967+ line.append(' ');
1968+ }
1969+ if (line.length() > 6) {
1970+ MessageOutput.printDirectln(line.toString());// Special case: use printDirectln()
1971+ }
1972+ }
1973+
1974+ void commandExclude(StringTokenizer t) {
1975+ if (!t.hasMoreTokens()) {
1976+ MessageOutput.printDirectln(Env.excludesString());// Special case: use printDirectln()
1977+ } else {
1978+ String rest = t.nextToken("");
1979+ if (rest.equals("none")) {
1980+ rest = "";
1981+ }
1982+ Env.setExcludes(rest);
1983+ }
1984+ }
1985+
1986+ void commandRedefine(StringTokenizer t) {
1987+ if (!t.hasMoreTokens()) {
1988+ MessageOutput.println("Specify classes to redefine");
1989+ } else {
1990+ String className = t.nextToken();
1991+ List<ReferenceType> classes = Env.vm().classesByName(className);
1992+ if (classes.size() == 0) {
1993+ MessageOutput.println("No class named", className);
1994+ return;
1995+ }
1996+ if (classes.size() > 1) {
1997+ MessageOutput.println("More than one class named", className);
1998+ return;
1999+ }
2000+ Env.setSourcePath(Env.getSourcePath());
2001+ ReferenceType refType = classes.get(0);
2002+ if (!t.hasMoreTokens()) {
2003+ MessageOutput.println("Specify file name for class", className);
2004+ return;
2005+ }
2006+ String fileName = t.nextToken();
2007+ File phyl = new File(fileName);
2008+ byte[] bytes = new byte[(int)phyl.length()];
2009+ try {
2010+ InputStream in = new FileInputStream(phyl);
2011+ in.read(bytes);
2012+ in.close();
2013+ } catch (Exception exc) {
2014+ MessageOutput.println("Error reading file",
2015+ new Object [] {fileName, exc.toString()});
2016+ return;
2017+ }
2018+ Map<ReferenceType, byte[]> map
2019+ = new HashMap<ReferenceType, byte[]>();
2020+ map.put(refType, bytes);
2021+ try {
2022+ Env.vm().redefineClasses(map);
2023+ } catch (Throwable exc) {
2024+ MessageOutput.println("Error redefining class to file",
2025+ new Object [] {className,
2026+ fileName,
2027+ exc});
2028+ }
2029+ }
2030+ }
2031+
2032+ void commandPopFrames(StringTokenizer t, boolean reenter) {
2033+ ThreadInfo threadInfo;
2034+
2035+ if (t.hasMoreTokens()) {
2036+ String token = t.nextToken();
2037+ threadInfo = doGetThread(token);
2038+ if (threadInfo == null) {
2039+ return;
2040+ }
2041+ } else {
2042+ threadInfo = ThreadInfo.getCurrentThreadInfo();
2043+ if (threadInfo == null) {
2044+ MessageOutput.println("No thread specified.");
2045+ return;
2046+ }
2047+ }
2048+
2049+ try {
2050+ StackFrame frame = threadInfo.getCurrentFrame();
2051+ threadInfo.getThread().popFrames(frame);
2052+ threadInfo = ThreadInfo.getCurrentThreadInfo();
2053+ ThreadInfo.setCurrentThreadInfo(threadInfo);
2054+ if (reenter) {
2055+ commandStepi();
2056+ }
2057+ } catch (Throwable exc) {
2058+ MessageOutput.println("Error popping frame", exc.toString());
2059+ }
2060+ }
2061+
2062+ void commandExtension(StringTokenizer t) {
2063+ if (!t.hasMoreTokens()) {
2064+ MessageOutput.println("No class specified.");
2065+ return;
2066+ }
2067+
2068+ String idClass = t.nextToken();
2069+ ReferenceType cls = Env.getReferenceTypeFromToken(idClass);
2070+ String extension = null;
2071+ if (cls != null) {
2072+ try {
2073+ extension = cls.sourceDebugExtension();
2074+ MessageOutput.println("sourcedebugextension", extension);
2075+ } catch (AbsentInformationException e) {
2076+ MessageOutput.println("No sourcedebugextension specified");
2077+ }
2078+ } else {
2079+ MessageOutput.println("is not a valid id or class name", idClass);
2080+ }
2081+ }
2082+
2083+ void commandVersion(String debuggerName,
2084+ VirtualMachineManager vmm) {
2085+ MessageOutput.println("minus version",
2086+ new Object [] { debuggerName,
2087+ new Integer(vmm.majorInterfaceVersion()),
2088+ new Integer(vmm.minorInterfaceVersion()),
2089+ System.getProperty("java.version")});
2090+ if (Env.connection() != null) {
2091+ try {
2092+ MessageOutput.printDirectln(Env.vm().description());// Special case: use printDirectln()
2093+ } catch (VMNotConnectedException e) {
2094+ MessageOutput.println("No VM connected");
2095+ }
2096+ }
2097+ }
2098+}
java/pkg/com/sun/tools/example/debug/tty/Env.java+322−0
@@ -0,0 +1,322 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.request.StepRequest;
30+import com.sun.jdi.request.MethodEntryRequest;
31+import com.sun.jdi.request.MethodExitRequest;
32+import java.util.*;
33+import java.io.*;
34+
35+
36+class Env {
37+
38+ static EventRequestSpecList specList = new EventRequestSpecList();
39+
40+ private static VMConnection connection;
41+
42+ private static SourceMapper sourceMapper = new SourceMapper("");
43+ private static List<String> excludes;
44+
45+ private static final int SOURCE_CACHE_SIZE = 5;
46+ private static List<SourceCode> sourceCache = new LinkedList<SourceCode>();
47+
48+ private static HashMap<String, Value> savedValues = new HashMap<String, Value>();
49+ private static Method atExitMethod;
50+
51+ static void init(String connectSpec, boolean openNow, int flags) {
52+ connection = new VMConnection(connectSpec, flags);
53+ if (!connection.isLaunch() || openNow) {
54+ connection.open();
55+ }
56+ }
57+
58+ static VMConnection connection() {
59+ return connection;
60+ }
61+
62+ static VirtualMachine vm() {
63+ return connection.vm();
64+ }
65+
66+ static void shutdown() {
67+ shutdown(null);
68+ }
69+
70+ static void shutdown(String message) {
71+ if (connection != null) {
72+ try {
73+ connection.disposeVM();
74+ } catch (VMDisconnectedException e) {
75+ // Shutting down after the VM has gone away. This is
76+ // not an error, and we just ignore it.
77+ }
78+ }
79+ if (message != null) {
80+ MessageOutput.lnprint(message);
81+ MessageOutput.println();
82+ }
83+ System.exit(0);
84+ }
85+
86+ static void setSourcePath(String srcPath) {
87+ sourceMapper = new SourceMapper(srcPath);
88+ sourceCache.clear();
89+ }
90+
91+ static void setSourcePath(List<String> srcList) {
92+ sourceMapper = new SourceMapper(srcList);
93+ sourceCache.clear();
94+ }
95+
96+ static String getSourcePath() {
97+ return sourceMapper.getSourcePath();
98+ }
99+
100+ static private List<String> excludes() {
101+ if (excludes == null) {
102+ setExcludes("java.*, javax.*, sun.*, com.sun.*");
103+ }
104+ return excludes;
105+ }
106+
107+ static String excludesString() {
108+ StringBuffer buffer = new StringBuffer();
109+ for (String pattern : excludes()) {
110+ buffer.append(pattern);
111+ buffer.append(",");
112+ }
113+ return buffer.toString();
114+ }
115+
116+ static void addExcludes(StepRequest request) {
117+ for (String pattern : excludes()) {
118+ request.addClassExclusionFilter(pattern);
119+ }
120+ }
121+
122+ static void addExcludes(MethodEntryRequest request) {
123+ for (String pattern : excludes()) {
124+ request.addClassExclusionFilter(pattern);
125+ }
126+ }
127+
128+ static void addExcludes(MethodExitRequest request) {
129+ for (String pattern : excludes()) {
130+ request.addClassExclusionFilter(pattern);
131+ }
132+ }
133+
134+ static void setExcludes(String excludeString) {
135+ StringTokenizer t = new StringTokenizer(excludeString, " ,;");
136+ List<String> list = new ArrayList<String>();
137+ while (t.hasMoreTokens()) {
138+ list.add(t.nextToken());
139+ }
140+ excludes = list;
141+ }
142+
143+ static Method atExitMethod() {
144+ return atExitMethod;
145+ }
146+
147+ static void setAtExitMethod(Method mmm) {
148+ atExitMethod = mmm;
149+ }
150+
151+ /**
152+ * Return a Reader cooresponding to the source of this location.
153+ * Return null if not available.
154+ * Note: returned reader must be closed.
155+ */
156+ static BufferedReader sourceReader(Location location) {
157+ return sourceMapper.sourceReader(location);
158+ }
159+
160+ static synchronized String sourceLine(Location location, int lineNumber)
161+ throws IOException {
162+ if (lineNumber == -1) {
163+ throw new IllegalArgumentException();
164+ }
165+
166+ try {
167+ String fileName = location.sourceName();
168+
169+ Iterator<SourceCode> iter = sourceCache.iterator();
170+ SourceCode code = null;
171+ while (iter.hasNext()) {
172+ SourceCode candidate = iter.next();
173+ if (candidate.fileName().equals(fileName)) {
174+ code = candidate;
175+ iter.remove();
176+ break;
177+ }
178+ }
179+ if (code == null) {
180+ BufferedReader reader = sourceReader(location);
181+ if (reader == null) {
182+ throw new FileNotFoundException(fileName);
183+ }
184+ code = new SourceCode(fileName, reader);
185+ if (sourceCache.size() == SOURCE_CACHE_SIZE) {
186+ sourceCache.remove(sourceCache.size() - 1);
187+ }
188+ }
189+ sourceCache.add(0, code);
190+ return code.sourceLine(lineNumber);
191+ } catch (AbsentInformationException e) {
192+ throw new IllegalArgumentException();
193+ }
194+ }
195+
196+ /** Return a description of an object. */
197+ static String description(ObjectReference ref) {
198+ ReferenceType clazz = ref.referenceType();
199+ long id = ref.uniqueID();
200+ if (clazz == null) {
201+ return toHex(id);
202+ } else {
203+ return MessageOutput.format("object description and hex id",
204+ new Object [] {clazz.name(),
205+ toHex(id)});
206+ }
207+ }
208+
209+ /** Convert a long to a hexadecimal string. */
210+ static String toHex(long n) {
211+ char s1[] = new char[16];
212+ char s2[] = new char[18];
213+
214+ /* Store digits in reverse order. */
215+ int i = 0;
216+ do {
217+ long d = n & 0xf;
218+ s1[i++] = (char)((d < 10) ? ('0' + d) : ('a' + d - 10));
219+ } while ((n >>>= 4) > 0);
220+
221+ /* Now reverse the array. */
222+ s2[0] = '0';
223+ s2[1] = 'x';
224+ int j = 2;
225+ while (--i >= 0) {
226+ s2[j++] = s1[i];
227+ }
228+ return new String(s2, 0, j);
229+ }
230+
231+ /** Convert hexadecimal strings to longs. */
232+ static long fromHex(String hexStr) {
233+ String str = hexStr.startsWith("0x") ?
234+ hexStr.substring(2).toLowerCase() : hexStr.toLowerCase();
235+ if (hexStr.length() == 0) {
236+ throw new NumberFormatException();
237+ }
238+
239+ long ret = 0;
240+ for (int i = 0; i < str.length(); i++) {
241+ int c = str.charAt(i);
242+ if (c >= '0' && c <= '9') {
243+ ret = (ret * 16) + (c - '0');
244+ } else if (c >= 'a' && c <= 'f') {
245+ ret = (ret * 16) + (c - 'a' + 10);
246+ } else {
247+ throw new NumberFormatException();
248+ }
249+ }
250+ return ret;
251+ }
252+
253+ static ReferenceType getReferenceTypeFromToken(String idToken) {
254+ ReferenceType cls = null;
255+ if (Character.isDigit(idToken.charAt(0))) {
256+ cls = null;
257+ } else if (idToken.startsWith("*.")) {
258+ // This notation saves typing by letting the user omit leading
259+ // package names. The first
260+ // loaded class whose name matches this limited regular
261+ // expression is selected.
262+ idToken = idToken.substring(1);
263+ for (ReferenceType type : Env.vm().allClasses()) {
264+ if (type.name().endsWith(idToken)) {
265+ cls = type;
266+ break;
267+ }
268+ }
269+ } else {
270+ // It's a class name
271+ List<ReferenceType> classes = Env.vm().classesByName(idToken);
272+ if (classes.size() > 0) {
273+ // TO DO: handle multiples
274+ cls = classes.get(0);
275+ }
276+ }
277+ return cls;
278+ }
279+
280+ static Set<String> getSaveKeys() {
281+ return savedValues.keySet();
282+ }
283+
284+ static Value getSavedValue(String key) {
285+ return savedValues.get(key);
286+ }
287+
288+ static void setSavedValue(String key, Value value) {
289+ savedValues.put(key, value);
290+ }
291+
292+ static class SourceCode {
293+ private String fileName;
294+ private List<String> sourceLines = new ArrayList<String>();
295+
296+ SourceCode(String fileName, BufferedReader reader) throws IOException {
297+ this.fileName = fileName;
298+ try {
299+ String line = reader.readLine();
300+ while (line != null) {
301+ sourceLines.add(line);
302+ line = reader.readLine();
303+ }
304+ } finally {
305+ reader.close();
306+ }
307+ }
308+
309+ String fileName() {
310+ return fileName;
311+ }
312+
313+ String sourceLine(int number) {
314+ int index = number - 1; // list is 0-indexed
315+ if (index >= sourceLines.size()) {
316+ return null;
317+ } else {
318+ return sourceLines.get(index);
319+ }
320+ }
321+ }
322+}
java/pkg/com/sun/tools/example/debug/tty/EventHandler.java+277−0
@@ -0,0 +1,277 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.event.*;
30+import com.sun.jdi.request.EventRequest;
31+
32+public class EventHandler implements Runnable {
33+
34+ EventNotifier notifier;
35+ Thread thread;
36+ volatile boolean connected = true;
37+ boolean completed = false;
38+ String shutdownMessageKey;
39+ boolean stopOnVMStart;
40+
41+ EventHandler(EventNotifier notifier, boolean stopOnVMStart) {
42+ this.notifier = notifier;
43+ this.stopOnVMStart = stopOnVMStart;
44+ this.thread = new Thread(this, "event-handler");
45+ this.thread.start();
46+ }
47+
48+ synchronized void shutdown() {
49+ connected = false; // force run() loop termination
50+ thread.interrupt();
51+ while (!completed) {
52+ try {wait();} catch (InterruptedException exc) {}
53+ }
54+ }
55+
56+ @Override
57+ public void run() {
58+ EventQueue queue = Env.vm().eventQueue();
59+ while (connected) {
60+ try {
61+ EventSet eventSet = queue.remove();
62+ boolean resumeStoppedApp = false;
63+ EventIterator it = eventSet.eventIterator();
64+ while (it.hasNext()) {
65+ resumeStoppedApp |= !handleEvent(it.nextEvent());
66+ }
67+
68+ if (resumeStoppedApp) {
69+ eventSet.resume();
70+ } else if (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL) {
71+ setCurrentThread(eventSet);
72+ notifier.vmInterrupted();
73+ }
74+ } catch (InterruptedException exc) {
75+ // Do nothing. Any changes will be seen at top of loop.
76+ } catch (VMDisconnectedException discExc) {
77+ handleDisconnectedException();
78+ break;
79+ }
80+ }
81+ synchronized (this) {
82+ completed = true;
83+ notifyAll();
84+ }
85+ }
86+
87+ private boolean handleEvent(Event event) {
88+ notifier.receivedEvent(event);
89+
90+ if (event instanceof ExceptionEvent) {
91+ return exceptionEvent(event);
92+ } else if (event instanceof BreakpointEvent) {
93+ return breakpointEvent(event);
94+ } else if (event instanceof WatchpointEvent) {
95+ return fieldWatchEvent(event);
96+ } else if (event instanceof StepEvent) {
97+ return stepEvent(event);
98+ } else if (event instanceof MethodEntryEvent) {
99+ return methodEntryEvent(event);
100+ } else if (event instanceof MethodExitEvent) {
101+ return methodExitEvent(event);
102+ } else if (event instanceof ClassPrepareEvent) {
103+ return classPrepareEvent(event);
104+ } else if (event instanceof ClassUnloadEvent) {
105+ return classUnloadEvent(event);
106+ } else if (event instanceof ThreadStartEvent) {
107+ return threadStartEvent(event);
108+ } else if (event instanceof ThreadDeathEvent) {
109+ return threadDeathEvent(event);
110+ } else if (event instanceof VMStartEvent) {
111+ return vmStartEvent(event);
112+ } else {
113+ return handleExitEvent(event);
114+ }
115+ }
116+
117+ private boolean vmDied = false;
118+ private boolean handleExitEvent(Event event) {
119+ if (event instanceof VMDeathEvent) {
120+ vmDied = true;
121+ return vmDeathEvent(event);
122+ } else if (event instanceof VMDisconnectEvent) {
123+ connected = false;
124+ if (!vmDied) {
125+ vmDisconnectEvent(event);
126+ }
127+ Env.shutdown(shutdownMessageKey);
128+ return false;
129+ } else {
130+ throw new InternalError(MessageOutput.format("Unexpected event type",
131+ new Object[] {event.getClass()}));
132+ }
133+ }
134+
135+ synchronized void handleDisconnectedException() {
136+ /*
137+ * A VMDisconnectedException has happened while dealing with
138+ * another event. We need to flush the event queue, dealing only
139+ * with exit events (VMDeath, VMDisconnect) so that we terminate
140+ * correctly.
141+ */
142+ EventQueue queue = Env.vm().eventQueue();
143+ while (connected) {
144+ try {
145+ EventSet eventSet = queue.remove();
146+ EventIterator iter = eventSet.eventIterator();
147+ while (iter.hasNext()) {
148+ handleExitEvent(iter.next());
149+ }
150+ } catch (InterruptedException exc) {
151+ // ignore
152+ } catch (InternalError exc) {
153+ // ignore
154+ }
155+ }
156+ }
157+
158+ private ThreadReference eventThread(Event event) {
159+ if (event instanceof ClassPrepareEvent) {
160+ return ((ClassPrepareEvent)event).thread();
161+ } else if (event instanceof LocatableEvent) {
162+ return ((LocatableEvent)event).thread();
163+ } else if (event instanceof ThreadStartEvent) {
164+ return ((ThreadStartEvent)event).thread();
165+ } else if (event instanceof ThreadDeathEvent) {
166+ return ((ThreadDeathEvent)event).thread();
167+ } else if (event instanceof VMStartEvent) {
168+ return ((VMStartEvent)event).thread();
169+ } else {
170+ return null;
171+ }
172+ }
173+
174+ private void setCurrentThread(EventSet set) {
175+ ThreadReference thread;
176+ if (set.size() > 0) {
177+ /*
178+ * If any event in the set has a thread associated with it,
179+ * they all will, so just grab the first one.
180+ */
181+ Event event = set.iterator().next(); // Is there a better way?
182+ thread = eventThread(event);
183+ } else {
184+ thread = null;
185+ }
186+ setCurrentThread(thread);
187+ }
188+
189+ private void setCurrentThread(ThreadReference thread) {
190+ ThreadInfo.invalidateAll();
191+ ThreadInfo.setCurrentThread(thread);
192+ }
193+
194+ private boolean vmStartEvent(Event event) {
195+ VMStartEvent se = (VMStartEvent)event;
196+ notifier.vmStartEvent(se);
197+ return stopOnVMStart;
198+ }
199+
200+ private boolean breakpointEvent(Event event) {
201+ BreakpointEvent be = (BreakpointEvent)event;
202+ notifier.breakpointEvent(be);
203+ return true;
204+ }
205+
206+ private boolean methodEntryEvent(Event event) {
207+ MethodEntryEvent me = (MethodEntryEvent)event;
208+ notifier.methodEntryEvent(me);
209+ return true;
210+ }
211+
212+ private boolean methodExitEvent(Event event) {
213+ MethodExitEvent me = (MethodExitEvent)event;
214+ return notifier.methodExitEvent(me);
215+ }
216+
217+ private boolean fieldWatchEvent(Event event) {
218+ WatchpointEvent fwe = (WatchpointEvent)event;
219+ notifier.fieldWatchEvent(fwe);
220+ return true;
221+ }
222+
223+ private boolean stepEvent(Event event) {
224+ StepEvent se = (StepEvent)event;
225+ notifier.stepEvent(se);
226+ return true;
227+ }
228+
229+ private boolean classPrepareEvent(Event event) {
230+ ClassPrepareEvent cle = (ClassPrepareEvent)event;
231+ notifier.classPrepareEvent(cle);
232+
233+ if (!Env.specList.resolve(cle)) {
234+ MessageOutput.lnprint("Stopping due to deferred breakpoint errors.");
235+ return true;
236+ } else {
237+ return false;
238+ }
239+ }
240+
241+ private boolean classUnloadEvent(Event event) {
242+ ClassUnloadEvent cue = (ClassUnloadEvent)event;
243+ notifier.classUnloadEvent(cue);
244+ return false;
245+ }
246+
247+ private boolean exceptionEvent(Event event) {
248+ ExceptionEvent ee = (ExceptionEvent)event;
249+ notifier.exceptionEvent(ee);
250+ return true;
251+ }
252+
253+ private boolean threadDeathEvent(Event event) {
254+ ThreadDeathEvent tee = (ThreadDeathEvent)event;
255+ ThreadInfo.removeThread(tee.thread());
256+ return false;
257+ }
258+
259+ private boolean threadStartEvent(Event event) {
260+ ThreadStartEvent tse = (ThreadStartEvent)event;
261+ ThreadInfo.addThread(tse.thread());
262+ notifier.threadStartEvent(tse);
263+ return false;
264+ }
265+
266+ public boolean vmDeathEvent(Event event) {
267+ shutdownMessageKey = "The application exited";
268+ notifier.vmDeathEvent((VMDeathEvent)event);
269+ return false;
270+ }
271+
272+ public boolean vmDisconnectEvent(Event event) {
273+ shutdownMessageKey = "The application has been disconnected";
274+ notifier.vmDisconnectEvent((VMDisconnectEvent)event);
275+ return false;
276+ }
277+}
java/pkg/com/sun/tools/example/debug/tty/EventNotifier.java+50−0
@@ -0,0 +1,50 @@
1+/*
2+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.event.*;
29+
30+interface EventNotifier {
31+ void vmStartEvent(VMStartEvent e);
32+ void vmDeathEvent(VMDeathEvent e);
33+ void vmDisconnectEvent(VMDisconnectEvent e);
34+
35+ void threadStartEvent(ThreadStartEvent e);
36+ void threadDeathEvent(ThreadDeathEvent e);
37+
38+ void classPrepareEvent(ClassPrepareEvent e);
39+ void classUnloadEvent(ClassUnloadEvent e);
40+
41+ void breakpointEvent(BreakpointEvent e);
42+ void fieldWatchEvent(WatchpointEvent e);
43+ void stepEvent(StepEvent e);
44+ void exceptionEvent(ExceptionEvent e);
45+ void methodEntryEvent(MethodEntryEvent e);
46+ boolean methodExitEvent(MethodExitEvent e);
47+
48+ void vmInterrupted();
49+ void receivedEvent(Event event);
50+}
java/pkg/com/sun/tools/example/debug/tty/EventRequestSpec.java+210−0
@@ -0,0 +1,210 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.request.EventRequest;
30+import com.sun.jdi.request.ExceptionRequest;
31+import com.sun.jdi.request.ClassPrepareRequest;
32+import com.sun.jdi.event.ClassPrepareEvent;
33+import java.util.ArrayList;
34+
35+abstract class EventRequestSpec {
36+
37+ final ReferenceTypeSpec refSpec;
38+
39+ int suspendPolicy = EventRequest.SUSPEND_ALL;
40+
41+ EventRequest resolved = null;
42+ ClassPrepareRequest prepareRequest = null;
43+
44+ EventRequestSpec(ReferenceTypeSpec refSpec) {
45+ this.refSpec = refSpec;
46+ }
47+
48+ /**
49+ * The 'refType' is known to match, return the EventRequest.
50+ */
51+ abstract EventRequest resolveEventRequest(ReferenceType refType)
52+ throws Exception;
53+
54+ /**
55+ * @return If this EventRequestSpec matches the 'refType'
56+ * return the cooresponding EventRequest. Otherwise
57+ * return null.
58+ */
59+ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception {
60+ if ((resolved == null) &&
61+ (prepareRequest != null) &&
62+ prepareRequest.equals(event.request())) {
63+
64+ resolved = resolveEventRequest(event.referenceType());
65+ prepareRequest.disable();
66+ Env.vm().eventRequestManager().deleteEventRequest(prepareRequest);
67+ prepareRequest = null;
68+
69+ if (refSpec instanceof PatternReferenceTypeSpec) {
70+ PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
71+ if (! prs.isUnique()){
72+ /*
73+ * Class pattern event requests are never
74+ * considered "resolved", since future class loads
75+ * might also match.
76+ * Create and enable a new ClassPrepareRequest to
77+ * keep trying to resolve.
78+ */
79+ resolved = null;
80+ prepareRequest = refSpec.createPrepareRequest();
81+ prepareRequest.enable();
82+ }
83+ }
84+ }
85+ return resolved;
86+ }
87+
88+ synchronized void remove() {
89+ if (isResolved()) {
90+ Env.vm().eventRequestManager().deleteEventRequest(resolved());
91+ }
92+ if (refSpec instanceof PatternReferenceTypeSpec) {
93+ PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
94+ if (! prs.isUnique()){
95+ /*
96+ * This is a class pattern. Track down and delete
97+ * all EventRequests matching this spec.
98+ * Note: Class patterns apply only to ExceptionRequests,
99+ * so that is all we need to examine.
100+ */
101+ ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
102+ for (ExceptionRequest er :
103+ Env.vm().eventRequestManager().exceptionRequests()) {
104+ if (prs.matches(er.exception())) {
105+ deleteList.add (er);
106+ }
107+ }
108+ Env.vm().eventRequestManager().deleteEventRequests(deleteList);
109+ }
110+ }
111+ }
112+
113+ private EventRequest resolveAgainstPreparedClasses() throws Exception {
114+ for (ReferenceType refType : Env.vm().allClasses()) {
115+ if (refType.isPrepared() && refSpec.matches(refType)) {
116+ resolved = resolveEventRequest(refType);
117+ }
118+ }
119+ return resolved;
120+ }
121+
122+ synchronized EventRequest resolveEagerly() throws Exception {
123+ try {
124+ if (resolved == null) {
125+ /*
126+ * Not resolved. Schedule a prepare request so we
127+ * can resolve later.
128+ */
129+ prepareRequest = refSpec.createPrepareRequest();
130+ prepareRequest.enable();
131+
132+ // Try to resolve in case the class is already loaded.
133+ resolveAgainstPreparedClasses();
134+ if (resolved != null) {
135+ prepareRequest.disable();
136+ Env.vm().eventRequestManager().deleteEventRequest(prepareRequest);
137+ prepareRequest = null;
138+ }
139+ }
140+ if (refSpec instanceof PatternReferenceTypeSpec) {
141+ PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
142+ if (! prs.isUnique()){
143+ /*
144+ * Class pattern event requests are never
145+ * considered "resolved", since future class loads
146+ * might also match. Create a new
147+ * ClassPrepareRequest if necessary and keep
148+ * trying to resolve.
149+ */
150+ resolved = null;
151+ if (prepareRequest == null) {
152+ prepareRequest = refSpec.createPrepareRequest();
153+ prepareRequest.enable();
154+ }
155+ }
156+ }
157+ } catch (VMNotConnectedException e) {
158+ // Do nothing. Another resolve will be attempted when the
159+ // VM is started.
160+ }
161+ return resolved;
162+ }
163+
164+ /**
165+ * @return the eventRequest this spec has been resolved to,
166+ * null if so far unresolved.
167+ */
168+ EventRequest resolved() {
169+ return resolved;
170+ }
171+
172+ /**
173+ * @return true if this spec has been resolved.
174+ */
175+ boolean isResolved() {
176+ return resolved != null;
177+ }
178+
179+ protected boolean isJavaIdentifier(String s) {
180+ if (s.length() == 0) {
181+ return false;
182+ }
183+
184+ int cp = s.codePointAt(0);
185+ if (! Character.isJavaIdentifierStart(cp)) {
186+ return false;
187+ }
188+
189+ for (int i = Character.charCount(cp); i < s.length(); i += Character.charCount(cp)) {
190+ cp = s.codePointAt(i);
191+ if (! Character.isJavaIdentifierPart(cp)) {
192+ return false;
193+ }
194+ }
195+
196+ return true;
197+ }
198+
199+ String errorMessageFor(Exception e) {
200+ if (e instanceof IllegalArgumentException) {
201+ return (MessageOutput.format("Invalid command syntax"));
202+ } else if (e instanceof RuntimeException) {
203+ // A runtime exception that we were not expecting
204+ throw (RuntimeException)e;
205+ } else {
206+ return (MessageOutput.format("Internal error; unable to set",
207+ this.refSpec.toString()));
208+ }
209+ }
210+}
java/pkg/com/sun/tools/example/debug/tty/EventRequestSpecList.java+166−0
@@ -0,0 +1,166 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.request.EventRequest;
29+import com.sun.jdi.event.ClassPrepareEvent;
30+
31+import java.util.ArrayList;
32+import java.util.Collections;
33+import java.util.List;
34+
35+class EventRequestSpecList {
36+
37+ private static final int statusResolved = 1;
38+ private static final int statusUnresolved = 2;
39+ private static final int statusError = 3;
40+
41+ // all specs
42+ private List<EventRequestSpec> eventRequestSpecs = Collections.synchronizedList(
43+ new ArrayList<EventRequestSpec>());
44+
45+ EventRequestSpecList() {
46+ }
47+
48+ /**
49+ * Resolve all deferred eventRequests waiting for 'refType'.
50+ * @return true if it completes successfully, false on error.
51+ */
52+ boolean resolve(ClassPrepareEvent event) {
53+ boolean failure = false;
54+ synchronized(eventRequestSpecs) {
55+ for (EventRequestSpec spec : eventRequestSpecs) {
56+ if (!spec.isResolved()) {
57+ try {
58+ EventRequest eventRequest = spec.resolve(event);
59+ if (eventRequest != null) {
60+ MessageOutput.println("Set deferred", spec.toString());
61+ }
62+ } catch (Exception e) {
63+ MessageOutput.println("Unable to set deferred",
64+ new Object [] {spec.toString(),
65+ spec.errorMessageFor(e)});
66+ failure = true;
67+ }
68+ }
69+ }
70+ }
71+ return !failure;
72+ }
73+
74+ void resolveAll() {
75+ for (EventRequestSpec spec : eventRequestSpecs) {
76+ try {
77+ EventRequest eventRequest = spec.resolveEagerly();
78+ if (eventRequest != null) {
79+ MessageOutput.println("Set deferred", spec.toString());
80+ }
81+ } catch (Exception e) {
82+ }
83+ }
84+ }
85+
86+ boolean addEagerlyResolve(EventRequestSpec spec) {
87+ try {
88+ eventRequestSpecs.add(spec);
89+ EventRequest eventRequest = spec.resolveEagerly();
90+ if (eventRequest != null) {
91+ MessageOutput.println("Set", spec.toString());
92+ }
93+ return true;
94+ } catch (Exception exc) {
95+ MessageOutput.println("Unable to set",
96+ new Object [] {spec.toString(),
97+ spec.errorMessageFor(exc)});
98+ return false;
99+ }
100+ }
101+
102+ BreakpointSpec createBreakpoint(String classPattern, int line)
103+ throws ClassNotFoundException {
104+ ReferenceTypeSpec refSpec =
105+ new PatternReferenceTypeSpec(classPattern);
106+ return new BreakpointSpec(refSpec, line);
107+ }
108+
109+ BreakpointSpec createBreakpoint(String classPattern,
110+ String methodId,
111+ List<String> methodArgs)
112+ throws MalformedMemberNameException,
113+ ClassNotFoundException {
114+ ReferenceTypeSpec refSpec =
115+ new PatternReferenceTypeSpec(classPattern);
116+ return new BreakpointSpec(refSpec, methodId, methodArgs);
117+ }
118+
119+ EventRequestSpec createExceptionCatch(String classPattern,
120+ boolean notifyCaught,
121+ boolean notifyUncaught)
122+ throws ClassNotFoundException {
123+ ReferenceTypeSpec refSpec =
124+ new PatternReferenceTypeSpec(classPattern);
125+ return new ExceptionSpec(refSpec, notifyCaught, notifyUncaught);
126+ }
127+
128+ WatchpointSpec createAccessWatchpoint(String classPattern,
129+ String fieldId)
130+ throws MalformedMemberNameException,
131+ ClassNotFoundException {
132+ ReferenceTypeSpec refSpec =
133+ new PatternReferenceTypeSpec(classPattern);
134+ return new AccessWatchpointSpec(refSpec, fieldId);
135+ }
136+
137+ WatchpointSpec createModificationWatchpoint(String classPattern,
138+ String fieldId)
139+ throws MalformedMemberNameException,
140+ ClassNotFoundException {
141+ ReferenceTypeSpec refSpec =
142+ new PatternReferenceTypeSpec(classPattern);
143+ return new ModificationWatchpointSpec(refSpec, fieldId);
144+ }
145+
146+ boolean delete(EventRequestSpec proto) {
147+ synchronized (eventRequestSpecs) {
148+ int inx = eventRequestSpecs.indexOf(proto);
149+ if (inx != -1) {
150+ EventRequestSpec spec = eventRequestSpecs.get(inx);
151+ spec.remove();
152+ eventRequestSpecs.remove(inx);
153+ return true;
154+ } else {
155+ return false;
156+ }
157+ }
158+ }
159+
160+ List<EventRequestSpec> eventRequestSpecs() {
161+ // We need to make a copy to avoid synchronization problems
162+ synchronized (eventRequestSpecs) {
163+ return new ArrayList<EventRequestSpec>(eventRequestSpecs);
164+ }
165+ }
166+}
java/pkg/com/sun/tools/example/debug/tty/ExceptionSpec.java+107−0
@@ -0,0 +1,107 @@
1+/*
2+ * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.ReferenceType;
29+import com.sun.jdi.request.*;
30+
31+class ExceptionSpec extends EventRequestSpec {
32+ private boolean notifyCaught;
33+ private boolean notifyUncaught;
34+
35+ private ExceptionSpec(ReferenceTypeSpec refSpec) {
36+ this(refSpec, true, true);
37+ }
38+
39+ ExceptionSpec(ReferenceTypeSpec refSpec,
40+ boolean notifyCaught,
41+ boolean notifyUncaught) {
42+ super(refSpec);
43+ this.notifyCaught = notifyCaught;
44+ this.notifyUncaught = notifyUncaught;
45+ }
46+
47+ /**
48+ * The 'refType' is known to match, return the EventRequest.
49+ */
50+ @Override
51+ EventRequest resolveEventRequest(ReferenceType refType) {
52+ EventRequestManager em = refType.virtualMachine().eventRequestManager();
53+ ExceptionRequest excReq = em.createExceptionRequest(refType,
54+ notifyCaught,
55+ notifyUncaught);
56+ excReq.enable();
57+ return excReq;
58+ }
59+
60+ public boolean notifyCaught() {
61+ return notifyCaught;
62+ }
63+
64+ public boolean notifyUncaught() {
65+ return notifyUncaught;
66+ }
67+
68+ @Override
69+ public int hashCode() {
70+ //Reference: Effective Java[tm] (Bloch, 2001), Item 8
71+ int result = 17;
72+ result = (37 * result) + (notifyCaught() ? 0: 1);
73+ result = (37 * result) + (notifyUncaught() ? 0: 1);
74+ result = (37 * result) + refSpec.hashCode();
75+ return result;
76+ }
77+
78+ @Override
79+ public boolean equals(Object obj) {
80+ if (obj instanceof ExceptionSpec) {
81+ ExceptionSpec es = (ExceptionSpec)obj;
82+
83+ if (refSpec.equals(es.refSpec) &&
84+ (this.notifyCaught() == es.notifyCaught()) &&
85+ (this.notifyUncaught() == es.notifyUncaught())) {
86+ return true;
87+ }
88+ }
89+ return false;
90+ }
91+
92+ @Override
93+ public String toString() {
94+ String s;
95+ if (notifyCaught && !notifyUncaught) {
96+ s = MessageOutput.format("exceptionSpec caught",
97+ refSpec.toString());
98+ } else if (notifyUncaught && !notifyCaught) {
99+ s = MessageOutput.format("exceptionSpec uncaught",
100+ refSpec.toString());
101+ } else {
102+ s = MessageOutput.format("exceptionSpec all",
103+ refSpec.toString());
104+ }
105+ return s;
106+ }
107+}
java/pkg/com/sun/tools/example/debug/tty/LineNotFoundException.java+41−0
@@ -0,0 +1,41 @@
1+/*
2+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+public class LineNotFoundException extends Exception
29+{
30+ private static final long serialVersionUID = 3748297722519448995L;
31+
32+ public LineNotFoundException()
33+ {
34+ super();
35+ }
36+
37+ public LineNotFoundException(String s)
38+ {
39+ super(s);
40+ }
41+}
java/pkg/com/sun/tools/example/debug/tty/MalformedMemberNameException.java+38−0
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+class MalformedMemberNameException extends Exception {
29+ private static final long serialVersionUID = 7759071468833196630L;
30+
31+ public MalformedMemberNameException() {
32+ super();
33+ }
34+
35+ public MalformedMemberNameException(String s) {
36+ super(s);
37+ }
38+}
java/pkg/com/sun/tools/example/debug/tty/MessageOutput.java+196−0
@@ -0,0 +1,196 @@
1+/*
2+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+package com.sun.tools.example.debug.tty;
26+
27+import java.util.*;
28+import java.text.MessageFormat;
29+/**
30+ * Internationalization (i18n) convenience methods for jdb.
31+ *
32+ * All program output should flow through these methods, and this is
33+ * the only class that should be printing directly or otherwise
34+ * accessing System.[out,err].
35+ *
36+ * @bug 4348376
37+ * @author Tim Bell
38+ */
39+public class MessageOutput {
40+ /**
41+ * The resource bundle containing localizable message content.
42+ * This is loaded by TTY.main() at start-up
43+ */
44+ static ResourceBundle textResources;
45+
46+ /** Our message formatter. Allocated once, used many times */
47+ private static MessageFormat messageFormat;
48+
49+ /**
50+ * Fatal shutdown notification. This is sent to System.err
51+ * instead of System.out
52+ */
53+ static void fatalError(String messageKey) {
54+ System.err.println();
55+ System.err.println(format("Fatal error"));
56+ System.err.println(format(messageKey));
57+ Env.shutdown();
58+ }
59+
60+ /**
61+ * "Format" a string by doing a simple key lookup.
62+ */
63+ static String format(String key) {
64+ return (textResources.getString(key));
65+ }
66+
67+ /**
68+ * Fetch and format a message with one string argument.
69+ * This is the most common usage.
70+ */
71+ static String format(String key, String argument) {
72+ return format(key, new Object [] {argument});
73+ }
74+
75+ /**
76+ * Fetch a string by key lookup and format in the arguments.
77+ */
78+ static synchronized String format(String key, Object [] arguments) {
79+ if (messageFormat == null) {
80+ messageFormat = new MessageFormat (textResources.getString(key));
81+ } else {
82+ messageFormat.applyPattern (textResources.getString(key));
83+ }
84+ return (messageFormat.format (arguments));
85+ }
86+
87+ /**
88+ * Print directly to System.out.
89+ * Every rule has a few exceptions.
90+ * The exceptions to "must use the MessageOutput formatters" are:
91+ * VMConnection.dumpStream()
92+ * TTY.monitorCommand()
93+ * TTY.TTY() (for the '!!' command only)
94+ * Commands.java (multiple locations)
95+ * These are the only sites that should be calling this
96+ * method.
97+ */
98+ static void printDirectln(String line) {
99+ System.out.println(line);
100+ }
101+ static void printDirect(String line) {
102+ System.out.print(line);
103+ }
104+ static void printDirect(char c) {
105+ System.out.print(c);
106+ }
107+
108+ /**
109+ * Print a newline.
110+ * Use this instead of '\n'
111+ */
112+ static void println() {
113+ System.out.println();
114+ }
115+
116+ /**
117+ * Format and print a simple string.
118+ */
119+ static void print(String key) {
120+ System.out.print(format(key));
121+ }
122+ /**
123+ * Format and print a simple string.
124+ */
125+ static void println(String key) {
126+ System.out.println(format(key));
127+ }
128+
129+
130+ /**
131+ * Fetch, format and print a message with one string argument.
132+ * This is the most common usage.
133+ */
134+ static void print(String key, String argument) {
135+ System.out.print(format(key, argument));
136+ }
137+ static void println(String key, String argument) {
138+ System.out.println(format(key, argument));
139+ }
140+
141+ /**
142+ * Fetch, format and print a message with an arbitrary
143+ * number of message arguments.
144+ */
145+ static void println(String key, Object [] arguments) {
146+ System.out.println(format(key, arguments));
147+ }
148+
149+ /**
150+ * Print a newline, followed by the string.
151+ */
152+ static void lnprint(String key) {
153+ System.out.println();
154+ System.out.print(textResources.getString(key));
155+ }
156+
157+ static void lnprint(String key, String argument) {
158+ System.out.println();
159+ System.out.print(format(key, argument));
160+ }
161+
162+ static void lnprint(String key, Object [] arguments) {
163+ System.out.println();
164+ System.out.print(format(key, arguments));
165+ }
166+
167+ /**
168+ * Print an exception message with a stack trace.
169+ */
170+ static void printException(String key, Exception e) {
171+ if (key != null) {
172+ try {
173+ println(key);
174+ } catch (MissingResourceException mex) {
175+ printDirectln(key);
176+ }
177+ }
178+ System.out.flush();
179+ e.printStackTrace();
180+ }
181+
182+ static void printPrompt() {
183+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
184+ if (threadInfo == null) {
185+ System.out.print
186+ (MessageOutput.format("jdb prompt with no current thread"));
187+ } else {
188+ System.out.print
189+ (MessageOutput.format("jdb prompt thread name and current stack frame",
190+ new Object [] {
191+ threadInfo.getThread().name(),
192+ new Integer (threadInfo.getCurrentFrameIndex() + 1)}));
193+ }
194+ System.out.flush();
195+ }
196+}
java/pkg/com/sun/tools/example/debug/tty/ModificationWatchpointSpec.java+58−0
@@ -0,0 +1,58 @@
1+/*
2+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.request.EventRequestManager;
30+import com.sun.jdi.request.EventRequest;
31+
32+class ModificationWatchpointSpec extends WatchpointSpec {
33+ ModificationWatchpointSpec(ReferenceTypeSpec refSpec, String fieldId)
34+ throws MalformedMemberNameException {
35+ super(refSpec, fieldId);
36+ }
37+
38+ /**
39+ * The 'refType' is known to match, return the EventRequest.
40+ */
41+ @Override
42+ EventRequest resolveEventRequest(ReferenceType refType)
43+ throws NoSuchFieldException {
44+ Field field = refType.fieldByName(fieldId);
45+ EventRequestManager em = refType.virtualMachine().eventRequestManager();
46+ EventRequest wp = em.createModificationWatchpointRequest(field);
47+ wp.setSuspendPolicy(suspendPolicy);
48+ wp.enable();
49+ return wp;
50+ }
51+
52+ @Override
53+ public String toString() {
54+ return MessageOutput.format("watch modification of",
55+ new Object [] {refSpec.toString(),
56+ fieldId});
57+ }
58+}
java/pkg/com/sun/tools/example/debug/tty/PatternReferenceTypeSpec.java+136−0
@@ -0,0 +1,136 @@
1+/*
2+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.request.ClassPrepareRequest;
30+import java.util.StringTokenizer;
31+
32+
33+class PatternReferenceTypeSpec implements ReferenceTypeSpec {
34+ final String classId;
35+ String stem;
36+
37+ PatternReferenceTypeSpec(String classId) throws ClassNotFoundException {
38+ this.classId = classId;
39+ stem = classId;
40+ if (classId.startsWith("*")) {
41+ stem = stem.substring(1);
42+ } else if (classId.endsWith("*")) {
43+ stem = stem.substring(0, classId.length() - 1);
44+ }
45+ checkClassName(stem);
46+ }
47+
48+ /**
49+ * Is this spec unique or is it a class pattern?
50+ */
51+ public boolean isUnique() {
52+ return classId.equals(stem);
53+ }
54+
55+ /**
56+ * Does the specified ReferenceType match this spec.
57+ */
58+ @Override
59+ public boolean matches(ReferenceType refType) {
60+ if (classId.startsWith("*")) {
61+ return refType.name().endsWith(stem);
62+ } else if (classId.endsWith("*")) {
63+ return refType.name().startsWith(stem);
64+ } else {
65+ return refType.name().equals(classId);
66+ }
67+ }
68+
69+ @Override
70+ public ClassPrepareRequest createPrepareRequest() {
71+ ClassPrepareRequest request =
72+ Env.vm().eventRequestManager().createClassPrepareRequest();
73+ request.addClassFilter(classId);
74+ request.addCountFilter(1);
75+ return request;
76+ }
77+
78+ @Override
79+ public int hashCode() {
80+ return classId.hashCode();
81+ }
82+
83+ @Override
84+ public boolean equals(Object obj) {
85+ if (obj instanceof PatternReferenceTypeSpec) {
86+ PatternReferenceTypeSpec spec = (PatternReferenceTypeSpec)obj;
87+
88+ return classId.equals(spec.classId);
89+ } else {
90+ return false;
91+ }
92+ }
93+
94+ private void checkClassName(String className) throws ClassNotFoundException {
95+ // Do stricter checking of class name validity on deferred
96+ // because if the name is invalid, it will
97+ // never match a future loaded class, and we'll be silent
98+ // about it.
99+ StringTokenizer tokenizer = new StringTokenizer(className, ".");
100+ while (tokenizer.hasMoreTokens()) {
101+ String token = tokenizer.nextToken();
102+ // Each dot-separated piece must be a valid identifier
103+ // and the first token can also be "*". (Note that
104+ // numeric class ids are not permitted. They must
105+ // match a loaded class.)
106+ if (!isJavaIdentifier(token)) {
107+ throw new ClassNotFoundException();
108+ }
109+ }
110+ }
111+
112+ private boolean isJavaIdentifier(String s) {
113+ if (s.length() == 0) {
114+ return false;
115+ }
116+
117+ int cp = s.codePointAt(0);
118+ if (! Character.isJavaIdentifierStart(cp)) {
119+ return false;
120+ }
121+
122+ for (int i = Character.charCount(cp); i < s.length(); i += Character.charCount(cp)) {
123+ cp = s.codePointAt(i);
124+ if (! Character.isJavaIdentifierPart(cp)) {
125+ return false;
126+ }
127+ }
128+
129+ return true;
130+ }
131+
132+ @Override
133+ public String toString() {
134+ return classId;
135+ }
136+}
java/pkg/com/sun/tools/example/debug/tty/ReferenceTypeSpec.java+43−0
@@ -0,0 +1,43 @@
1+/*
2+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.request.ClassPrepareRequest;
30+
31+interface ReferenceTypeSpec {
32+ /**
33+ * Does the specified ReferenceType match this spec.
34+ */
35+ boolean matches(ReferenceType refType);
36+ ClassPrepareRequest createPrepareRequest();
37+
38+ @Override
39+ int hashCode();
40+
41+ @Override
42+ boolean equals(Object obj);
43+}
java/pkg/com/sun/tools/example/debug/tty/SourceMapper.java+138−0
@@ -0,0 +1,138 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.Location;
29+import com.sun.jdi.AbsentInformationException;
30+import java.util.List;
31+import java.util.ArrayList;
32+import java.util.StringTokenizer;
33+import java.io.*;
34+
35+class SourceMapper {
36+
37+ private final String[] dirs;
38+
39+ SourceMapper(List<String> sourcepath) {
40+ /*
41+ * sourcepath can arrive from the debugee as a List.
42+ * (via PathSearchingVirtualMachine.classPath())
43+ */
44+ List<String> dirList = new ArrayList<String>();
45+ for (String element : sourcepath) {
46+ //XXX remove .jar and .zip files; we want only directories on
47+ //the source path. (Bug ID 4186582)
48+ if ( ! (element.endsWith(".jar") ||
49+ element.endsWith(".zip"))) {
50+ dirList.add(element);
51+ }
52+ }
53+ dirs = dirList.toArray(new String[0]);
54+ }
55+
56+ SourceMapper(String sourcepath) {
57+ /*
58+ * sourcepath can also arrive from the command line
59+ * as a String. (via "-sourcepath")
60+ *
61+ * Using File.pathSeparator as delimiter below is OK
62+ * because we are on the same machine as the command
63+ * line originiated.
64+ */
65+ StringTokenizer st = new StringTokenizer(sourcepath,
66+ File.pathSeparator);
67+ List<String> dirList = new ArrayList<String>();
68+ while (st.hasMoreTokens()) {
69+ String s = st.nextToken();
70+ //XXX remove .jar and .zip files; we want only directories on
71+ //the source path. (Bug ID 4186582)
72+ if ( ! (s.endsWith(".jar") ||
73+ s.endsWith(".zip"))) {
74+ dirList.add(s);
75+ }
76+ }
77+ dirs = dirList.toArray(new String[0]);
78+ }
79+
80+ /*
81+ * Return the current sourcePath as a String.
82+ */
83+ String getSourcePath() {
84+ int i = 0;
85+ StringBuffer sp;
86+ if (dirs.length < 1) {
87+ return ""; //The source path is empty.
88+ } else {
89+ sp = new StringBuffer(dirs[i++]);
90+ }
91+ for (; i < dirs.length; i++) {
92+ sp.append(File.pathSeparator);
93+ sp.append(dirs[i]);
94+ }
95+ return sp.toString();
96+ }
97+
98+ /**
99+ * Return a File cooresponding to the source of this location.
100+ * Return null if not available.
101+ */
102+ File sourceFile(Location loc) {
103+ try {
104+ String filename = loc.sourceName();
105+ String refName = loc.declaringType().name();
106+ int iDot = refName.lastIndexOf('.');
107+ String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
108+ String full = pkgName.replace('.', File.separatorChar) + filename;
109+ for (int i= 0; i < dirs.length; ++i) {
110+ File path = new File(dirs[i], full);
111+ if (path.exists()) {
112+ return path;
113+ }
114+ }
115+ return null;
116+ } catch (AbsentInformationException e) {
117+ return null;
118+ }
119+ }
120+
121+ /**
122+ * Return a BufferedReader cooresponding to the source
123+ * of this location.
124+ * Return null if not available.
125+ * Note: returned reader must be closed.
126+ */
127+ BufferedReader sourceReader(Location loc) {
128+ File sourceFile = sourceFile(loc);
129+ if (sourceFile == null) {
130+ return null;
131+ }
132+ try {
133+ return new BufferedReader(new FileReader(sourceFile));
134+ } catch(IOException exc) {
135+ }
136+ return null;
137+ }
138+}
java/pkg/com/sun/tools/example/debug/tty/TTY.java+1063−0
@@ -0,0 +1,1063 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.event.*;
30+import com.sun.jdi.request.*;
31+import com.sun.jdi.connect.*;
32+
33+import java.util.*;
34+import java.io.*;
35+
36+public class TTY implements EventNotifier {
37+ EventHandler handler = null;
38+
39+ /**
40+ * List of Strings to execute at each stop.
41+ */
42+ private List<String> monitorCommands = new ArrayList<String>();
43+ private int monitorCount = 0;
44+
45+ /**
46+ * The name of this tool.
47+ */
48+ private static final String progname = "jdb";
49+
50+ @Override
51+ public void vmStartEvent(VMStartEvent se) {
52+ Thread.yield(); // fetch output
53+ MessageOutput.lnprint("VM Started:");
54+ }
55+
56+ @Override
57+ public void vmDeathEvent(VMDeathEvent e) {
58+ }
59+
60+ @Override
61+ public void vmDisconnectEvent(VMDisconnectEvent e) {
62+ }
63+
64+ @Override
65+ public void threadStartEvent(ThreadStartEvent e) {
66+ }
67+
68+ @Override
69+ public void threadDeathEvent(ThreadDeathEvent e) {
70+ }
71+
72+ @Override
73+ public void classPrepareEvent(ClassPrepareEvent e) {
74+ }
75+
76+ @Override
77+ public void classUnloadEvent(ClassUnloadEvent e) {
78+ }
79+
80+ @Override
81+ public void breakpointEvent(BreakpointEvent be) {
82+ Thread.yield(); // fetch output
83+ MessageOutput.lnprint("Breakpoint hit:");
84+ }
85+
86+ @Override
87+ public void fieldWatchEvent(WatchpointEvent fwe) {
88+ Field field = fwe.field();
89+ ObjectReference obj = fwe.object();
90+ Thread.yield(); // fetch output
91+
92+ if (fwe instanceof ModificationWatchpointEvent) {
93+ MessageOutput.lnprint("Field access encountered before after",
94+ new Object [] {field,
95+ fwe.valueCurrent(),
96+ ((ModificationWatchpointEvent)fwe).valueToBe()});
97+ } else {
98+ MessageOutput.lnprint("Field access encountered", field.toString());
99+ }
100+ }
101+
102+ @Override
103+ public void stepEvent(StepEvent se) {
104+ Thread.yield(); // fetch output
105+ MessageOutput.lnprint("Step completed:");
106+ }
107+
108+ @Override
109+ public void exceptionEvent(ExceptionEvent ee) {
110+ Thread.yield(); // fetch output
111+ Location catchLocation = ee.catchLocation();
112+ if (catchLocation == null) {
113+ MessageOutput.lnprint("Exception occurred uncaught",
114+ ee.exception().referenceType().name());
115+ } else {
116+ MessageOutput.lnprint("Exception occurred caught",
117+ new Object [] {ee.exception().referenceType().name(),
118+ Commands.locationString(catchLocation)});
119+ }
120+ }
121+
122+ @Override
123+ public void methodEntryEvent(MethodEntryEvent me) {
124+ Thread.yield(); // fetch output
125+ /*
126+ * These can be very numerous, so be as efficient as possible.
127+ * If we are stopping here, then we will see the normal location
128+ * info printed.
129+ */
130+ if (me.request().suspendPolicy() != EventRequest.SUSPEND_NONE) {
131+ // We are stopping; the name will be shown by the normal mechanism
132+ MessageOutput.lnprint("Method entered:");
133+ } else {
134+ // We aren't stopping, show the name
135+ MessageOutput.print("Method entered:");
136+ printLocationOfEvent(me);
137+ }
138+ }
139+
140+ @Override
141+ public boolean methodExitEvent(MethodExitEvent me) {
142+ Thread.yield(); // fetch output
143+ /*
144+ * These can be very numerous, so be as efficient as possible.
145+ */
146+ Method mmm = Env.atExitMethod();
147+ Method meMethod = me.method();
148+
149+ if (mmm == null || mmm.equals(meMethod)) {
150+ // Either we are not tracing a specific method, or we are
151+ // and we are exitting that method.
152+
153+ if (me.request().suspendPolicy() != EventRequest.SUSPEND_NONE) {
154+ // We will be stopping here, so do a newline
155+ MessageOutput.println();
156+ }
157+ if (Env.vm().canGetMethodReturnValues()) {
158+ MessageOutput.print("Method exitedValue:", me.returnValue() + "");
159+ } else {
160+ MessageOutput.print("Method exited:");
161+ }
162+
163+ if (me.request().suspendPolicy() == EventRequest.SUSPEND_NONE) {
164+ // We won't be stopping here, so show the method name
165+ printLocationOfEvent(me);
166+
167+ }
168+
169+ // In case we want to have a one shot trace exit some day, this
170+ // code disables the request so we don't hit it again.
171+ if (false) {
172+ // This is a one shot deal; we don't want to stop
173+ // here the next time.
174+ Env.setAtExitMethod(null);
175+ EventRequestManager erm = Env.vm().eventRequestManager();
176+ for (EventRequest eReq : erm.methodExitRequests()) {
177+ if (eReq.equals(me.request())) {
178+ eReq.disable();
179+ }
180+ }
181+ }
182+ return true;
183+ }
184+
185+ // We are tracing a specific method, and this isn't it. Keep going.
186+ return false;
187+ }
188+
189+ @Override
190+ public void vmInterrupted() {
191+ Thread.yield(); // fetch output
192+ printCurrentLocation();
193+ for (String cmd : monitorCommands) {
194+ StringTokenizer t = new StringTokenizer(cmd);
195+ t.nextToken(); // get rid of monitor number
196+ executeCommand(t);
197+ }
198+ MessageOutput.printPrompt();
199+ }
200+
201+ @Override
202+ public void receivedEvent(Event event) {
203+ }
204+
205+ private void printBaseLocation(String threadName, Location loc) {
206+ MessageOutput.println("location",
207+ new Object [] {threadName,
208+ Commands.locationString(loc)});
209+ }
210+
211+ private void printCurrentLocation() {
212+ ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
213+ StackFrame frame;
214+ try {
215+ frame = threadInfo.getCurrentFrame();
216+ } catch (IncompatibleThreadStateException exc) {
217+ MessageOutput.println("<location unavailable>");
218+ return;
219+ }
220+ if (frame == null) {
221+ MessageOutput.println("No frames on the current call stack");
222+ } else {
223+ Location loc = frame.location();
224+ printBaseLocation(threadInfo.getThread().name(), loc);
225+ // Output the current source line, if possible
226+ if (loc.lineNumber() != -1) {
227+ String line;
228+ try {
229+ line = Env.sourceLine(loc, loc.lineNumber());
230+ } catch (java.io.IOException e) {
231+ line = null;
232+ }
233+ if (line != null) {
234+ MessageOutput.println("source line number and line",
235+ new Object [] {new Integer(loc.lineNumber()),
236+ line});
237+ }
238+ }
239+ }
240+ MessageOutput.println();
241+ }
242+
243+ private void printLocationOfEvent(LocatableEvent theEvent) {
244+ printBaseLocation(theEvent.thread().name(), theEvent.location());
245+ }
246+
247+ void help() {
248+ MessageOutput.println("zz help text");
249+ }
250+
251+ private static final String[][] commandList = {
252+ /*
253+ * NOTE: this list must be kept sorted in ascending ASCII
254+ * order by element [0]. Ref: isCommand() below.
255+ *
256+ *Command OK when OK when
257+ * name disconnected? readonly?
258+ *------------------------------------
259+ */
260+ {"!!", "n", "y"},
261+ {"?", "y", "y"},
262+ {"bytecodes", "n", "y"},
263+ {"catch", "y", "n"},
264+ {"class", "n", "y"},
265+ {"classes", "n", "y"},
266+ {"classpath", "n", "y"},
267+ {"clear", "y", "n"},
268+ {"connectors", "y", "y"},
269+ {"cont", "n", "n"},
270+ {"disablegc", "n", "n"},
271+ {"down", "n", "y"},
272+ {"dump", "n", "y"},
273+ {"enablegc", "n", "n"},
274+ {"eval", "n", "y"},
275+ {"exclude", "y", "n"},
276+ {"exit", "y", "y"},
277+ {"extension", "n", "y"},
278+ {"fields", "n", "y"},
279+ {"gc", "n", "n"},
280+ {"help", "y", "y"},
281+ {"ignore", "y", "n"},
282+ {"interrupt", "n", "n"},
283+ {"kill", "n", "n"},
284+ {"lines", "n", "y"},
285+ {"list", "n", "y"},
286+ {"load", "n", "y"},
287+ {"locals", "n", "y"},
288+ {"lock", "n", "n"},
289+ {"memory", "n", "y"},
290+ {"methods", "n", "y"},
291+ {"monitor", "n", "n"},
292+ {"next", "n", "n"},
293+ {"pop", "n", "n"},
294+ {"print", "n", "y"},
295+ {"quit", "y", "y"},
296+ {"read", "y", "y"},
297+ {"redefine", "n", "n"},
298+ {"reenter", "n", "n"},
299+ {"resume", "n", "n"},
300+ {"run", "y", "n"},
301+ {"save", "n", "n"},
302+ {"set", "n", "n"},
303+ {"sourcepath", "y", "y"},
304+ {"step", "n", "n"},
305+ {"stepi", "n", "n"},
306+ {"stop", "y", "n"},
307+ {"suspend", "n", "n"},
308+ {"thread", "n", "y"},
309+ {"threadgroup", "n", "y"},
310+ {"threadgroups", "n", "y"},
311+ {"threadlocks", "n", "y"},
312+ {"threads", "n", "y"},
313+ {"trace", "n", "n"},
314+ {"unmonitor", "n", "n"},
315+ {"untrace", "n", "n"},
316+ {"unwatch", "y", "n"},
317+ {"up", "n", "y"},
318+ {"use", "y", "y"},
319+ {"version", "y", "y"},
320+ {"watch", "y", "n"},
321+ {"where", "n", "y"},
322+ {"wherei", "n", "y"},
323+ };
324+
325+ /*
326+ * Look up the command string in commandList.
327+ * If found, return the index.
328+ * If not found, return index < 0
329+ */
330+ private int isCommand(String key) {
331+ //Reference: binarySearch() in java/util/Arrays.java
332+ // Adapted for use with String[][0].
333+ int low = 0;
334+ int high = commandList.length - 1;
335+ while (low <= high) {
336+ int mid = (low + high) >>> 1;
337+ String midVal = commandList[mid][0];
338+ int compare = midVal.compareTo(key);
339+ if (compare < 0) {
340+ low = mid + 1;
341+ } else if (compare > 0) {
342+ high = mid - 1;
343+ }
344+ else {
345+ return mid; // key found
346+ }
347+ }
348+ return -(low + 1); // key not found.
349+ };
350+
351+ /*
352+ * Return true if the command is OK when disconnected.
353+ */
354+ private boolean isDisconnectCmd(int ii) {
355+ if (ii < 0 || ii >= commandList.length) {
356+ return false;
357+ }
358+ return (commandList[ii][1].equals("y"));
359+ }
360+
361+ /*
362+ * Return true if the command is OK when readonly.
363+ */
364+ private boolean isReadOnlyCmd(int ii) {
365+ if (ii < 0 || ii >= commandList.length) {
366+ return false;
367+ }
368+ return (commandList[ii][2].equals("y"));
369+ };
370+
371+
372+ void executeCommand(StringTokenizer t) {
373+ String cmd = t.nextToken().toLowerCase();
374+ // Normally, prompt for the next command after this one is done
375+ boolean showPrompt = true;
376+
377+
378+ /*
379+ * Anything starting with # is discarded as a no-op or 'comment'.
380+ */
381+ if (!cmd.startsWith("#")) {
382+ /*
383+ * Next check for an integer repetition prefix. If found,
384+ * recursively execute cmd that number of times.
385+ */
386+ if (Character.isDigit(cmd.charAt(0)) && t.hasMoreTokens()) {
387+ try {
388+ int repeat = Integer.parseInt(cmd);
389+ String subcom = t.nextToken("");
390+ while (repeat-- > 0) {
391+ executeCommand(new StringTokenizer(subcom));
392+ showPrompt = false; // Bypass the printPrompt() below.
393+ }
394+ } catch (NumberFormatException exc) {
395+ MessageOutput.println("Unrecognized command. Try help...", cmd);
396+ }
397+ } else {
398+ int commandNumber = isCommand(cmd);
399+ /*
400+ * Check for an unknown command
401+ */
402+ if (commandNumber < 0) {
403+ MessageOutput.println("Unrecognized command. Try help...", cmd);
404+ } else if (!Env.connection().isOpen() && !isDisconnectCmd(commandNumber)) {
405+ MessageOutput.println("Command not valid until the VM is started with the run command",
406+ cmd);
407+ } else if (Env.connection().isOpen() && !Env.vm().canBeModified() &&
408+ !isReadOnlyCmd(commandNumber)) {
409+ MessageOutput.println("Command is not supported on a read-only VM connection",
410+ cmd);
411+ } else {
412+
413+ Commands evaluator = new Commands();
414+ try {
415+ if (cmd.equals("print")) {
416+ evaluator.commandPrint(t, false);
417+ showPrompt = false; // asynchronous command
418+ } else if (cmd.equals("eval")) {
419+ evaluator.commandPrint(t, false);
420+ showPrompt = false; // asynchronous command
421+ } else if (cmd.equals("set")) {
422+ evaluator.commandSet(t);
423+ showPrompt = false; // asynchronous command
424+ } else if (cmd.equals("dump")) {
425+ evaluator.commandPrint(t, true);
426+ showPrompt = false; // asynchronous command
427+ } else if (cmd.equals("locals")) {
428+ evaluator.commandLocals();
429+ } else if (cmd.equals("classes")) {
430+ evaluator.commandClasses();
431+ } else if (cmd.equals("class")) {
432+ evaluator.commandClass(t);
433+ } else if (cmd.equals("connectors")) {
434+ evaluator.commandConnectors(Bootstrap.virtualMachineManager());
435+ } else if (cmd.equals("methods")) {
436+ evaluator.commandMethods(t);
437+ } else if (cmd.equals("fields")) {
438+ evaluator.commandFields(t);
439+ } else if (cmd.equals("threads")) {
440+ evaluator.commandThreads(t);
441+ } else if (cmd.equals("thread")) {
442+ evaluator.commandThread(t);
443+ } else if (cmd.equals("suspend")) {
444+ evaluator.commandSuspend(t);
445+ } else if (cmd.equals("resume")) {
446+ evaluator.commandResume(t);
447+ } else if (cmd.equals("cont")) {
448+ evaluator.commandCont();
449+ } else if (cmd.equals("threadgroups")) {
450+ evaluator.commandThreadGroups();
451+ } else if (cmd.equals("threadgroup")) {
452+ evaluator.commandThreadGroup(t);
453+ } else if (cmd.equals("catch")) {
454+ evaluator.commandCatchException(t);
455+ } else if (cmd.equals("ignore")) {
456+ evaluator.commandIgnoreException(t);
457+ } else if (cmd.equals("step")) {
458+ evaluator.commandStep(t);
459+ } else if (cmd.equals("stepi")) {
460+ evaluator.commandStepi();
461+ } else if (cmd.equals("next")) {
462+ evaluator.commandNext();
463+ } else if (cmd.equals("kill")) {
464+ evaluator.commandKill(t);
465+ } else if (cmd.equals("interrupt")) {
466+ evaluator.commandInterrupt(t);
467+ } else if (cmd.equals("trace")) {
468+ evaluator.commandTrace(t);
469+ } else if (cmd.equals("untrace")) {
470+ evaluator.commandUntrace(t);
471+ } else if (cmd.equals("where")) {
472+ evaluator.commandWhere(t, false);
473+ } else if (cmd.equals("wherei")) {
474+ evaluator.commandWhere(t, true);
475+ } else if (cmd.equals("up")) {
476+ evaluator.commandUp(t);
477+ } else if (cmd.equals("down")) {
478+ evaluator.commandDown(t);
479+ } else if (cmd.equals("load")) {
480+ evaluator.commandLoad(t);
481+ } else if (cmd.equals("run")) {
482+ evaluator.commandRun(t);
483+ /*
484+ * Fire up an event handler, if the connection was just
485+ * opened. Since this was done from the run command
486+ * we don't stop the VM on its VM start event (so
487+ * arg 2 is false).
488+ */
489+ if ((handler == null) && Env.connection().isOpen()) {
490+ handler = new EventHandler(this, false);
491+ }
492+ } else if (cmd.equals("memory")) {
493+ evaluator.commandMemory();
494+ } else if (cmd.equals("gc")) {
495+ evaluator.commandGC();
496+ } else if (cmd.equals("stop")) {
497+ evaluator.commandStop(t);
498+ } else if (cmd.equals("clear")) {
499+ evaluator.commandClear(t);
500+ } else if (cmd.equals("watch")) {
501+ evaluator.commandWatch(t);
502+ } else if (cmd.equals("unwatch")) {
503+ evaluator.commandUnwatch(t);
504+ } else if (cmd.equals("list")) {
505+ evaluator.commandList(t);
506+ } else if (cmd.equals("lines")) { // Undocumented command: useful for testing.
507+ evaluator.commandLines(t);
508+ } else if (cmd.equals("classpath")) {
509+ evaluator.commandClasspath(t);
510+ } else if (cmd.equals("use") || cmd.equals("sourcepath")) {
511+ evaluator.commandUse(t);
512+ } else if (cmd.equals("monitor")) {
513+ monitorCommand(t);
514+ } else if (cmd.equals("unmonitor")) {
515+ unmonitorCommand(t);
516+ } else if (cmd.equals("lock")) {
517+ evaluator.commandLock(t);
518+ showPrompt = false; // asynchronous command
519+ } else if (cmd.equals("threadlocks")) {
520+ evaluator.commandThreadlocks(t);
521+ } else if (cmd.equals("disablegc")) {
522+ evaluator.commandDisableGC(t);
523+ showPrompt = false; // asynchronous command
524+ } else if (cmd.equals("enablegc")) {
525+ evaluator.commandEnableGC(t);
526+ showPrompt = false; // asynchronous command
527+ } else if (cmd.equals("save")) { // Undocumented command: useful for testing.
528+ evaluator.commandSave(t);
529+ showPrompt = false; // asynchronous command
530+ } else if (cmd.equals("bytecodes")) { // Undocumented command: useful for testing.
531+ evaluator.commandBytecodes(t);
532+ } else if (cmd.equals("redefine")) {
533+ evaluator.commandRedefine(t);
534+ } else if (cmd.equals("pop")) {
535+ evaluator.commandPopFrames(t, false);
536+ } else if (cmd.equals("reenter")) {
537+ evaluator.commandPopFrames(t, true);
538+ } else if (cmd.equals("extension")) {
539+ evaluator.commandExtension(t);
540+ } else if (cmd.equals("exclude")) {
541+ evaluator.commandExclude(t);
542+ } else if (cmd.equals("read")) {
543+ readCommand(t);
544+ } else if (cmd.equals("help") || cmd.equals("?")) {
545+ help();
546+ } else if (cmd.equals("version")) {
547+ evaluator.commandVersion(progname,
548+ Bootstrap.virtualMachineManager());
549+ } else if (cmd.equals("quit") || cmd.equals("exit")) {
550+ if (handler != null) {
551+ handler.shutdown();
552+ }
553+ Env.shutdown();
554+ } else {
555+ MessageOutput.println("Unrecognized command. Try help...", cmd);
556+ }
557+ } catch (VMCannotBeModifiedException rovm) {
558+ MessageOutput.println("Command is not supported on a read-only VM connection", cmd);
559+ } catch (UnsupportedOperationException uoe) {
560+ MessageOutput.println("Command is not supported on the target VM", cmd);
561+ } catch (VMNotConnectedException vmnse) {
562+ MessageOutput.println("Command not valid until the VM is started with the run command",
563+ cmd);
564+ } catch (Exception e) {
565+ MessageOutput.printException("Internal exception:", e);
566+ }
567+ }
568+ }
569+ }
570+ if (showPrompt) {
571+ MessageOutput.printPrompt();
572+ }
573+ }
574+
575+ /*
576+ * Maintain a list of commands to execute each time the VM is suspended.
577+ */
578+ void monitorCommand(StringTokenizer t) {
579+ if (t.hasMoreTokens()) {
580+ ++monitorCount;
581+ monitorCommands.add(monitorCount + ": " + t.nextToken(""));
582+ } else {
583+ for (String cmd : monitorCommands) {
584+ MessageOutput.printDirectln(cmd);// Special case: use printDirectln()
585+ }
586+ }
587+ }
588+
589+ void unmonitorCommand(StringTokenizer t) {
590+ if (t.hasMoreTokens()) {
591+ String monTok = t.nextToken();
592+ int monNum;
593+ try {
594+ monNum = Integer.parseInt(monTok);
595+ } catch (NumberFormatException exc) {
596+ MessageOutput.println("Not a monitor number:", monTok);
597+ return;
598+ }
599+ String monStr = monTok + ":";
600+ for (String cmd : monitorCommands) {
601+ StringTokenizer ct = new StringTokenizer(cmd);
602+ if (ct.nextToken().equals(monStr)) {
603+ monitorCommands.remove(cmd);
604+ MessageOutput.println("Unmonitoring", cmd);
605+ return;
606+ }
607+ }
608+ MessageOutput.println("No monitor numbered:", monTok);
609+ } else {
610+ MessageOutput.println("Usage: unmonitor <monitor#>");
611+ }
612+ }
613+
614+
615+ void readCommand(StringTokenizer t) {
616+ if (t.hasMoreTokens()) {
617+ String cmdfname = t.nextToken();
618+ if (!readCommandFile(new File(cmdfname))) {
619+ MessageOutput.println("Could not open:", cmdfname);
620+ }
621+ } else {
622+ MessageOutput.println("Usage: read <command-filename>");
623+ }
624+ }
625+
626+ /**
627+ * Read and execute a command file. Return true if the file was read
628+ * else false;
629+ */
630+ boolean readCommandFile(File f) {
631+ BufferedReader inFile = null;
632+ try {
633+ if (f.canRead()) {
634+ // Process initial commands.
635+ MessageOutput.println("*** Reading commands from", f.getPath());
636+ inFile = new BufferedReader(new FileReader(f));
637+ String ln;
638+ while ((ln = inFile.readLine()) != null) {
639+ StringTokenizer t = new StringTokenizer(ln);
640+ if (t.hasMoreTokens()) {
641+ executeCommand(t);
642+ }
643+ }
644+ }
645+ } catch (IOException e) {
646+ } finally {
647+ if (inFile != null) {
648+ try {
649+ inFile.close();
650+ } catch (Exception exc) {
651+ }
652+ }
653+ }
654+ return inFile != null;
655+ }
656+
657+ /**
658+ * Try to read commands from dir/fname, unless
659+ * the canonical path passed in is the same as that
660+ * for dir/fname.
661+ * Return null if that file doesn't exist,
662+ * else return the canonical path of that file.
663+ */
664+ String readStartupCommandFile(String dir, String fname, String canonPath) {
665+ File dotInitFile = new File(dir, fname);
666+ if (!dotInitFile.exists()) {
667+ return null;
668+ }
669+
670+ String myCanonFile;
671+ try {
672+ myCanonFile = dotInitFile.getCanonicalPath();
673+ } catch (IOException ee) {
674+ MessageOutput.println("Could not open:", dotInitFile.getPath());
675+ return null;
676+ }
677+ if (canonPath == null || !canonPath.equals(myCanonFile)) {
678+ if (!readCommandFile(dotInitFile)) {
679+ MessageOutput.println("Could not open:", dotInitFile.getPath());
680+ }
681+ }
682+ return myCanonFile;
683+ }
684+
685+
686+ public TTY() throws Exception {
687+
688+ MessageOutput.println("Initializing progname", progname);
689+
690+ if (Env.connection().isOpen() && Env.vm().canBeModified()) {
691+ /*
692+ * Connection opened on startup. Start event handler
693+ * immediately, telling it (through arg 2) to stop on the
694+ * VM start event.
695+ */
696+ this.handler = new EventHandler(this, true);
697+ }
698+ try {
699+ BufferedReader in =
700+ new BufferedReader(new InputStreamReader(System.in));
701+
702+ String lastLine = null;
703+
704+ Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
705+
706+ /*
707+ * Read start up files. This mimics the behavior
708+ * of gdb which will read both ~/.gdbinit and then
709+ * ./.gdbinit if they exist. We have the twist that
710+ * we allow two different names, so we do this:
711+ * if ~/jdb.ini exists,
712+ * read it
713+ * else if ~/.jdbrc exists,
714+ * read it
715+ *
716+ * if ./jdb.ini exists,
717+ * if it hasn't been read, read it
718+ * It could have been read above because ~ == .
719+ * or because of symlinks, ...
720+ * else if ./jdbrx exists
721+ * if it hasn't been read, read it
722+ */
723+ {
724+ String userHome = System.getProperty("user.home");
725+ String canonPath;
726+
727+ if ((canonPath = readStartupCommandFile(userHome, "jdb.ini", null)) == null) {
728+ // Doesn't exist, try alternate spelling
729+ canonPath = readStartupCommandFile(userHome, ".jdbrc", null);
730+ }
731+
732+ String userDir = System.getProperty("user.dir");
733+ if (readStartupCommandFile(userDir, "jdb.ini", canonPath) == null) {
734+ // Doesn't exist, try alternate spelling
735+ readStartupCommandFile(userDir, ".jdbrc", canonPath);
736+ }
737+ }
738+
739+ // Process interactive commands.
740+ MessageOutput.printPrompt();
741+ while (true) {
742+ String ln = in.readLine();
743+ if (ln == null) {
744+ MessageOutput.println("Input stream closed.");
745+ ln = "quit";
746+ }
747+
748+ if (ln.startsWith("!!") && lastLine != null) {
749+ ln = lastLine + ln.substring(2);
750+ MessageOutput.printDirectln(ln);// Special case: use printDirectln()
751+ }
752+
753+ StringTokenizer t = new StringTokenizer(ln);
754+ if (t.hasMoreTokens()) {
755+ lastLine = ln;
756+ executeCommand(t);
757+ } else {
758+ MessageOutput.printPrompt();
759+ }
760+ }
761+ } catch (VMDisconnectedException e) {
762+ handler.handleDisconnectedException();
763+ }
764+ }
765+
766+ private static void usage() {
767+ MessageOutput.println("zz usage text", new Object [] {progname,
768+ File.pathSeparator});
769+ System.exit(1);
770+ }
771+
772+ static void usageError(String messageKey) {
773+ MessageOutput.println(messageKey);
774+ MessageOutput.println();
775+ usage();
776+ }
777+
778+ static void usageError(String messageKey, String argument) {
779+ MessageOutput.println(messageKey, argument);
780+ MessageOutput.println();
781+ usage();
782+ }
783+
784+ private static boolean supportsSharedMemory() {
785+ for (Connector connector :
786+ Bootstrap.virtualMachineManager().allConnectors()) {
787+ if (connector.transport() == null) {
788+ continue;
789+ }
790+ if ("dt_shmem".equals(connector.transport().name())) {
791+ return true;
792+ }
793+ }
794+ return false;
795+ }
796+
797+ private static String addressToSocketArgs(String address) {
798+ int index = address.indexOf(':');
799+ if (index != -1) {
800+ String hostString = address.substring(0, index);
801+ String portString = address.substring(index + 1);
802+ return "hostname=" + hostString + ",port=" + portString;
803+ } else {
804+ return "port=" + address;
805+ }
806+ }
807+
808+ private static boolean hasWhitespace(String string) {
809+ int length = string.length();
810+ for (int i = 0; i < length; i++) {
811+ if (Character.isWhitespace(string.charAt(i))) {
812+ return true;
813+ }
814+ }
815+ return false;
816+ }
817+
818+ private static String addArgument(String string, String argument) {
819+ if (hasWhitespace(argument) || argument.indexOf(',') != -1) {
820+ // Quotes were stripped out for this argument, add 'em back.
821+ StringBuffer buffer = new StringBuffer(string);
822+ buffer.append('"');
823+ for (int i = 0; i < argument.length(); i++) {
824+ char c = argument.charAt(i);
825+ if (c == '"') {
826+ buffer.append('\\');
827+ }
828+ buffer.append(c);
829+ }
830+ buffer.append("\" ");
831+ return buffer.toString();
832+ } else {
833+ return string + argument + ' ';
834+ }
835+ }
836+
837+ public static void main(String argv[]) throws MissingResourceException {
838+ String cmdLine = "";
839+ String javaArgs = "";
840+ int traceFlags = VirtualMachine.TRACE_NONE;
841+ boolean launchImmediately = false;
842+ String connectSpec = null;
843+
844+ MessageOutput.textResources = ResourceBundle.getBundle
845+ ("com.sun.tools.example.debug.tty.TTYResources",
846+ Locale.getDefault());
847+
848+ for (int i = 0; i < argv.length; i++) {
849+ String token = argv[i];
850+ if (token.equals("-dbgtrace")) {
851+ if ((i == argv.length - 1) ||
852+ ! Character.isDigit(argv[i+1].charAt(0))) {
853+ traceFlags = VirtualMachine.TRACE_ALL;
854+ } else {
855+ String flagStr = "";
856+ try {
857+ flagStr = argv[++i];
858+ traceFlags = Integer.decode(flagStr).intValue();
859+ } catch (NumberFormatException nfe) {
860+ usageError("dbgtrace flag value must be an integer:",
861+ flagStr);
862+ return;
863+ }
864+ }
865+ } else if (token.equals("-X")) {
866+ usageError("Use java minus X to see");
867+ return;
868+ } else if (
869+ // Standard VM options passed on
870+ token.equals("-v") || token.startsWith("-v:") || // -v[:...]
871+ token.startsWith("-verbose") || // -verbose[:...]
872+ token.startsWith("-D") ||
873+ // -classpath handled below
874+ // NonStandard options passed on
875+ token.startsWith("-X") ||
876+ // Old-style options (These should remain in place as long as
877+ // the standard VM accepts them)
878+ token.equals("-noasyncgc") || token.equals("-prof") ||
879+ token.equals("-verify") || token.equals("-noverify") ||
880+ token.equals("-verifyremote") ||
881+ token.equals("-verbosegc") ||
882+ token.startsWith("-ms") || token.startsWith("-mx") ||
883+ token.startsWith("-ss") || token.startsWith("-oss") ) {
884+
885+ javaArgs = addArgument(javaArgs, token);
886+ } else if (token.equals("-tclassic")) {
887+ usageError("Classic VM no longer supported.");
888+ return;
889+ } else if (token.equals("-tclient")) {
890+ // -client must be the first one
891+ javaArgs = "-client " + javaArgs;
892+ } else if (token.equals("-tserver")) {
893+ // -server must be the first one
894+ javaArgs = "-server " + javaArgs;
895+ } else if (token.equals("-sourcepath")) {
896+ if (i == (argv.length - 1)) {
897+ usageError("No sourcepath specified.");
898+ return;
899+ }
900+ Env.setSourcePath(argv[++i]);
901+ } else if (token.equals("-classpath")) {
902+ if (i == (argv.length - 1)) {
903+ usageError("No classpath specified.");
904+ return;
905+ }
906+ javaArgs = addArgument(javaArgs, token);
907+ javaArgs = addArgument(javaArgs, argv[++i]);
908+ } else if (token.equals("-attach")) {
909+ if (connectSpec != null) {
910+ usageError("cannot redefine existing connection", token);
911+ return;
912+ }
913+ if (i == (argv.length - 1)) {
914+ usageError("No attach address specified.");
915+ return;
916+ }
917+ String address = argv[++i];
918+
919+ /*
920+ * -attach is shorthand for one of the reference implementation's
921+ * attaching connectors. Use the shared memory attach if it's
922+ * available; otherwise, use sockets. Build a connect
923+ * specification string based on this decision.
924+ */
925+ if (supportsSharedMemory()) {
926+ connectSpec = "com.sun.jdi.SharedMemoryAttach:name=" +
927+ address;
928+ } else {
929+ String suboptions = addressToSocketArgs(address);
930+ connectSpec = "com.sun.jdi.SocketAttach:" + suboptions;
931+ }
932+ } else if (token.equals("-listen") || token.equals("-listenany")) {
933+ if (connectSpec != null) {
934+ usageError("cannot redefine existing connection", token);
935+ return;
936+ }
937+ String address = null;
938+ if (token.equals("-listen")) {
939+ if (i == (argv.length - 1)) {
940+ usageError("No attach address specified.");
941+ return;
942+ }
943+ address = argv[++i];
944+ }
945+
946+ /*
947+ * -listen[any] is shorthand for one of the reference implementation's
948+ * listening connectors. Use the shared memory listen if it's
949+ * available; otherwise, use sockets. Build a connect
950+ * specification string based on this decision.
951+ */
952+ if (supportsSharedMemory()) {
953+ connectSpec = "com.sun.jdi.SharedMemoryListen:";
954+ if (address != null) {
955+ connectSpec += ("name=" + address);
956+ }
957+ } else {
958+ connectSpec = "com.sun.jdi.SocketListen:";
959+ if (address != null) {
960+ connectSpec += addressToSocketArgs(address);
961+ }
962+ }
963+ } else if (token.equals("-launch")) {
964+ launchImmediately = true;
965+ } else if (token.equals("-listconnectors")) {
966+ Commands evaluator = new Commands();
967+ evaluator.commandConnectors(Bootstrap.virtualMachineManager());
968+ return;
969+ } else if (token.equals("-connect")) {
970+ /*
971+ * -connect allows the user to pick the connector
972+ * used in bringing up the target VM. This allows
973+ * use of connectors other than those in the reference
974+ * implementation.
975+ */
976+ if (connectSpec != null) {
977+ usageError("cannot redefine existing connection", token);
978+ return;
979+ }
980+ if (i == (argv.length - 1)) {
981+ usageError("No connect specification.");
982+ return;
983+ }
984+ connectSpec = argv[++i];
985+ } else if (token.equals("-help")) {
986+ usage();
987+ } else if (token.equals("-version")) {
988+ Commands evaluator = new Commands();
989+ evaluator.commandVersion(progname,
990+ Bootstrap.virtualMachineManager());
991+ System.exit(0);
992+ } else if (token.startsWith("-")) {
993+ usageError("invalid option", token);
994+ return;
995+ } else {
996+ // Everything from here is part of the command line
997+ cmdLine = addArgument("", token);
998+ for (i++; i < argv.length; i++) {
999+ cmdLine = addArgument(cmdLine, argv[i]);
1000+ }
1001+ break;
1002+ }
1003+ }
1004+
1005+ /*
1006+ * Unless otherwise specified, set the default connect spec.
1007+ */
1008+
1009+ /*
1010+ * Here are examples of jdb command lines and how the options
1011+ * are interpreted as arguments to the program being debugged.
1012+ * arg1 arg2
1013+ * ---- ----
1014+ * jdb hello a b a b
1015+ * jdb hello "a b" a b
1016+ * jdb hello a,b a,b
1017+ * jdb hello a, b a, b
1018+ * jdb hello "a, b" a, b
1019+ * jdb -connect "com.sun.jdi.CommandLineLaunch:main=hello a,b" illegal
1020+ * jdb -connect com.sun.jdi.CommandLineLaunch:main=hello "a,b" illegal
1021+ * jdb -connect 'com.sun.jdi.CommandLineLaunch:main=hello "a,b"' arg1 = a,b
1022+ * jdb -connect 'com.sun.jdi.CommandLineLaunch:main=hello "a b"' arg1 = a b
1023+ * jdb -connect 'com.sun.jdi.CommandLineLaunch:main=hello a b' arg1 = a arg2 = b
1024+ * jdb -connect 'com.sun.jdi.CommandLineLaunch:main=hello "a," b' arg1 = a, arg2 = b
1025+ */
1026+ if (connectSpec == null) {
1027+ connectSpec = "com.sun.jdi.CommandLineLaunch:";
1028+ } else if (!connectSpec.endsWith(",") && !connectSpec.endsWith(":")) {
1029+ connectSpec += ","; // (Bug ID 4285874)
1030+ }
1031+
1032+ cmdLine = cmdLine.trim();
1033+ javaArgs = javaArgs.trim();
1034+
1035+ if (cmdLine.length() > 0) {
1036+ if (!connectSpec.startsWith("com.sun.jdi.CommandLineLaunch:")) {
1037+ usageError("Cannot specify command line with connector:",
1038+ connectSpec);
1039+ return;
1040+ }
1041+ connectSpec += "main=" + cmdLine + ",";
1042+ }
1043+
1044+ if (javaArgs.length() > 0) {
1045+ if (!connectSpec.startsWith("com.sun.jdi.CommandLineLaunch:")) {
1046+ usageError("Cannot specify target vm arguments with connector:",
1047+ connectSpec);
1048+ return;
1049+ }
1050+ connectSpec += "options=" + javaArgs + ",";
1051+ }
1052+
1053+ try {
1054+ if (! connectSpec.endsWith(",")) {
1055+ connectSpec += ","; // (Bug ID 4285874)
1056+ }
1057+ Env.init(connectSpec, launchImmediately, traceFlags);
1058+ new TTY();
1059+ } catch(Exception e) {
1060+ MessageOutput.printException("Internal exception:", e);
1061+ }
1062+ }
1063+}
java/pkg/com/sun/tools/example/debug/tty/TTYResources.java+456−0
@@ -0,0 +1,456 @@
1+/*
2+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+/**
29+ * <p> This class represents the <code>ResourceBundle</code>
30+ * for the following package(s):
31+ *
32+ * <ol>
33+ * <li> com.sun.tools.example.debug.tty
34+ * </ol>
35+ *
36+ */
37+public class TTYResources extends java.util.ListResourceBundle {
38+
39+
40+ /**
41+ * Returns the contents of this <code>ResourceBundle</code>.
42+ *
43+ * <p>
44+ *
45+ * @return the contents of this <code>ResourceBundle</code>.
46+ */
47+ @Override
48+ public Object[][] getContents() {
49+ Object[][] temp = new Object[][] {
50+ // NOTE: The value strings in this file containing "{0}" are
51+ // processed by the java.text.MessageFormat class. Any
52+ // single quotes appearing in these strings need to be
53+ // doubled up.
54+ //
55+ // LOCALIZE THIS
56+ {"** classes list **", "** classes list **\n{0}"},
57+ {"** fields list **", "** fields list **\n{0}"},
58+ {"** methods list **", "** methods list **\n{0}"},
59+ {"*** Reading commands from", "*** Reading commands from {0}"},
60+ {"All threads resumed.", "All threads resumed."},
61+ {"All threads suspended.", "All threads suspended."},
62+ {"Argument is not defined for connector:", "Argument {0} is not defined for connector: {1}"},
63+ {"Arguments match no method", "Arguments match no method"},
64+ {"Array:", "Array: {0}"},
65+ {"Array element is not a method", "Array element is not a method"},
66+ {"Array index must be a integer type", "Array index must be a integer type"},
67+ {"base directory:", "base directory: {0}"},
68+ {"bootclasspath:", "bootclasspath: {0}"},
69+ {"Breakpoint hit:", "Breakpoint hit: "},
70+ {"breakpoint", "breakpoint {0}"},
71+ {"Breakpoints set:", "Breakpoints set:"},
72+ {"Breakpoints can be located only in classes.", "Breakpoints can be located only in classes. {0} is an interface or array."},
73+ {"Can only trace", "Can only trace 'methods' or 'method exit' or 'method exits'"},
74+ {"cannot redefine existing connection", "{0} cannot redefine existing connection"},
75+ {"Cannot assign to a method invocation", "Cannot assign to a method invocation"},
76+ {"Cannot specify command line with connector:", "Cannot specify command line with connector: {0}"},
77+ {"Cannot specify target vm arguments with connector:", "Cannot specify target VM arguments with connector: {0}"},
78+ {"Class containing field must be specified.", "Class containing field must be specified."},
79+ {"Class:", "Class: {0}"},
80+ {"Classic VM no longer supported.", "Classic VM no longer supported."},
81+ {"classpath:", "classpath: {0}"},
82+ {"colon mark", ":"},
83+ {"colon space", ": "},
84+ {"Command is not supported on the target VM", "Command ''{0}'' is not supported on the target VM"},
85+ {"Command is not supported on a read-only VM connection", "Command ''{0}'' is not supported on a read-only VM connection"},
86+ {"Command not valid until the VM is started with the run command", "Command ''{0}'' is not valid until the VM is started with the ''run'' command"},
87+ {"Condition must be boolean", "Condition must be boolean"},
88+ {"Connector and Transport name", " Connector: {0} Transport: {1}"},
89+ {"Connector argument nodefault", " Argument: {0} (no default)"},
90+ {"Connector argument default", " Argument: {0} Default value: {1}"},
91+ {"Connector description", " description: {0}"},
92+ {"Connector required argument nodefault", " Required Argument: {0} (no default)"},
93+ {"Connector required argument default", " Required Argument: {0} Default value: {1}"},
94+ {"Connectors available", "Available connectors are:"},
95+ {"Constant is not a method", "Constant is not a method"},
96+ {"Could not open:", "Could not open: {0}"},
97+ {"Current method is native", "Current method is native"},
98+ {"Current thread died. Execution continuing...", "Current thread {0} died. Execution continuing..."},
99+ {"Current thread isnt suspended.", "Current thread isn't suspended."},
100+ {"Current thread not set.", "Current thread not set."},
101+ {"dbgtrace flag value must be an integer:", "dbgtrace flag value must be an integer: {0}"},
102+ {"Deferring.", "Deferring {0}.\nIt will be set after the class is loaded."},
103+ {"End of stack.", "End of stack."},
104+ {"Error popping frame", "Error popping frame - {0}"},
105+ {"Error reading file", "Error reading ''{0}'' - {1}"},
106+ {"Error redefining class to file", "Error redefining {0} to {1} - {2}"},
107+ {"exceptionSpec all", "all {0}"},
108+ {"exceptionSpec caught", "caught {0}"},
109+ {"exceptionSpec uncaught", "uncaught {0}"},
110+ {"Exception in expression:", "Exception in expression: {0}"},
111+ {"Exception occurred caught", "Exception occurred: {0} (to be caught at: {1})"},
112+ {"Exception occurred uncaught", "Exception occurred: {0} (uncaught)"},
113+ {"Exceptions caught:", "Break when these exceptions occur:"},
114+ {"expr is null", "{0} = null"},
115+ {"expr is value", "{0} = {1}"},
116+ {"expr is value <collected>", " {0} = {1} <collected>"},
117+ {"Expression cannot be void", "Expression cannot be void"},
118+ {"Expression must evaluate to an object", "Expression must evaluate to an object"},
119+ {"extends:", "extends: {0}"},
120+ {"Failed reading output", "Failed reading output of child java interpreter."},
121+ {"Fatal error", "Fatal error:"},
122+ {"Field access encountered before after", "Field ({0}) is {1}, will be {2}: "},
123+ {"Field access encountered", "Field ({0}) access encountered: "},
124+ {"Field to unwatch not specified", "Field to unwatch not specified."},
125+ {"Field to watch not specified", "Field to watch not specified."},
126+ {"GC Disabled for", "GC Disabled for {0}:"},
127+ {"GC Enabled for", "GC Enabled for {0}:"},
128+ {"grouping begin character", "{"},
129+ {"grouping end character", "}"},
130+ {"Illegal Argument Exception", "Illegal Argument Exception"},
131+ {"Illegal connector argument", "Illegal connector argument: {0}"},
132+ {"implementor:", "implementor: {0}"},
133+ {"implements:", "implements: {0}"},
134+ {"Initializing progname", "Initializing {0} ..."},
135+ {"Input stream closed.", "Input stream closed."},
136+ {"Interface:", "Interface: {0}"},
137+ {"Internal debugger error.", "Internal debugger error."},
138+ {"Internal error: null ThreadInfo created", "Internal error: null ThreadInfo created"},
139+ {"Internal error; unable to set", "Internal error; unable to set {0}"},
140+ {"Internal exception during operation:", "Internal exception during operation:\n {0}"},
141+ {"Internal exception:", "Internal exception:"},
142+ {"Invalid argument type name", "Invalid argument type name"},
143+ {"Invalid assignment syntax", "Invalid assignment syntax"},
144+ {"Invalid command syntax", "Invalid command syntax"},
145+ {"Invalid connect type", "Invalid connect type"},
146+ {"Invalid consecutive invocations", "Invalid consecutive invocations"},
147+ {"Invalid exception object", "Invalid exception object"},
148+ {"Invalid method specification:", "Invalid method specification: {0}"},
149+ {"Invalid option on class command", "Invalid option on class command"},
150+ {"invalid option", "invalid option: {0}"},
151+ {"Invalid thread status.", "Invalid thread status."},
152+ {"Invalid transport name:", "Invalid transport name: {0}"},
153+ {"I/O exception occurred:", "I/O Exception occurred: {0}"},
154+ {"is an ambiguous method name in", "\"{0}\" is an ambiguous method name in \"{1}\""},
155+ {"is an invalid line number for", "{0,number,integer} is an invalid line number for {1}"},
156+ {"is not a valid class name", "\"{0}\" is not a valid class name."},
157+ {"is not a valid field name", "\"{0}\" is not a valid field name."},
158+ {"is not a valid id or class name", "\"{0}\" is not a valid id or class name."},
159+ {"is not a valid line number or method name for", "\"{0}\" is not a valid line number or method name for class \"{1}\""},
160+ {"is not a valid method name", "\"{0}\" is not a valid method name."},
161+ {"is not a valid thread id", "\"{0}\" is not a valid thread id."},
162+ {"is not a valid threadgroup name", "\"{0}\" is not a valid threadgroup name."},
163+ {"jdb prompt with no current thread", "> "},
164+ {"jdb prompt thread name and current stack frame", "{0}[{1,number,integer}] "},
165+ {"killed", "{0} killed"},
166+ {"killing thread:", "killing thread: {0}"},
167+ {"Line number information not available for", "Source line numbers not available for this location."},
168+ {"line number", ":{0,number,integer}"},
169+ {"list field typename and name", "{0} {1}\n"},
170+ {"list field typename and name inherited", "{0} {1} (inherited from {2})\n"},
171+ {"list field typename and name hidden", "{0} {1} (hidden)\n"},
172+ {"Listening at address:", "Listening at address: {0}"},
173+ {"Local variable information not available.", "Local variable information not available. Compile with -g to generate variable information"},
174+ {"Local variables:", "Local variables:"},
175+ {"<location unavailable>", "<location unavailable>"},
176+ {"location", "\"thread={0}\", {1}"},
177+ {"locationString", "{0}.{1}(), line={2,number,integer} bci={3,number,integer}"},
178+ {"Main class and arguments must be specified", "Main class and arguments must be specified"},
179+ {"Method arguments:", "Method arguments:"},
180+ {"Method entered:", "Method entered: "},
181+ {"Method exited:", "Method exited"},
182+ {"Method exitedValue:", "Method exited: return value = {0}, "},
183+ {"Method is overloaded; specify arguments", "Method {0} is overloaded; specify arguments"},
184+ {"minus version", "This is {0} version {1,number,integer}.{2,number,integer} (Java SE version {3})"},
185+ {"Monitor information for thread", "Monitor information for thread {0}:"},
186+ {"Monitor information for expr", "Monitor information for {0} ({1}):"},
187+ {"More than one class named", "More than one class named: ''{0}''"},
188+ {"native method", "native method"},
189+ {"nested:", "nested: {0}"},
190+ {"No attach address specified.", "No attach address specified."},
191+ {"No breakpoints set.", "No breakpoints set."},
192+ {"No class named", "No class named ''{0}''"},
193+ {"No class specified.", "No class specified."},
194+ {"No classpath specified.", "No classpath specified."},
195+ {"No code at line", "No code at line {0,number,integer} in {1}"},
196+ {"No connect specification.", "No connect specification."},
197+ {"No connector named:", "No connector named: {0}"},
198+ {"No current thread", "No current thread"},
199+ {"No default thread specified:", "No default thread specified: use the \"thread\" command first."},
200+ {"No exception object specified.", "No exception object specified."},
201+ {"No exceptions caught.", "No exceptions caught."},
202+ {"No expression specified.", "No expression specified."},
203+ {"No field in", "No field {0} in {1}"},
204+ {"No frames on the current call stack", "No frames on the current call stack"},
205+ {"No linenumber information for", "No linenumber information for {0}. Try compiling with debugging on."},
206+ {"No local variables", "No local variables"},
207+ {"No method in", "No method {0} in {1}"},
208+ {"No method specified.", "No method specified."},
209+ {"No monitor numbered:", "No monitor numbered: {0}"},
210+ {"No monitors owned", " No monitors owned"},
211+ {"No object specified.", "No object specified."},
212+ {"No objects specified.", "No objects specified."},
213+ {"No save index specified.", "No save index specified."},
214+ {"No saved values", "No saved values"},
215+ {"No source information available for:", "No source information available for: {0}"},
216+ {"No sourcedebugextension specified", "No SourceDebugExtension specified"},
217+ {"No sourcepath specified.", "No sourcepath specified."},
218+ {"No thread specified.", "No thread specified."},
219+ {"No VM connected", "No VM connected"},
220+ {"No waiters", " No waiters"},
221+ {"not a class", "{0} is not a class"},
222+ {"Not a monitor number:", "Not a monitor number: ''{0}''"},
223+ {"not found (try the full name)", "{0} not found (try the full name)"},
224+ {"Not found:", "Not found: {0}"},
225+ {"not found", "{0} not found"},
226+ {"Not owned", " Not owned"},
227+ {"Not waiting for a monitor", " Not waiting for a monitor"},
228+ {"Nothing suspended.", "Nothing suspended."},
229+ {"object description and hex id", "({0}){1}"},
230+ {"Operation is not supported on the target VM", "Operation is not supported on the target VM"},
231+ {"operation not yet supported", "operation not yet supported"},
232+ {"Owned by:", " Owned by: {0}, entry count: {1,number,integer}"},
233+ {"Owned monitor:", " Owned monitor: {0}"},
234+ {"Parse exception:", "Parse Exception: {0}"},
235+ {"printbreakpointcommandusage", "Usage: {0} <class>:<line_number> or\n {1} <class>.<method_name>[(argument_type,...)]"},
236+ {"Removed:", "Removed: {0}"},
237+ {"Requested stack frame is no longer active:", "Requested stack frame is no longer active: {0,number,integer}"},
238+ {"run <args> command is valid only with launched VMs", "'run <args>' command is valid only with launched VMs"},
239+ {"run", "run {0}"},
240+ {"saved", "{0} saved"},
241+ {"Set deferred", "Set deferred {0}"},
242+ {"Set", "Set {0}"},
243+ {"Source file not found:", "Source file not found: {0}"},
244+ {"source line number and line", "{0,number,integer} {1}"},
245+ {"source line number current line and line", "{0,number,integer} => {1}"},
246+ {"sourcedebugextension", "SourceDebugExtension -- {0}"},
247+ {"Specify class and method", "Specify class and method"},
248+ {"Specify classes to redefine", "Specify classes to redefine"},
249+ {"Specify file name for class", "Specify file name for class {0}"},
250+ {"stack frame dump with pc", " [{0,number,integer}] {1}.{2} ({3}), pc = {4}"},
251+ {"stack frame dump", " [{0,number,integer}] {1}.{2} ({3})"},
252+ {"Step completed:", "Step completed: "},
253+ {"Stopping due to deferred breakpoint errors.", "Stopping due to deferred breakpoint errors.\n"},
254+ {"subclass:", "subclass: {0}"},
255+ {"subinterface:", "subinterface: {0}"},
256+ {"tab", "\t{0}"},
257+ {"Target VM failed to initialize.", "Target VM failed to initialize."},
258+ {"The application exited", "The application exited"},
259+ {"The application has been disconnected", "The application has been disconnected"},
260+ {"The gc command is no longer necessary.", "The 'gc' command is no longer necessary.\n" +
261+ "All objects are garbage collected as usual. Use 'enablegc' and 'disablegc'\n" +
262+ "commands to control garbage collection of individual objects."},
263+ {"The load command is no longer supported.", "The 'load' command is no longer supported."},
264+ {"The memory command is no longer supported.", "The 'memory' command is no longer supported."},
265+ {"The VM does not use paths", "The VM does not use paths"},
266+ {"Thread is not running (no stack).", "Thread is not running (no stack)."},
267+ {"Thread number not specified.", "Thread number not specified."},
268+ {"Thread:", "{0}:"},
269+ {"Thread Group:", "Group {0}:"},
270+ {"Thread description name unknownStatus BP", " {0} {1} unknown (at breakpoint)"},
271+ {"Thread description name unknownStatus", " {0} {1} unknown"},
272+ {"Thread description name zombieStatus BP", " {0} {1} zombie (at breakpoint)"},
273+ {"Thread description name zombieStatus", " {0} {1} zombie"},
274+ {"Thread description name runningStatus BP", " {0} {1} running (at breakpoint)"},
275+ {"Thread description name runningStatus", " {0} {1} running"},
276+ {"Thread description name sleepingStatus BP", " {0} {1} sleeping (at breakpoint)"},
277+ {"Thread description name sleepingStatus", " {0} {1} sleeping"},
278+ {"Thread description name waitingStatus BP", " {0} {1} waiting in a monitor (at breakpoint)"},
279+ {"Thread description name waitingStatus", " {0} {1} waiting in a monitor"},
280+ {"Thread description name condWaitstatus BP", " {0} {1} cond. waiting (at breakpoint)"},
281+ {"Thread description name condWaitstatus", " {0} {1} cond. waiting"},
282+ {"Thread has been resumed", "Thread has been resumed"},
283+ {"Thread not suspended", "Thread not suspended"},
284+ {"thread group number description name", "{0,number,integer}. {1} {2}"},
285+ {"Threadgroup name not specified.", "Threadgroup name not specified."},
286+ {"Threads must be suspended", "Threads must be suspended"},
287+ {"trace method exit in effect for", "trace method exit in effect for {0}"},
288+ {"trace method exits in effect", "trace method exits in effect"},
289+ {"trace methods in effect", "trace methods in effect"},
290+ {"trace go method exit in effect for", "trace go method exit in effect for {0}"},
291+ {"trace go method exits in effect", "trace go method exits in effect"},
292+ {"trace go methods in effect", "trace go methods in effect"},
293+ {"trace not in effect", "trace not in effect"},
294+ {"Unable to attach to target VM.", "Unable to attach to target VM."},
295+ {"Unable to display process output:", "Unable to display process output: {0}"},
296+ {"Unable to launch target VM.", "Unable to launch target VM."},
297+ {"Unable to set deferred", "Unable to set deferred {0} : {1}"},
298+ {"Unable to set main class and arguments", "Unable to set main class and arguments"},
299+ {"Unable to set", "Unable to set {0} : {1}"},
300+ {"Unexpected event type", "Unexpected event type: {0}"},
301+ {"unknown", "unknown"},
302+ {"Unmonitoring", "Unmonitoring {0} "},
303+ {"Unrecognized command. Try help...", "Unrecognized command: ''{0}''. Try help..."},
304+ {"Usage: catch exception", "Usage: catch [uncaught|caught|all] <class id>|<class pattern>"},
305+ {"Usage: ignore exception", "Usage: ignore [uncaught|caught|all] <class id>|<class pattern>"},
306+ {"Usage: down [n frames]", "Usage: down [n frames]"},
307+ {"Usage: kill <thread id> <throwable>", "Usage: kill <thread id> <throwable>"},
308+ {"Usage: read <command-filename>", "Usage: read <command-filename>"},
309+ {"Usage: unmonitor <monitor#>", "Usage: unmonitor <monitor#>"},
310+ {"Usage: up [n frames]", "Usage: up [n frames]"},
311+ {"Use java minus X to see", "Use 'java -X' to see the available non-standard options"},
312+ {"Use stop at to set a breakpoint at a line number", "Use 'stop at' to set a breakpoint at a line number"},
313+ {"VM already running. use cont to continue after events.", "VM already running. Use 'cont' to continue after events."},
314+ {"VM Started:", "VM Started: "},
315+ {"vmstartexception", "VM start exception: {0}"},
316+ {"Waiting for monitor:", " Waiting for monitor: {0}"},
317+ {"Waiting thread:", " Waiting thread: {0}"},
318+ {"watch accesses of", "watch accesses of {0}.{1}"},
319+ {"watch modification of", "watch modification of {0}.{1}"},
320+ {"zz help text",
321+ "** command list **\n" +
322+ "connectors -- list available connectors and transports in this VM\n" +
323+ "\n" +
324+ "run [class [args]] -- start execution of application's main class\n" +
325+ "\n" +
326+ "threads [threadgroup] -- list threads\n" +
327+ "thread <thread id> -- set default thread\n" +
328+ "suspend [thread id(s)] -- suspend threads (default: all)\n" +
329+ "resume [thread id(s)] -- resume threads (default: all)\n" +
330+ "where [<thread id> | all] -- dump a thread's stack\n" +
331+ "wherei [<thread id> | all]-- dump a thread's stack, with pc info\n" +
332+ "up [n frames] -- move up a thread's stack\n" +
333+ "down [n frames] -- move down a thread's stack\n" +
334+ "kill <thread id> <expr> -- kill a thread with the given exception object\n" +
335+ "interrupt <thread id> -- interrupt a thread\n" +
336+ "\n" +
337+ "print <expr> -- print value of expression\n" +
338+ "dump <expr> -- print all object information\n" +
339+ "eval <expr> -- evaluate expression (same as print)\n" +
340+ "set <lvalue> = <expr> -- assign new value to field/variable/array element\n" +
341+ "locals -- print all local variables in current stack frame\n" +
342+ "\n" +
343+ "classes -- list currently known classes\n" +
344+ "class <class id> -- show details of named class\n" +
345+ "methods <class id> -- list a class's methods\n" +
346+ "fields <class id> -- list a class's fields\n" +
347+ "\n" +
348+ "threadgroups -- list threadgroups\n" +
349+ "threadgroup <name> -- set current threadgroup\n" +
350+ "\n" +
351+ "stop in <class id>.<method>[(argument_type,...)]\n" +
352+ " -- set a breakpoint in a method\n" +
353+ "stop at <class id>:<line> -- set a breakpoint at a line\n" +
354+ "clear <class id>.<method>[(argument_type,...)]\n" +
355+ " -- clear a breakpoint in a method\n" +
356+ "clear <class id>:<line> -- clear a breakpoint at a line\n" +
357+ "clear -- list breakpoints\n" +
358+ "catch [uncaught|caught|all] <class id>|<class pattern>\n" +
359+ " -- break when specified exception occurs\n" +
360+ "ignore [uncaught|caught|all] <class id>|<class pattern>\n" +
361+ " -- cancel 'catch' for the specified exception\n" +
362+ "watch [access|all] <class id>.<field name>\n" +
363+ " -- watch access/modifications to a field\n" +
364+ "unwatch [access|all] <class id>.<field name>\n" +
365+ " -- discontinue watching access/modifications to a field\n" +
366+ "trace [go] methods [thread]\n" +
367+ " -- trace method entries and exits.\n" +
368+ " -- All threads are suspended unless 'go' is specified\n" +
369+ "trace [go] method exit | exits [thread]\n" +
370+ " -- trace the current method's exit, or all methods' exits\n" +
371+ " -- All threads are suspended unless 'go' is specified\n" +
372+ "untrace [methods] -- stop tracing method entrys and/or exits\n" +
373+ "step -- execute current line\n" +
374+ "step up -- execute until the current method returns to its caller\n" +
375+ "stepi -- execute current instruction\n" +
376+ "next -- step one line (step OVER calls)\n" +
377+ "cont -- continue execution from breakpoint\n" +
378+ "\n" +
379+ "list [line number|method] -- print source code\n" +
380+ "use (or sourcepath) [source file path]\n" +
381+ " -- display or change the source path\n" +
382+ "exclude [<class pattern>, ... | \"none\"]\n" +
383+ " -- do not report step or method events for specified classes\n" +
384+ "classpath -- print classpath info from target VM\n" +
385+ "\n" +
386+ "monitor <command> -- execute command each time the program stops\n" +
387+ "monitor -- list monitors\n" +
388+ "unmonitor <monitor#> -- delete a monitor\n" +
389+ "read <filename> -- read and execute a command file\n" +
390+ "\n" +
391+ "lock <expr> -- print lock info for an object\n" +
392+ "threadlocks [thread id] -- print lock info for a thread\n" +
393+ "\n" +
394+ "pop -- pop the stack through and including the current frame\n" +
395+ "reenter -- same as pop, but current frame is reentered\n" +
396+ "redefine <class id> <class file name>\n" +
397+ " -- redefine the code for a class\n" +
398+ "\n" +
399+ "disablegc <expr> -- prevent garbage collection of an object\n" +
400+ "enablegc <expr> -- permit garbage collection of an object\n" +
401+ "\n" +
402+ "!! -- repeat last command\n" +
403+ "<n> <command> -- repeat command n times\n" +
404+ "# <command> -- discard (no-op)\n" +
405+ "help (or ?) -- list commands\n" +
406+ "version -- print version information\n" +
407+ "exit (or quit) -- exit debugger\n" +
408+ "\n" +
409+ "<class id>: a full class name with package qualifiers\n" +
410+ "<class pattern>: a class name with a leading or trailing wildcard ('*')\n" +
411+ "<thread id>: thread number as reported in the 'threads' command\n" +
412+ "<expr>: a Java(TM) Programming Language expression.\n" +
413+ "Most common syntax is supported.\n" +
414+ "\n" +
415+ "Startup commands can be placed in either \"jdb.ini\" or \".jdbrc\"\n" +
416+ "in user.home or user.dir"},
417+ {"zz usage text",
418+ "Usage: {0} <options> <class> <arguments>\n" +
419+ "\n" +
420+ "where options include:\n" +
421+ " -help print out this message and exit\n" +
422+ " -sourcepath <directories separated by \"{1}\">\n" +
423+ " directories in which to look for source files\n" +
424+ " -attach <address>\n" +
425+ " attach to a running VM at the specified address using standard connector\n" +
426+ " -listen <address>\n" +
427+ " wait for a running VM to connect at the specified address using standard connector\n" +
428+ " -listenany\n" +
429+ " wait for a running VM to connect at any available address using standard connector\n" +
430+ " -launch\n" +
431+ " launch VM immediately instead of waiting for ''run'' command\n" +
432+ " -listconnectors list the connectors available in this VM\n" +
433+ " -connect <connector-name>:<name1>=<value1>,...\n" +
434+ " connect to target VM using named connector with listed argument values\n" +
435+ " -dbgtrace [flags] print info for debugging {0}\n" +
436+ " -tclient run the application in the HotSpot(TM) Client Compiler\n" +
437+ " -tserver run the application in the HotSpot(TM) Server Compiler\n" +
438+ "\n" +
439+ "options forwarded to debuggee process:\n" +
440+ " -v -verbose[:class|gc|jni]\n" +
441+ " turn on verbose mode\n" +
442+ " -D<name>=<value> set a system property\n" +
443+ " -classpath <directories separated by \"{1}\">\n" +
444+ " list directories in which to look for classes\n" +
445+ " -X<option> non-standard target VM option\n" +
446+ "\n" +
447+ "<class> is the name of the class to begin debugging\n" +
448+ "<arguments> are the arguments passed to the main() method of <class>\n" +
449+ "\n" +
450+ "For command help type ''help'' at {0} prompt"},
451+ // END OF MATERIAL TO LOCALIZE
452+ };
453+
454+ return temp;
455+ }
456+}
java/pkg/com/sun/tools/example/debug/tty/TTYResources_ja.java+327−0
@@ -0,0 +1,327 @@
1+/*
2+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+/**
29+ * <p> This class represents the <code>ResourceBundle</code>
30+ * for the following package(s):
31+ *
32+ * <ol>
33+ * <li> com.sun.tools.example.debug.tty
34+ * </ol>
35+ *
36+ */
37+public class TTYResources_ja extends java.util.ListResourceBundle {
38+
39+
40+ /**
41+ * Returns the contents of this <code>ResourceBundle</code>.
42+ *
43+ * <p>
44+ *
45+ * @return the contents of this <code>ResourceBundle</code>.
46+ */
47+ @Override
48+ public Object[][] getContents() {
49+ Object[][] temp = new Object[][] {
50+ // NOTE: The value strings in this file containing "{0}" are
51+ // processed by the java.text.MessageFormat class. Any
52+ // single quotes appearing in these strings need to be
53+ // doubled up.
54+ //
55+ // LOCALIZE THIS
56+ {"** classes list **", "** \u30AF\u30E9\u30B9\u30FB\u30EA\u30B9\u30C8 **\n{0}"},
57+ {"** fields list **", "** \u30D5\u30A3\u30FC\u30EB\u30C9\u30FB\u30EA\u30B9\u30C8 **\n{0}"},
58+ {"** methods list **", "** \u30E1\u30BD\u30C3\u30C9\u30FB\u30EA\u30B9\u30C8 **\n{0}"},
59+ {"*** Reading commands from", "*** {0}\u304B\u3089\u306E\u30B3\u30DE\u30F3\u30C9\u306E\u8AAD\u53D6\u308A"},
60+ {"All threads resumed.", "\u3059\u3079\u3066\u306E\u30B9\u30EC\u30C3\u30C9\u304C\u518D\u958B\u3055\u308C\u307E\u3057\u305F\u3002"},
61+ {"All threads suspended.", "\u3059\u3079\u3066\u306E\u30B9\u30EC\u30C3\u30C9\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F\u3002"},
62+ {"Argument is not defined for connector:", "\u5F15\u6570{0}\u306F\u30B3\u30CD\u30AF\u30BF\u306B\u5BFE\u3057\u3066\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {1}"},
63+ {"Arguments match no method", "\u5F15\u6570\u304C\u9069\u5408\u3059\u308B\u30E1\u30BD\u30C3\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
64+ {"Array:", "\u914D\u5217: {0}"},
65+ {"Array element is not a method", "\u914D\u5217\u8981\u7D20\u306F\u30E1\u30BD\u30C3\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
66+ {"Array index must be a integer type", "\u914D\u5217\u306E\u6DFB\u3048\u5B57\u306F\u6574\u6570\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
67+ {"base directory:", "\u30D9\u30FC\u30B9\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA: {0}"},
68+ {"bootclasspath:", "\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9: {0}"},
69+ {"Breakpoint hit:", "\u30D2\u30C3\u30C8\u3057\u305F\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8: "},
70+ {"breakpoint", "\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8{0}"},
71+ {"Breakpoints set:", "\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8:"},
72+ {"Breakpoints can be located only in classes.", "\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u306F\u30AF\u30E9\u30B9\u5185\u306B\u306E\u307F\u914D\u7F6E\u3067\u304D\u307E\u3059\u3002{0}\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u307E\u305F\u306F\u914D\u5217\u3067\u3059\u3002"},
73+ {"Can only trace", "'methods'\u3001'method exit'\u307E\u305F\u306F'method exits'\u306E\u307F\u30C8\u30EC\u30FC\u30B9\u3067\u304D\u307E\u3059"},
74+ {"cannot redefine existing connection", "{0}\u306F\u65E2\u5B58\u306E\u63A5\u7D9A\u3092\u518D\u5B9A\u7FA9\u3067\u304D\u307E\u305B\u3093"},
75+ {"Cannot assign to a method invocation", "\u30E1\u30BD\u30C3\u30C9\u547C\u51FA\u3057\u306B\u5272\u5F53\u3066\u3067\u304D\u307E\u305B\u3093"},
76+ {"Cannot specify command line with connector:", "\u30B3\u30CD\u30AF\u30BF\u3067\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093: {0}"},
77+ {"Cannot specify target vm arguments with connector:", "\u30B3\u30CD\u30AF\u30BF\u3067\u30BF\u30FC\u30B2\u30C3\u30C8VM\u5F15\u6570\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093: {0}"},
78+ {"Class containing field must be specified.", "\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u542B\u3080\u30AF\u30E9\u30B9\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"},
79+ {"Class:", "\u30AF\u30E9\u30B9: {0}"},
80+ {"Classic VM no longer supported.", "Classic VM\u306F\u73FE\u5728\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
81+ {"classpath:", "\u30AF\u30E9\u30B9\u30D1\u30B9: {0}"},
82+ {"colon mark", ":"},
83+ {"colon space", ": "},
84+ {"Command is not supported on the target VM", "\u30B3\u30DE\u30F3\u30C9''{0}''\u306F\u30BF\u30FC\u30B2\u30C3\u30C8VM\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
85+ {"Command is not supported on a read-only VM connection", "\u30B3\u30DE\u30F3\u30C9''{0}''\u306F\u8AAD\u53D6\u308A\u5C02\u7528VM\u63A5\u7D9A\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
86+ {"Command not valid until the VM is started with the run command", "\u30B3\u30DE\u30F3\u30C9''{0}''\u306F\u3001VM\u304C''run''\u30B3\u30DE\u30F3\u30C9\u3067\u958B\u59CB\u3055\u308C\u308B\u307E\u3067\u7121\u52B9\u3067\u3059"},
87+ {"Condition must be boolean", "\u6761\u4EF6\u306Fboolean\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
88+ {"Connector and Transport name", " \u30B3\u30CD\u30AF\u30BF: {0} \u30C8\u30E9\u30F3\u30B9\u30DD\u30FC\u30C8: {1}"},
89+ {"Connector argument nodefault", " \u5F15\u6570: {0} (\u30C7\u30D5\u30A9\u30EB\u30C8\u306A\u3057)"},
90+ {"Connector argument default", " \u5F15\u6570: {0} \u30C7\u30D5\u30A9\u30EB\u30C8\u5024: {1}"},
91+ {"Connector description", " \u8AAC\u660E: {0}"},
92+ {"Connector required argument nodefault", " \u5FC5\u9808\u5F15\u6570: {0} (\u30C7\u30D5\u30A9\u30EB\u30C8\u306A\u3057)"},
93+ {"Connector required argument default", " \u5FC5\u9808\u5F15\u6570: {0} \u30C7\u30D5\u30A9\u30EB\u30C8\u5024: {1}"},
94+ {"Connectors available", "\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30CD\u30AF\u30BF:"},
95+ {"Constant is not a method", "\u5B9A\u6570\u306F\u30E1\u30BD\u30C3\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
96+ {"Could not open:", "\u958B\u3051\u307E\u305B\u3093\u3067\u3057\u305F: {0}"},
97+ {"Current method is native", "\u73FE\u5728\u306E\u30E1\u30BD\u30C3\u30C9\u306Fnative\u3067\u3059"},
98+ {"Current thread died. Execution continuing...", "\u73FE\u5728\u306E\u30B9\u30EC\u30C3\u30C9{0}\u304C\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002\u5B9F\u884C\u304C\u7D9A\u884C\u4E2D..."},
99+ {"Current thread isnt suspended.", "\u73FE\u5728\u306E\u30B9\u30EC\u30C3\u30C9\u306F\u4E2D\u65AD\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
100+ {"Current thread not set.", "\u73FE\u5728\u306E\u30B9\u30EC\u30C3\u30C9\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
101+ {"dbgtrace flag value must be an integer:", "dbgtrace\u30D5\u30E9\u30B0\u5024\u306F\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}"},
102+ {"Deferring.", "\u9045\u5EF6\u3057\u305F{0}\u3002\n\u30AF\u30E9\u30B9\u304C\u30ED\u30FC\u30C9\u3055\u308C\u305F\u5F8C\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002"},
103+ {"End of stack.", "\u30B9\u30BF\u30C3\u30AF\u306E\u7D42\u308F\u308A\u3002"},
104+ {"Error popping frame", "\u30D5\u30EC\u30FC\u30E0\u306E\u30DD\u30C3\u30D7\u4E2D\u306E\u30A8\u30E9\u30FC - {0}"},
105+ {"Error reading file", "''{0}''\u306E\u8AAD\u53D6\u308A\u30A8\u30E9\u30FC - {1}"},
106+ {"Error redefining class to file", "{0}\u3092{1}\u306B\u518D\u5B9A\u7FA9\u4E2D\u306E\u30A8\u30E9\u30FC - {2}"},
107+ {"exceptionSpec all", "\u3059\u3079\u3066\u306E{0}"},
108+ {"exceptionSpec caught", "\u6355\u6349\u3057\u305F{0}"},
109+ {"exceptionSpec uncaught", "\u6355\u6349\u3055\u308C\u306A\u3044{0}"},
110+ {"Exception in expression:", "\u5F0F\u306E\u4F8B\u5916: {0}"},
111+ {"Exception occurred caught", "\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0} (\u6355\u6349\u3055\u308C\u308B\u5834\u6240: {1})"},
112+ {"Exception occurred uncaught", "\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0} (\u6355\u6349\u3055\u308C\u306A\u3044)"},
113+ {"Exceptions caught:", "\u6B21\u306E\u4F8B\u5916\u304C\u767A\u751F\u3057\u305F\u3068\u304D\u306B\u30D6\u30EC\u30FC\u30AF:"},
114+ {"expr is null", "{0} = null"},
115+ {"expr is value", "{0} = {1}"},
116+ {"expr is value <collected>", " {0} = {1} <collected>"},
117+ {"Expression cannot be void", "\u5F0F\u306Fvoid\u578B\u306B\u3067\u304D\u307E\u305B\u3093"},
118+ {"Expression must evaluate to an object", "\u5F0F\u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3068\u3057\u3066\u8A55\u4FA1\u3055\u308C\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
119+ {"extends:", "\u62E1\u5F35\u3057\u307E\u3059: {0}"},
120+ {"Failed reading output", "\u5B50\u306Ejava\u30A4\u30F3\u30BF\u30FC\u30D7\u30EA\u30BF\u306E\u51FA\u529B\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002"},
121+ {"Fatal error", "\u81F4\u547D\u7684\u30A8\u30E9\u30FC:"},
122+ {"Field access encountered before after", "\u30D5\u30A3\u30FC\u30EB\u30C9({0})\u306F{1}\u3067\u3001{2}\u306B\u306A\u308A\u307E\u3059: "},
123+ {"Field access encountered", "\u30D5\u30A3\u30FC\u30EB\u30C9({0})\u306E\u30A2\u30AF\u30BB\u30B9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F: "},
124+ {"Field to unwatch not specified", "\u76E3\u8996\u3057\u306A\u3044\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
125+ {"Field to watch not specified", "\u76E3\u8996\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
126+ {"GC Disabled for", "{0}\u306EGC\u304C\u7121\u52B9\u3067\u3059:"},
127+ {"GC Enabled for", "{0}\u306EGC\u304C\u6709\u52B9\u3067\u3059:"},
128+ {"grouping begin character", "{"},
129+ {"grouping end character", "}"},
130+ {"Illegal Argument Exception", "\u4E0D\u6B63\u306A\u5F15\u6570\u306E\u4F8B\u5916\u3067\u3059"},
131+ {"Illegal connector argument", "\u4E0D\u6B63\u306A\u30B3\u30CD\u30AF\u30BF\u5F15\u6570\u3067\u3059: {0}"},
132+ {"implementor:", "\u30A4\u30F3\u30D7\u30EA\u30E1\u30F3\u30BF: {0}"},
133+ {"implements:", "\u5B9F\u88C5\u3057\u307E\u3059: {0}"},
134+ {"Initializing progname", "{0}\u306E\u521D\u671F\u5316\u4E2D..."},
135+ {"Input stream closed.", "\u5165\u529B\u30B9\u30C8\u30EA\u30FC\u30E0\u304C\u9589\u3058\u3089\u308C\u307E\u3057\u305F\u3002"},
136+ {"Interface:", "\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9: {0}"},
137+ {"Internal debugger error.", "\u30C7\u30D0\u30C3\u30AC\u306E\u5185\u90E8\u30A8\u30E9\u30FC\u3067\u3059\u3002"},
138+ {"Internal error: null ThreadInfo created", "\u5185\u90E8\u30A8\u30E9\u30FC: null\u306EThreadInfo\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F"},
139+ {"Internal error; unable to set", "\u5185\u90E8\u30A8\u30E9\u30FC\u3002{0}\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093"},
140+ {"Internal exception during operation:", "\u64CD\u4F5C\u4E2D\u306E\u5185\u90E8\u4F8B\u5916:\n {0}"},
141+ {"Internal exception:", "\u5185\u90E8\u4F8B\u5916:"},
142+ {"Invalid argument type name", "\u5F15\u6570\u578B\u306E\u540D\u524D\u304C\u7121\u52B9\u3067\u3059"},
143+ {"Invalid assignment syntax", "\u5272\u5F53\u3066\u69CB\u6587\u304C\u7121\u52B9\u3067\u3059"},
144+ {"Invalid command syntax", "\u30B3\u30DE\u30F3\u30C9\u69CB\u6587\u304C\u7121\u52B9\u3067\u3059"},
145+ {"Invalid connect type", "\u63A5\u7D9A\u578B\u304C\u7121\u52B9\u3067\u3059"},
146+ {"Invalid consecutive invocations", "\u9023\u7D9A\u547C\u51FA\u3057\u304C\u7121\u52B9\u3067\u3059"},
147+ {"Invalid exception object", "\u4F8B\u5916\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u7121\u52B9\u3067\u3059"},
148+ {"Invalid method specification:", "\u7121\u52B9\u306A\u30E1\u30BD\u30C3\u30C9\u6307\u5B9A: {0}"},
149+ {"Invalid option on class command", "class\u30B3\u30DE\u30F3\u30C9\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u7121\u52B9\u3067\u3059"},
150+ {"invalid option", "\u7121\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}"},
151+ {"Invalid thread status.", "\u30B9\u30EC\u30C3\u30C9\u72B6\u614B\u304C\u7121\u52B9\u3067\u3059\u3002"},
152+ {"Invalid transport name:", "\u30C8\u30E9\u30F3\u30B9\u30DD\u30FC\u30C8\u540D\u304C\u7121\u52B9\u3067\u3059: {0}"},
153+ {"I/O exception occurred:", "\u5165\u51FA\u529B\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0}"},
154+ {"is an ambiguous method name in", "\"{0}\"\u306F\"{1}\"\u306E\u3042\u3044\u307E\u3044\u306A\u30E1\u30BD\u30C3\u30C9\u540D\u3067\u3059"},
155+ {"is an invalid line number for", "{0,number,integer}\u306F{1}\u306E\u7121\u52B9\u306A\u884C\u756A\u53F7\u3067\u3059"},
156+ {"is not a valid class name", "\"{0}\"\u306F\u4E0D\u6B63\u306A\u30AF\u30E9\u30B9\u540D\u3067\u3059\u3002"},
157+ {"is not a valid field name", "\"{0}\"\u306F\u4E0D\u6B63\u306A\u30D5\u30A3\u30FC\u30EB\u30C9\u540D\u3067\u3059\u3002"},
158+ {"is not a valid id or class name", "\"{0}\"\u306F\u4E0D\u6B63\u306AID\u307E\u305F\u306F\u30AF\u30E9\u30B9\u540D\u3067\u3059\u3002"},
159+ {"is not a valid line number or method name for", "\"{0}\"\u306F\u30AF\u30E9\u30B9\"{1}\"\u306E\u4E0D\u6B63\u306A\u884C\u756A\u53F7\u307E\u305F\u306F\u30E1\u30BD\u30C3\u30C9\u540D\u3067\u3059"},
160+ {"is not a valid method name", "\"{0}\"\u306F\u4E0D\u6B63\u306A\u30E1\u30BD\u30C3\u30C9\u540D\u3067\u3059\u3002"},
161+ {"is not a valid thread id", "\"{0}\"\u306F\u4E0D\u6B63\u306A\u30B9\u30EC\u30C3\u30C9ID\u3067\u3059\u3002"},
162+ {"is not a valid threadgroup name", "\"{0}\"\u306F\u4E0D\u6B63\u306A\u30B9\u30EC\u30C3\u30C9\u30FB\u30B0\u30EB\u30FC\u30D7\u540D\u3067\u3059\u3002"},
163+ {"jdb prompt with no current thread", "> "},
164+ {"jdb prompt thread name and current stack frame", "{0}[{1,number,integer}] "},
165+ {"killed", "{0}\u304C\u5F37\u5236\u7D42\u4E86\u3055\u308C\u307E\u3057\u305F"},
166+ {"killing thread:", "\u5F37\u5236\u7D42\u4E86\u3059\u308B\u30B9\u30EC\u30C3\u30C9: {0}"},
167+ {"Line number information not available for", "\u30BD\u30FC\u30B9\u884C\u756A\u53F7\u306F\u3053\u306E\u5834\u6240\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002"},
168+ {"line number", ":{0,number,integer}"},
169+ {"list field typename and name", "{0} {1}\n"},
170+ {"list field typename and name inherited", "{0} {1} ({2}\u304B\u3089\u7D99\u627F)\n"},
171+ {"list field typename and name hidden", "{0} {1} (\u975E\u8868\u793A)\n"},
172+ {"Listening at address:", "\u6B21\u306E\u30A2\u30C9\u30EC\u30B9\u3067\u30EA\u30B9\u30CB\u30F3\u30B0: {0}"},
173+ {"Local variable information not available.", "\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u5909\u6570\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\u306B\u306F-g\u3092\u6307\u5B9A\u3057\u3066\u30B3\u30F3\u30D1\u30A4\u30EB\u3057\u3066\u304F\u3060\u3055\u3044"},
174+ {"Local variables:", "\u30ED\u30FC\u30AB\u30EB\u5909\u6570:"},
175+ {"<location unavailable>", "<location unavailable>"},
176+ {"location", "\"\u30B9\u30EC\u30C3\u30C9={0}\", {1}"},
177+ {"locationString", "{0}.{1}()\u3001\u884C={2,number,integer} bci={3,number,integer}"},
178+ {"Main class and arguments must be specified", "\u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9\u3068\u5F15\u6570\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
179+ {"Method arguments:", "\u30E1\u30BD\u30C3\u30C9\u5F15\u6570:"},
180+ {"Method entered:", "\u5165\u529B\u3055\u308C\u305F\u30E1\u30BD\u30C3\u30C9: "},
181+ {"Method exited:", "\u7D42\u4E86\u3057\u305F\u30E1\u30BD\u30C3\u30C9"},
182+ {"Method exitedValue:", "\u30E1\u30BD\u30C3\u30C9\u304C\u7D42\u4E86\u3057\u307E\u3057\u305F: \u623B\u308A\u5024= {0}, "},
183+ {"Method is overloaded; specify arguments", "\u30E1\u30BD\u30C3\u30C9{0}\u304C\u30AA\u30FC\u30D0\u30FC\u30ED\u30FC\u30C9\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u5F15\u6570\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"},
184+ {"minus version", "\u3053\u308C\u306F{0}\u30D0\u30FC\u30B8\u30E7\u30F3{1,number,integer}.{2,number,integer} (Java SE\u30D0\u30FC\u30B8\u30E7\u30F3{3})\u3067\u3059"},
185+ {"Monitor information for thread", "\u30B9\u30EC\u30C3\u30C9{0}\u306E\u60C5\u5831\u306E\u30E2\u30CB\u30BF\u30FC:"},
186+ {"Monitor information for expr", "{0} ({1})\u306E\u60C5\u5831\u306E\u30E2\u30CB\u30BF\u30FC:"},
187+ {"More than one class named", "\u540D\u524D''{0}''\u306E\u30AF\u30E9\u30B9\u304C\u8907\u6570\u3042\u308A\u307E\u3059"},
188+ {"native method", "native\u30E1\u30BD\u30C3\u30C9"},
189+ {"nested:", "\u30CD\u30B9\u30C8\u3055\u308C\u3066\u3044\u307E\u3059: {0}"},
190+ {"No attach address specified.", "\u63A5\u7D9A\u30A2\u30C9\u30EC\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
191+ {"No breakpoints set.", "\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
192+ {"No class named", "\u540D\u524D''{0}''\u306E\u30AF\u30E9\u30B9\u304C\u3042\u308A\u307E\u305B\u3093"},
193+ {"No class specified.", "\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
194+ {"No classpath specified.", "\u30AF\u30E9\u30B9\u30D1\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
195+ {"No code at line", "{1}\u306E\u884C{0,number,integer}\u306B\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
196+ {"No connect specification.", "\u63A5\u7D9A\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
197+ {"No connector named:", "\u540D\u524D{0}\u306E\u30B3\u30CD\u30AF\u30BF\u304C\u3042\u308A\u307E\u305B\u3093"},
198+ {"No current thread", "\u73FE\u5728\u306E\u30B9\u30EC\u30C3\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
199+ {"No default thread specified:", "\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u30B9\u30EC\u30C3\u30C9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u6700\u521D\u306B\"thread\"\u30B3\u30DE\u30F3\u30C9\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
200+ {"No exception object specified.", "\u4F8B\u5916\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
201+ {"No exceptions caught.", "\u4F8B\u5916\u304C\u6355\u6349\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002"},
202+ {"No expression specified.", "\u5F0F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
203+ {"No field in", "{1}\u306B\u30D5\u30A3\u30FC\u30EB\u30C9{0}\u304C\u3042\u308A\u307E\u305B\u3093"},
204+ {"No frames on the current call stack", "\u73FE\u5728\u306E\u30B3\u30FC\u30EB\u30FB\u30B9\u30BF\u30C3\u30AF\u306B\u30D5\u30EC\u30FC\u30E0\u304C\u3042\u308A\u307E\u305B\u3093"},
205+ {"No linenumber information for", "{0}\u306E\u884C\u756A\u53F7\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u30C7\u30D0\u30C3\u30B0\u3092\u30AA\u30F3\u306B\u3057\u3066\u30B3\u30F3\u30D1\u30A4\u30EB\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
206+ {"No local variables", "\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u304C\u3042\u308A\u307E\u305B\u3093"},
207+ {"No method in", "{1}\u306B\u30E1\u30BD\u30C3\u30C9{0}\u304C\u3042\u308A\u307E\u305B\u3093"},
208+ {"No method specified.", "\u30E1\u30BD\u30C3\u30C9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
209+ {"No monitor numbered:", "\u756A\u53F7\u4ED8\u3051\u3055\u308C\u3066\u3044\u308B\u30E2\u30CB\u30BF\u30FC\u304C\u3042\u308A\u307E\u305B\u3093: {0}"},
210+ {"No monitors owned", " \u6240\u6709\u3055\u308C\u3066\u3044\u308B\u30E2\u30CB\u30BF\u30FC\u304C\u3042\u308A\u307E\u305B\u3093"},
211+ {"No object specified.", "\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
212+ {"No objects specified.", "\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
213+ {"No save index specified.", "\u4FDD\u5B58\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
214+ {"No saved values", "\u4FDD\u5B58\u3055\u308C\u305F\u5024\u304C\u3042\u308A\u307E\u305B\u3093"},
215+ {"No source information available for:", "{0}\u306E\u30BD\u30FC\u30B9\u60C5\u5831\u304C\u5229\u7528\u3067\u304D\u307E\u305B\u3093"},
216+ {"No sourcedebugextension specified", "SourceDebugExtension\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
217+ {"No sourcepath specified.", "\u30BD\u30FC\u30B9\u30FB\u30D1\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
218+ {"No thread specified.", "\u30B9\u30EC\u30C3\u30C9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
219+ {"No VM connected", "VM\u304C\u63A5\u7D9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
220+ {"No waiters", " \u5F85\u6A5F\u306F\u3042\u308A\u307E\u305B\u3093"},
221+ {"not a class", "{0}\u306F\u30AF\u30E9\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
222+ {"Not a monitor number:", "\u30E2\u30CB\u30BF\u30FC\u756A\u53F7\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ''{0}''"},
223+ {"not found (try the full name)", "{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093(\u30D5\u30EB\u30CD\u30FC\u30E0\u3092\u8A66\u3057\u3066\u304F\u3060\u3055\u3044)"},
224+ {"Not found:", "\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}"},
225+ {"not found", "{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},
226+ {"Not owned", " \u6240\u6709\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
227+ {"Not waiting for a monitor", " \u30E2\u30CB\u30BF\u30FC\u3092\u5F85\u6A5F\u3057\u3066\u3044\u307E\u305B\u3093"},
228+ {"Nothing suspended.", "\u4F55\u3082\u4E2D\u65AD\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
229+ {"object description and hex id", "({0}){1}"},
230+ {"Operation is not supported on the target VM", "\u64CD\u4F5C\u306F\u30BF\u30FC\u30B2\u30C3\u30C8VM\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
231+ {"operation not yet supported", "\u307E\u3060\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u64CD\u4F5C"},
232+ {"Owned by:", " \u6240\u6709\u8005: {0}\u3001\u30A8\u30F3\u30C8\u30EA\u6570: {1,number,integer}"},
233+ {"Owned monitor:", " \u6240\u6709\u3055\u308C\u3066\u3044\u308B\u30E2\u30CB\u30BF\u30FC: {0}"},
234+ {"Parse exception:", "\u4F8B\u5916\u306E\u89E3\u6790: {0}"},
235+ {"printbreakpointcommandusage", "\u4F7F\u7528\u65B9\u6CD5: {0} <class>:<line_number>\u307E\u305F\u306F\n {1} <class>.<method_name>[(argument_type,...)]"},
236+ {"Removed:", "{0}\u306F\u524A\u9664\u3055\u308C\u307E\u3057\u305F"},
237+ {"Requested stack frame is no longer active:", "\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u305F\u30B9\u30BF\u30C3\u30AF\u30FB\u30D5\u30EC\u30FC\u30E0\u306F\u73FE\u5728\u30A2\u30AF\u30C6\u30A3\u30D6\u3067\u306F\u3042\u308A\u307E\u305B\u3093: {0,number,integer}"},
238+ {"run <args> command is valid only with launched VMs", "'run <args>'\u30B3\u30DE\u30F3\u30C9\u306F\u8D77\u52D5\u6E08\u306EVM\u3067\u306E\u307F\u6709\u52B9\u3067\u3059"},
239+ {"run", "{0}\u306E\u5B9F\u884C"},
240+ {"saved", "{0}\u304C\u4FDD\u5B58\u3055\u308C\u307E\u3057\u305F"},
241+ {"Set deferred", "\u9045\u5EF6\u3057\u305F{0}\u306E\u8A2D\u5B9A"},
242+ {"Set", "{0}\u306E\u8A2D\u5B9A"},
243+ {"Source file not found:", "\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}"},
244+ {"source line number and line", "{0,number,integer} {1}"},
245+ {"source line number current line and line", "{0,number,integer} => {1}"},
246+ {"sourcedebugextension", "SourceDebugExtension -- {0}"},
247+ {"Specify class and method", "\u30AF\u30E9\u30B9\u3068\u30E1\u30BD\u30C3\u30C9\u306E\u6307\u5B9A"},
248+ {"Specify classes to redefine", "\u518D\u5B9A\u7FA9\u3059\u308B\u30AF\u30E9\u30B9\u306E\u6307\u5B9A"},
249+ {"Specify file name for class", "\u30AF\u30E9\u30B9{0}\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u306E\u6307\u5B9A"},
250+ {"stack frame dump with pc", " [{0,number,integer}] {1}.{2} ({3})\u3001pc = {4}"},
251+ {"stack frame dump", " [{0,number,integer}] {1}.{2} ({3})"},
252+ {"Step completed:", "\u30B9\u30C6\u30C3\u30D7\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F: "},
253+ {"Stopping due to deferred breakpoint errors.", "\u9045\u5EF6\u3057\u305F\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u30FB\u30A8\u30E9\u30FC\u304C\u539F\u56E0\u3067\u505C\u6B62\u3057\u3066\u3044\u307E\u3059\u3002\n"},
254+ {"subclass:", "\u30B5\u30D6\u30AF\u30E9\u30B9: {0}"},
255+ {"subinterface:", "\u30B5\u30D6\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9: {0}"},
256+ {"tab", "\t{0}"},
257+ {"Target VM failed to initialize.", "\u30BF\u30FC\u30B2\u30C3\u30C8VM\u304C\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002"},
258+ {"The application exited", "\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u304C\u7D42\u4E86\u3057\u307E\u3057\u305F"},
259+ {"The application has been disconnected", "\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u304C\u5207\u65AD\u3055\u308C\u307E\u3057\u305F"},
260+ {"The gc command is no longer necessary.", "'gc'\u30B3\u30DE\u30F3\u30C9\u306F\u4E0D\u8981\u306B\u306A\u308A\u307E\u3057\u305F\u3002\n\u3059\u3079\u3066\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306F\u901A\u5E38\u3069\u304A\u308A\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3055\u308C\u307E\u3059\u3002\u500B\u3005\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\n\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u5236\u5FA1\u3059\u308B\u306B\u306F'enablegc'\u304A\u3088\u3073'disablegc'\u30B3\u30DE\u30F3\u30C9\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
261+ {"The load command is no longer supported.", "'load'\u30B3\u30DE\u30F3\u30C9\u306F\u73FE\u5728\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
262+ {"The memory command is no longer supported.", "'memory'\u30B3\u30DE\u30F3\u30C9\u306F\u73FE\u5728\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
263+ {"The VM does not use paths", "VM\u306F\u30D1\u30B9\u3092\u4F7F\u7528\u3057\u307E\u305B\u3093"},
264+ {"Thread is not running (no stack).", "\u30B9\u30EC\u30C3\u30C9\u306F\u5B9F\u884C\u4E2D\u3067\u306F\u3042\u308A\u307E\u305B\u3093(\u30B9\u30BF\u30C3\u30AF\u306A\u3057)\u3002"},
265+ {"Thread number not specified.", "\u30B9\u30EC\u30C3\u30C9\u756A\u53F7\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
266+ {"Thread:", "{0}:"},
267+ {"Thread Group:", "\u30B0\u30EB\u30FC\u30D7{0}:"},
268+ {"Thread description name unknownStatus BP", " {0} {1}\u306F\u4E0D\u660E\u3067\u3059(\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8)"},
269+ {"Thread description name unknownStatus", " {0} {1}\u306F\u4E0D\u660E\u3067\u3059"},
270+ {"Thread description name zombieStatus BP", " {0} {1}\u306F\u30BE\u30F3\u30D3\u3067\u3059(\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u5730\u70B9)"},
271+ {"Thread description name zombieStatus", " {0} {1}\u306F\u30BE\u30F3\u30D3\u3067\u3059"},
272+ {"Thread description name runningStatus BP", " {0} {1}\u306F\u5B9F\u884C\u4E2D\u3067\u3059(\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8)"},
273+ {"Thread description name runningStatus", " {0} {1}\u306F\u5B9F\u884C\u4E2D\u3067\u3059"},
274+ {"Thread description name sleepingStatus BP", " {0} {1}\u306F\u30B9\u30EA\u30FC\u30D7\u4E2D\u3067\u3059(\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8)"},
275+ {"Thread description name sleepingStatus", " {0} {1}\u306F\u30B9\u30EA\u30FC\u30D7\u4E2D\u3067\u3059"},
276+ {"Thread description name waitingStatus BP", " {0} {1}\u306F\u30E2\u30CB\u30BF\u30FC\u5185\u3067\u5F85\u6A5F\u4E2D\u3067\u3059(\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8)"},
277+ {"Thread description name waitingStatus", " {0} {1}\u306F\u30E2\u30CB\u30BF\u30FC\u5185\u3067\u5F85\u6A5F\u4E2D\u3067\u3059"},
278+ {"Thread description name condWaitstatus BP", " {0} {1}\u306F\u6761\u4EF6\u3092\u5F85\u6A5F\u4E2D\u3067\u3059(\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8)"},
279+ {"Thread description name condWaitstatus", " {0} {1}\u306F\u6761\u4EF6\u3092\u5F85\u6A5F\u4E2D\u3067\u3059"},
280+ {"Thread has been resumed", "\u30B9\u30EC\u30C3\u30C9\u304C\u518D\u958B\u3057\u307E\u3057\u305F"},
281+ {"Thread not suspended", "\u30B9\u30EC\u30C3\u30C9\u306F\u4E2D\u65AD\u3057\u3066\u3044\u307E\u305B\u3093"},
282+ {"thread group number description name", "{0,number,integer}. {1} {2}"},
283+ {"Threadgroup name not specified.", "\u30B9\u30EC\u30C3\u30C9\u30B0\u30EB\u30FC\u30D7\u540D\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
284+ {"Threads must be suspended", "\u30B9\u30EC\u30C3\u30C9\u3092\u4E2D\u65AD\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
285+ {"trace method exit in effect for", "{0}\u306B\u5BFE\u3057\u3066\u6709\u52B9\u306A\u30E1\u30BD\u30C3\u30C9\u7D42\u4E86\u306E\u30C8\u30EC\u30FC\u30B9"},
286+ {"trace method exits in effect", "\u6709\u52B9\u306A\u30E1\u30BD\u30C3\u30C9\u7D42\u4E86\u306E\u30C8\u30EC\u30FC\u30B9"},
287+ {"trace methods in effect", "\u30E1\u30BD\u30C3\u30C9\u306E\u30C8\u30EC\u30FC\u30B9\u306E\u6709\u52B9\u5316"},
288+ {"trace go method exit in effect for", "{0}\u306B\u6709\u52B9\u306Ago\u30E1\u30BD\u30C3\u30C9\u7D42\u4E86\u306E\u30C8\u30EC\u30FC\u30B9"},
289+ {"trace go method exits in effect", "\u6709\u52B9\u306Ago\u30E1\u30BD\u30C3\u30C9\u7D42\u4E86\u306E\u30C8\u30EC\u30FC\u30B9"},
290+ {"trace go methods in effect", "go\u30E1\u30BD\u30C3\u30C9\u306E\u30C8\u30EC\u30FC\u30B9\u306E\u6709\u52B9\u5316"},
291+ {"trace not in effect", "\u30C8\u30EC\u30FC\u30B9\u306E\u7121\u52B9\u5316"},
292+ {"Unable to attach to target VM.", "\u30BF\u30FC\u30B2\u30C3\u30C8VM\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3002"},
293+ {"Unable to display process output:", "\u30D7\u30ED\u30BB\u30B9\u51FA\u529B\u3092\u8868\u793A\u3067\u304D\u307E\u305B\u3093: {0}"},
294+ {"Unable to launch target VM.", "\u30BF\u30FC\u30B2\u30C3\u30C8VM\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093\u3002"},
295+ {"Unable to set deferred", "\u9045\u5EF6\u3057\u305F{0}\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093: {1}"},
296+ {"Unable to set main class and arguments", "\u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9\u3068\u5F15\u6570\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093"},
297+ {"Unable to set", "{0}\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093: {1}"},
298+ {"Unexpected event type", "\u4E88\u671F\u3057\u306A\u3044\u30A4\u30D9\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7: {0}"},
299+ {"unknown", "\u4E0D\u660E"},
300+ {"Unmonitoring", "{0}\u306E\u30E2\u30CB\u30BF\u30EA\u30F3\u30B0\u89E3\u9664 "},
301+ {"Unrecognized command. Try help...", "''{0}''\u306F\u8A8D\u8B58\u3055\u308C\u306A\u3044\u30B3\u30DE\u30F3\u30C9\u3067\u3059\u3002help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044..."},
302+ {"Usage: catch exception", "\u4F7F\u7528\u65B9\u6CD5: catch [uncaught|caught|all] <class id>|<class pattern>"},
303+ {"Usage: ignore exception", "\u4F7F\u7528\u65B9\u6CD5: ignore [uncaught|caught|all] <class id>|<class pattern>"},
304+ {"Usage: down [n frames]", "\u4F7F\u7528\u65B9\u6CD5: down [n frames]"},
305+ {"Usage: kill <thread id> <throwable>", "\u4F7F\u7528\u65B9\u6CD5: kill <thread id> <throwable>"},
306+ {"Usage: read <command-filename>", "\u4F7F\u7528\u65B9\u6CD5: read <command-filename>"},
307+ {"Usage: unmonitor <monitor#>", "\u4F7F\u7528\u65B9\u6CD5: unmonitor <monitor#>"},
308+ {"Usage: up [n frames]", "\u4F7F\u7528\u65B9\u6CD5: up [n frames]"},
309+ {"Use java minus X to see", "\u4F7F\u7528\u53EF\u80FD\u306A\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8868\u793A\u3059\u308B\u306B\u306F'java -X'\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044"},
310+ {"Use stop at to set a breakpoint at a line number", "\u884C\u756A\u53F7\u306B\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u3092\u8A2D\u5B9A\u3059\u308B\u306B\u306F'stop at'\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044"},
311+ {"VM already running. use cont to continue after events.", "VM\u306F\u3059\u3067\u306B\u5B9F\u884C\u4E2D\u3067\u3059\u3002\u30A4\u30D9\u30F3\u30C8\u5F8C\u306B\u7D9A\u884C\u3059\u308B\u306B\u306F'cont'\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
312+ {"VM Started:", "VM\u304C\u958B\u59CB\u3055\u308C\u307E\u3057\u305F: "},
313+ {"vmstartexception", "VM\u304C\u4F8B\u5916\u3092\u958B\u59CB\u3057\u307E\u3057\u305F: {0}"},
314+ {"Waiting for monitor:", " \u30E2\u30CB\u30BF\u30FC\u306E\u5F85\u6A5F\u4E2D: {0}"},
315+ {"Waiting thread:", " \u30B9\u30EC\u30C3\u30C9\u3092\u5F85\u6A5F\u4E2D: {0}"},
316+ {"watch accesses of", "{0}.{1}\u306E\u30A2\u30AF\u30BB\u30B9\u3092\u76E3\u8996"},
317+ {"watch modification of", "{0}.{1}\u306E\u5909\u66F4\u306E\u76E3\u8996"},
318+ {"zz help text",
319+ "** \u30B3\u30DE\u30F3\u30C9\u30FB\u30EA\u30B9\u30C8 **\nconnectors -- \u3053\u306EVM\u5185\u306E\u4F7F\u7528\u53EF\u80FD\u306A\u30B3\u30CD\u30AF\u30BF\u3068\u30C8\u30E9\u30F3\u30B9\u30DD\u30FC\u30C8\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\n\nrun [class [args]] -- \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9\u306E\u5B9F\u884C\u3092\u958B\u59CB\u3057\u307E\u3059\n\nthreads [threadgroup] -- \u30B9\u30EC\u30C3\u30C9\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\nthread <thread id> -- \u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u30B9\u30EC\u30C3\u30C9\u3092\u8A2D\u5B9A\u3057\u307E\u3059\nsuspend [thread id(s)] -- \u30B9\u30EC\u30C3\u30C9\u3092\u4E2D\u65AD\u3057\u307E\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8: \u3059\u3079\u3066)\nresume [thread id(s)] -- \u30B9\u30EC\u30C3\u30C9\u3092\u518D\u958B\u3057\u307E\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8: \u3059\u3079\u3066)\nwhere [<thread id> | all] -- \u30B9\u30EC\u30C3\u30C9\u306E\u30B9\u30BF\u30C3\u30AF\u3092\u30C0\u30F3\u30D7\u3057\u307E\u3059\nwherei [<thread id> | all]-- \u30B9\u30EC\u30C3\u30C9\u306E\u30B9\u30BF\u30C3\u30AF\u3092pc\u60C5\u5831\u3068\u3068\u3082\u306B\u30C0\u30F3\u30D7\u3057\u307E\u3059\nup [n frames] -- \u30B9\u30EC\u30C3\u30C9\u306E\u30B9\u30BF\u30C3\u30AF\u3092\u4E0A\u306B\u79FB\u52D5\u3057\u307E\u3059\ndown [n frames] -- \u30B9\u30EC\u30C3\u30C9\u306E\u30B9\u30BF\u30C3\u30AF\u3092\u4E0B\u306B\u79FB\u52D5\u3057\u307E\u3059\nkill <thread id> <expr> -- \u6307\u5B9A\u3055\u308C\u305F\u4F8B\u5916\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u30B9\u30EC\u30C3\u30C9\u3092\u5F37\u5236\u7D42\u4E86\u3057\u307E\u3059\ninterrupt <thread id> -- \u30B9\u30EC\u30C3\u30C9\u3092\u4E2D\u65AD\u3057\u307E\u3059\n\nprint <expr> -- \u5F0F\u306E\u5024\u3092\u51FA\u529B\u3057\u307E\u3059\ndump <expr> -- \u3059\u3079\u3066\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u60C5\u5831\u3092\u51FA\u529B\u3057\u307E\u3059\neval <expr> -- \u5F0F\u3092\u8A55\u4FA1\u3057\u307E\u3059(print\u3068\u540C\u3058)\nset <lvalue> = <expr> -- \u65B0\u3057\u3044\u5024\u3092\u30D5\u30A3\u30FC\u30EB\u30C9/\u5909\u6570/\u914D\u5217\u8981\u7D20\u306B\u4EE3\u5165\u3057\u307E\u3059\nlocals -- \u73FE\u5728\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30D5\u30EC\u30FC\u30E0\u5185\u306E\u3059\u3079\u3066\u306E\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u3092\u51FA\u529B\u3057\u307E\u3059\n\nclasses -- \u73FE\u5728\u65E2\u77E5\u306E\u30AF\u30E9\u30B9\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\nclass <class id> -- \u6307\u5B9A\u3057\u305F\u30AF\u30E9\u30B9\u306E\u8A73\u7D30\u3092\u8868\u793A\u3057\u307E\u3059\nmethods <class id> -- \u30AF\u30E9\u30B9\u306E\u30E1\u30BD\u30C3\u30C9\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\nfields <class id> -- \u30AF\u30E9\u30B9\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\n\nthreadgroups -- \u30B9\u30EC\u30C3\u30C9\u30B0\u30EB\u30FC\u30D7\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\nthreadgroup <name> -- \u73FE\u5728\u306E\u30B9\u30EC\u30C3\u30C9\u30B0\u30EB\u30FC\u30D7\u3092\u8A2D\u5B9A\u3057\u307E\u3059\n\nstop in <class id>.<method>[(argument_type,...)]\n -- \u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u3092\u30E1\u30BD\u30C3\u30C9\u5185\u306B\u8A2D\u5B9A\u3057\u307E\u3059\nstop at <class id>:<line> -- \u884C\u306B\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u3092\u8A2D\u5B9A\u3057\u307E\u3059\nclear <class id>.<method>[(argument_type,...)]\n -- \u30E1\u30BD\u30C3\u30C9\u5185\u306E\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u3092\u30AF\u30EA\u30A2\u3057\u307E\u3059\nclear <class id>:<line> -- \u884C\u306E\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u3092\u30AF\u30EA\u30A2\u3057\u307E\u3059\nclear -- \u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\ncatch [uncaught|caught|all] <class id>|<class pattern>\n -- \u6307\u5B9A\u3055\u308C\u305F\u4F8B\u5916\u304C\u767A\u751F\u3057\u305F\u3068\u304D\u306B\u30D6\u30EC\u30FC\u30AF\u3057\u307E\u3059\nignore [uncaught|caught|all] <class id>|<class pattern>\n -- \u6307\u5B9A\u3055\u308C\u305F\u4F8B\u5916\u306E'catch'\u3092\u53D6\u308A\u6D88\u3057\u307E\u3059\nwatch [access|all] <class id>.<field name>\n -- \u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u307E\u305F\u306F\u5909\u66F4\u3092\u76E3\u8996\u3057\u307E\u3059\nunwatch [access|all] <class id>.<field name>\n -- \u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u307E\u305F\u306F\u5909\u66F4\u306E\u76E3\u8996\u3092\u4E2D\u6B62\u3057\u307E\u3059\ntrace [go] methods [thread]\n -- \u30E1\u30BD\u30C3\u30C9\u306E\u5165\u308A\u53E3\u3068\u51FA\u53E3\u3092\u30C8\u30EC\u30FC\u30B9\u3057\u307E\u3059\u3002\n -- 'go'\u304C\u6307\u5B9A\u3055\u308C\u308B\u307E\u3067\u3059\u3079\u3066\u306E\u30B9\u30EC\u30C3\u30C9\u306F\u4E2D\u65AD\u3057\u307E\u3059\ntrace [go] method exit | exits [thread]\n -- \u73FE\u5728\u306E\u30E1\u30BD\u30C3\u30C9\u306E\u51FA\u53E3\u307E\u305F\u306F\u3059\u3079\u3066\u306E\u30E1\u30BD\u30C3\u30C9\u306E\u51FA\u53E3\u3092\u30C8\u30EC\u30FC\u30B9\u3057\u307E\u3059\n -- 'go'\u304C\u6307\u5B9A\u3055\u308C\u308B\u307E\u3067\u3059\u3079\u3066\u306E\u30B9\u30EC\u30C3\u30C9\u306F\u4E2D\u65AD\u3057\u307E\u3059\nuntrace [methods] -- \u30E1\u30BD\u30C3\u30C9\u306E\u958B\u59CB\u307E\u305F\u306F\u7D42\u4E86\u306E\u30C8\u30EC\u30FC\u30B9\u3092\u505C\u6B62\u3057\u307E\u3059\nstep -- \u73FE\u5728\u306E\u884C\u3092\u5B9F\u884C\u3057\u307E\u3059\nstep up -- \u73FE\u5728\u306E\u30E1\u30BD\u30C3\u30C9\u304C\u30E1\u30BD\u30C3\u30C9\u306E\u547C\u51FA\u3057\u5143\u306B\u623B\u308B\u307E\u3067\u5B9F\u884C\u3057\u307E\u3059\nstepi -- \u73FE\u5728\u306E\u547D\u4EE4\u3092\u5B9F\u884C\u3057\u307E\u3059\nnext -- 1\u884C\u3092\u30B9\u30C6\u30C3\u30D7\u5B9F\u884C\u3057\u307E\u3059(\u547C\u51FA\u3057\u3092\u30B9\u30C6\u30C3\u30D7\u30AA\u30FC\u30D0\u30FC)\ncont -- \u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8\u304B\u3089\u5B9F\u884C\u3092\u7D9A\u884C\u3057\u307E\u3059\n\nlist [line number|method] -- \u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9\u3092\u51FA\u529B\u3057\u307E\u3059\nuse (or sourcepath) [source file path]\n -- \u30BD\u30FC\u30B9\u30FB\u30D1\u30B9\u3092\u8868\u793A\u307E\u305F\u306F\u5909\u66F4\u3057\u307E\u3059\nexclude [<class pattern>, ... | \"none\"]\n -- \u6307\u5B9A\u3057\u305F\u30AF\u30E9\u30B9\u306E\u30B9\u30C6\u30C3\u30D7\u3084\u30E1\u30BD\u30C3\u30C9\u30FB\u30A4\u30D9\u30F3\u30C8\u3092\u5831\u544A\u3057\u307E\u305B\u3093\nclasspath -- \u30BF\u30FC\u30B2\u30C3\u30C8VM\u304B\u3089\u30AF\u30E9\u30B9\u30D1\u30B9\u60C5\u5831\u3092\u51FA\u529B\u3057\u307E\u3059\n\nmonitor <command> -- \u30D7\u30ED\u30B0\u30E9\u30E0\u304C\u505C\u6B62\u3059\u308B\u305F\u3073\u306B\u30B3\u30DE\u30F3\u30C9\u3092\u5B9F\u884C\u3057\u307E\u3059\nmonitor -- \u30E2\u30CB\u30BF\u30FC\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\nunmonitor <monitor#> -- \u30E2\u30CB\u30BF\u30FC\u3092\u524A\u9664\u3057\u307E\u3059\nread <filename> -- \u30B3\u30DE\u30F3\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u3063\u3066\u5B9F\u884C\u3057\u307E\u3059\n\nlock <expr> -- \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u30ED\u30C3\u30AF\u60C5\u5831\u3092\u51FA\u529B\u3057\u307E\u3059\nthreadlocks [thread id] -- \u30B9\u30EC\u30C3\u30C9\u306E\u30ED\u30C3\u30AF\u60C5\u5831\u3092\u51FA\u529B\u3057\u307E\u3059\n\npop -- \u73FE\u5728\u306E\u30D5\u30EC\u30FC\u30E0\u307E\u3067\u306E\u3059\u3079\u3066\u306E\u30B9\u30BF\u30C3\u30AF\u3092\u30DD\u30C3\u30D7\u3057\u307E\u3059\nreenter -- pop\u3068\u540C\u3058\u3067\u3059\u304C\u3001\u73FE\u5728\u306E\u30D5\u30EC\u30FC\u30E0\u304C\u518D\u5165\u529B\u3055\u308C\u307E\u3059\nredefine <class id> <class file name>\n -- \u30AF\u30E9\u30B9\u306E\u30B3\u30FC\u30C9\u3092\u518D\u5B9A\u7FA9\u3057\u307E\u3059\n\ndisablegc <expr> -- \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u6291\u5236\u3057\u307E\u3059\nenablegc <expr> -- \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u8A31\u53EF\u3057\u307E\u3059\n\n!! -- \u6700\u5F8C\u306E\u30B3\u30DE\u30F3\u30C9\u3092\u7E70\u308A\u8FD4\u3057\u307E\u3059\n<n> <command> -- \u30B3\u30DE\u30F3\u30C9\u3092n\u56DE\u7E70\u308A\u8FD4\u3057\u307E\u3059\n# <command> -- \u7834\u68C4\u3057\u307E\u3059(\u64CD\u4F5C\u306A\u3057)\nhelp (\u307E\u305F\u306F?) -- \u30B3\u30DE\u30F3\u30C9\u3092\u30EA\u30B9\u30C8\u3057\u307E\u3059\nversion -- \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u51FA\u529B\u3057\u307E\u3059\nexit (\u307E\u305F\u306Fquit) -- \u30C7\u30D0\u30C3\u30AC\u3092\u7D42\u4E86\u3057\u307E\u3059\n\n<class id>: \u30D1\u30C3\u30B1\u30FC\u30B8\u4FEE\u98FE\u5B50\u3092\u542B\u3080\u5B8C\u5168\u30AF\u30E9\u30B9\u540D\n<class pattern>: \u5148\u982D\u307E\u305F\u306F\u672B\u5C3E\u306E\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9('*')\u3092\u542B\u3080\u30AF\u30E9\u30B9\u540D\n<thread id>: 'threads'\u30B3\u30DE\u30F3\u30C9\u3067\u5831\u544A\u3055\u308C\u308B\u30B9\u30EC\u30C3\u30C9\u756A\u53F7\n<expr>: Java(TM)\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u306E\u5F0F\u3002\n\u307B\u3068\u3093\u3069\u306E\u4E00\u822C\u7684\u306A\u69CB\u6587\u304C\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n\n\u8D77\u52D5\u30B3\u30DE\u30F3\u30C9\u306F\u3001\"jdb.ini\"\u307E\u305F\u306F\".jdbrc\"\u306B\u914D\u7F6E\u3067\u304D\u307E\u3059\n(user.home\u307E\u305F\u306Fuser.dir\u5185)"},
320+ {"zz usage text",
321+ "\u4F7F\u7528\u65B9\u6CD5: {0} <options> <class> <arguments>\n\n\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n -help \u3053\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n -sourcepath <directories separated by \"{1}\">\n \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n -attach <address>\n \u6A19\u6E96\u30B3\u30CD\u30AF\u30BF\u3092\u4F7F\u7528\u3057\u3066\u3001\u6307\u5B9A\u3055\u308C\u305F\u30A2\u30C9\u30EC\u30B9\u3067\u5B9F\u884C\u4E2D\u306EVM\u306B\u63A5\u7D9A\u3059\u308B\n -listen <address>\n \u6A19\u6E96\u30B3\u30CD\u30AF\u30BF\u3092\u4F7F\u7528\u3057\u3066\u3001\u6307\u5B9A\u3055\u308C\u305F\u30A2\u30C9\u30EC\u30B9\u3067\u5B9F\u884C\u4E2D\u306EVM\u306E\u63A5\u7D9A\u3092\u5F85\u6A5F\u3059\u308B\n -listenany\n \u6A19\u6E96\u30B3\u30CD\u30AF\u30BF\u3092\u4F7F\u7528\u3057\u3066\u3001\u4F7F\u7528\u53EF\u80FD\u306A\u4EFB\u610F\u306E\u30A2\u30C9\u30EC\u30B9\u3067\u5B9F\u884C\u4E2D\u306EVM\u306E\u63A5\u7D9A\u3092\u5F85\u6A5F\u3059\u308B\n -launch\n ''run''\u30B3\u30DE\u30F3\u30C9\u3092\u5F85\u6A5F\u305B\u305A\u306BVM\u3092\u5373\u6642\u306B\u8D77\u52D5\u3059\u308B\n -listconnectors \u3053\u306EVM\u3067\u4F7F\u7528\u53EF\u80FD\u306A\u30B3\u30CD\u30AF\u30BF\u3092\u30EA\u30B9\u30C8\u3059\u308B\n -connect <connector-name>:<name1>=<value1>,...\n \u6307\u5B9A\u3055\u308C\u305F\u30B3\u30CD\u30AF\u30BF\u3092\u4F7F\u7528\u3057\u3066\u3001\u30EA\u30B9\u30C8\u3055\u308C\u305F\u5F15\u6570\u5024\u3067\u30BF\u30FC\u30B2\u30C3\u30C8VM\u306B\u63A5\u7D9A\u3059\u308B\n -dbgtrace [flags] {0}\u306E\u30C7\u30D0\u30C3\u30B0\u306E\u60C5\u5831\u3092\u51FA\u529B\u3059\u308B\n -tclient \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3092HotSpot(TM) Client Compiler\u3067\u5B9F\u884C\u3059\u308B\n -tserver \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3092HotSpot(TM) Server Compiler\u3067\u5B9F\u884C\u3059\u308B\n\n\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u30C7\u30D0\u30C3\u30B0\u3059\u308B\u30D7\u30ED\u30BB\u30B9\u306B\u8EE2\u9001\u3055\u308C\u307E\u3059:\n -v -verbose[:class|gc|jni]\n \u8A73\u7D30\u30E2\u30FC\u30C9\u3092\u30AA\u30F3\u306B\u3059\u308B\n -D<name>=<value> \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n -classpath <directories separated by \"{1}\">\n \u30AF\u30E9\u30B9\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u30EA\u30B9\u30C8\u3059\u308B\n -X<option> \u975E\u6A19\u6E96\u306E\u30BF\u30FC\u30B2\u30C3\u30C8VM\u30AA\u30D7\u30B7\u30E7\u30F3\n\n<class>\u306F\u30C7\u30D0\u30C3\u30B0\u3092\u958B\u59CB\u3059\u308B\u30AF\u30E9\u30B9\u306E\u540D\u524D\u3067\u3059\n<arguments>\u306F<class>\u306Emain()\u30E1\u30BD\u30C3\u30C9\u306B\u6E21\u3055\u308C\u308B\u5F15\u6570\u3067\u3059\n\n\u30B3\u30DE\u30F3\u30C9\u306E\u30D8\u30EB\u30D7\u306B\u3064\u3044\u3066\u306F{0}\u30D7\u30ED\u30F3\u30D7\u30C8\u3067''help''\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},
322+ // END OF MATERIAL TO LOCALIZE
323+ };
324+
325+ return temp;
326+ }
327+}
java/pkg/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java+327−0
@@ -0,0 +1,327 @@
1+/*
2+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+/**
29+ * <p> This class represents the <code>ResourceBundle</code>
30+ * for the following package(s):
31+ *
32+ * <ol>
33+ * <li> com.sun.tools.example.debug.tty
34+ * </ol>
35+ *
36+ */
37+public class TTYResources_zh_CN extends java.util.ListResourceBundle {
38+
39+
40+ /**
41+ * Returns the contents of this <code>ResourceBundle</code>.
42+ *
43+ * <p>
44+ *
45+ * @return the contents of this <code>ResourceBundle</code>.
46+ */
47+ @Override
48+ public Object[][] getContents() {
49+ Object[][] temp = new Object[][] {
50+ // NOTE: The value strings in this file containing "{0}" are
51+ // processed by the java.text.MessageFormat class. Any
52+ // single quotes appearing in these strings need to be
53+ // doubled up.
54+ //
55+ // LOCALIZE THIS
56+ {"** classes list **", "** \u7C7B\u5217\u8868 **\n{0}"},
57+ {"** fields list **", "** \u5B57\u6BB5\u5217\u8868 **\n{0}"},
58+ {"** methods list **", "** \u65B9\u6CD5\u5217\u8868 **\n{0}"},
59+ {"*** Reading commands from", "*** \u6B63\u5728\u4ECE{0}\u8BFB\u53D6\u547D\u4EE4"},
60+ {"All threads resumed.", "\u5DF2\u6062\u590D\u6240\u6709\u7EBF\u7A0B\u3002"},
61+ {"All threads suspended.", "\u5DF2\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\u3002"},
62+ {"Argument is not defined for connector:", "\u6CA1\u6709\u4E3A\u8FDE\u63A5\u5668{1}\u5B9A\u4E49\u53C2\u6570{0}"},
63+ {"Arguments match no method", "\u53C2\u6570\u4E0D\u4E0E\u4EFB\u4F55\u65B9\u6CD5\u5339\u914D"},
64+ {"Array:", "\u6570\u7EC4: {0}"},
65+ {"Array element is not a method", "\u6570\u7EC4\u5143\u7D20\u4E0D\u662F\u65B9\u6CD5"},
66+ {"Array index must be a integer type", "\u6570\u7EC4\u7D22\u5F15\u5FC5\u987B\u4E3A\u6574\u6570\u7C7B\u578B"},
67+ {"base directory:", "\u57FA\u76EE\u5F55: {0}"},
68+ {"bootclasspath:", "\u5F15\u5BFC\u7C7B\u8DEF\u5F84: {0}"},
69+ {"Breakpoint hit:", "\u65AD\u70B9\u547D\u4E2D: "},
70+ {"breakpoint", "\u65AD\u70B9{0}"},
71+ {"Breakpoints set:", "\u65AD\u70B9\u96C6:"},
72+ {"Breakpoints can be located only in classes.", "\u65AD\u70B9\u53EA\u80FD\u4F4D\u4E8E\u7C7B\u4E2D\u3002{0}\u662F\u63A5\u53E3\u6216\u6570\u7EC4\u3002"},
73+ {"Can only trace", "\u53EA\u80FD\u8DDF\u8E2A 'methods', 'method exit' \u6216 'method exits'"},
74+ {"cannot redefine existing connection", "{0}\u65E0\u6CD5\u91CD\u65B0\u5B9A\u4E49\u73B0\u6709\u8FDE\u63A5"},
75+ {"Cannot assign to a method invocation", "\u65E0\u6CD5\u5206\u914D\u5230\u65B9\u6CD5\u8C03\u7528"},
76+ {"Cannot specify command line with connector:", "\u65E0\u6CD5\u6307\u5B9A\u5E26\u6709\u8FDE\u63A5\u5668\u7684\u547D\u4EE4\u884C: {0}"},
77+ {"Cannot specify target vm arguments with connector:", "\u65E0\u6CD5\u6307\u5B9A\u5E26\u6709\u8FDE\u63A5\u5668\u7684\u76EE\u6807 VM \u53C2\u6570: {0}"},
78+ {"Class containing field must be specified.", "\u5FC5\u987B\u6307\u5B9A\u5305\u542B\u5B57\u6BB5\u7684\u7C7B\u3002"},
79+ {"Class:", "\u7C7B: {0}"},
80+ {"Classic VM no longer supported.", "\u4E0D\u518D\u652F\u6301\u7ECF\u5178 VM\u3002"},
81+ {"classpath:", "\u7C7B\u8DEF\u5F84: {0}"},
82+ {"colon mark", ":"},
83+ {"colon space", ": "},
84+ {"Command is not supported on the target VM", "\u76EE\u6807 VM \u4E0D\u652F\u6301\u547D\u4EE4 ''{0}''"},
85+ {"Command is not supported on a read-only VM connection", "\u53EA\u8BFB VM \u8FDE\u63A5\u4E0D\u652F\u6301\u547D\u4EE4 ''{0}''"},
86+ {"Command not valid until the VM is started with the run command", "\u5728\u4F7F\u7528 ''run'' \u547D\u4EE4\u542F\u52A8 VM \u524D, \u547D\u4EE4 ''{0}'' \u662F\u65E0\u6548\u7684"},
87+ {"Condition must be boolean", "\u6761\u4EF6\u5FC5\u987B\u662F\u5E03\u5C14\u578B"},
88+ {"Connector and Transport name", " \u8FDE\u63A5\u5668: {0}, \u4F20\u8F93: {1}"},
89+ {"Connector argument nodefault", " \u53C2\u6570: {0} (\u65E0\u9ED8\u8BA4\u503C)"},
90+ {"Connector argument default", " \u53C2\u6570: {0}, \u9ED8\u8BA4\u503C: {1}"},
91+ {"Connector description", " \u8BF4\u660E: {0}"},
92+ {"Connector required argument nodefault", " \u6240\u9700\u7684\u53C2\u6570: {0} (\u65E0\u9ED8\u8BA4\u503C)"},
93+ {"Connector required argument default", " \u6240\u9700\u7684\u53C2\u6570: {0}, \u9ED8\u8BA4\u503C: {1}"},
94+ {"Connectors available", "\u53EF\u7528\u8FDE\u63A5\u5668\u4E3A:"},
95+ {"Constant is not a method", "\u5E38\u91CF\u4E0D\u662F\u65B9\u6CD5"},
96+ {"Could not open:", "\u65E0\u6CD5\u6253\u5F00: {0}"},
97+ {"Current method is native", "\u5F53\u524D\u65B9\u6CD5\u4E3A\u672C\u673A\u65B9\u6CD5"},
98+ {"Current thread died. Execution continuing...", "\u5F53\u524D\u7EBF\u7A0B{0}\u5DF2\u6210\u4E3A\u6B7B\u7EBF\u7A0B\u3002\u7EE7\u7EED\u6267\u884C..."},
99+ {"Current thread isnt suspended.", "\u5F53\u524D\u7EBF\u7A0B\u672A\u6302\u8D77\u3002"},
100+ {"Current thread not set.", "\u5F53\u524D\u7EBF\u7A0B\u672A\u8BBE\u7F6E\u3002"},
101+ {"dbgtrace flag value must be an integer:", "dbgtrace \u6807\u8BB0\u503C\u5FC5\u987B\u4E3A\u6574\u6570: {0}"},
102+ {"Deferring.", "\u6B63\u5728\u5EF6\u8FDF{0}\u3002\n\u5C06\u5728\u52A0\u8F7D\u7C7B\u540E\u8BBE\u7F6E\u3002"},
103+ {"End of stack.", "\u5806\u6808\u7ED3\u675F\u3002"},
104+ {"Error popping frame", "\u4F7F\u5E27\u51FA\u6808\u65F6\u51FA\u9519 - {0}"},
105+ {"Error reading file", "\u8BFB\u53D6 ''{0}'' \u65F6\u51FA\u9519 - {1}"},
106+ {"Error redefining class to file", "\u5C06{0}\u91CD\u65B0\u5B9A\u4E49\u4E3A{1}\u65F6\u51FA\u9519 - {2}"},
107+ {"exceptionSpec all", "\u6240\u6709{0}"},
108+ {"exceptionSpec caught", "\u6355\u83B7\u7684{0}"},
109+ {"exceptionSpec uncaught", "\u672A\u6355\u83B7\u7684{0}"},
110+ {"Exception in expression:", "\u8868\u8FBE\u5F0F\u4E2D\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF: {0}"},
111+ {"Exception occurred caught", "\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF: {0} (\u5C06\u5728\u4EE5\u4E0B\u4F4D\u7F6E\u6355\u83B7: {1})"},
112+ {"Exception occurred uncaught", "\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF: {0} (\u672A\u6355\u83B7)"},
113+ {"Exceptions caught:", "\u51FA\u73B0\u8FD9\u4E9B\u5F02\u5E38\u9519\u8BEF\u65F6\u4E2D\u65AD:"},
114+ {"expr is null", "{0} = \u7A7A\u503C"},
115+ {"expr is value", "{0} = {1}"},
116+ {"expr is value <collected>", " {0} = {1} <\u5DF2\u6536\u96C6>"},
117+ {"Expression cannot be void", "\u8868\u8FBE\u5F0F\u4E0D\u80FD\u4E3A\u7A7A"},
118+ {"Expression must evaluate to an object", "\u8868\u8FBE\u5F0F\u7684\u8BA1\u7B97\u7ED3\u679C\u5FC5\u987B\u4E3A\u5BF9\u8C61"},
119+ {"extends:", "\u6269\u5C55: {0}"},
120+ {"Failed reading output", "\u65E0\u6CD5\u8BFB\u53D6\u5B50 Java \u89E3\u91CA\u5668\u7684\u8F93\u51FA\u3002"},
121+ {"Fatal error", "\u81F4\u547D\u9519\u8BEF:"},
122+ {"Field access encountered before after", "\u5B57\u6BB5 ({0}) \u4E3A{1}, \u5C06\u4E3A{2}: "},
123+ {"Field access encountered", "\u9047\u5230\u5B57\u6BB5 ({0}) \u8BBF\u95EE: "},
124+ {"Field to unwatch not specified", "\u672A\u6307\u5B9A\u8981\u53D6\u6D88\u76D1\u89C6\u7684\u5B57\u6BB5\u3002"},
125+ {"Field to watch not specified", "\u672A\u6307\u5B9A\u8981\u76D1\u89C6\u7684\u5B57\u6BB5\u3002"},
126+ {"GC Disabled for", "\u5DF2\u5BF9{0}\u7981\u7528 GC:"},
127+ {"GC Enabled for", "\u5DF2\u5BF9{0}\u542F\u7528 GC:"},
128+ {"grouping begin character", "{"},
129+ {"grouping end character", "}"},
130+ {"Illegal Argument Exception", "\u975E\u6CD5\u53C2\u6570\u5F02\u5E38\u9519\u8BEF"},
131+ {"Illegal connector argument", "\u975E\u6CD5\u8FDE\u63A5\u5668\u53C2\u6570: {0}"},
132+ {"implementor:", "\u5B9E\u73B0\u8005: {0}"},
133+ {"implements:", "\u5B9E\u73B0: {0}"},
134+ {"Initializing progname", "\u6B63\u5728\u521D\u59CB\u5316{0}..."},
135+ {"Input stream closed.", "\u8F93\u5165\u6D41\u5DF2\u5173\u95ED\u3002"},
136+ {"Interface:", "\u63A5\u53E3: {0}"},
137+ {"Internal debugger error.", "\u5185\u90E8\u8C03\u8BD5\u5668\u9519\u8BEF\u3002"},
138+ {"Internal error: null ThreadInfo created", "\u5185\u90E8\u9519\u8BEF: \u521B\u5EFA\u4E86\u7A7A\u503C ThreadInfo"},
139+ {"Internal error; unable to set", "\u5185\u90E8\u9519\u8BEF; \u65E0\u6CD5\u8BBE\u7F6E{0}"},
140+ {"Internal exception during operation:", "\u64CD\u4F5C\u671F\u95F4\u51FA\u73B0\u5185\u90E8\u5F02\u5E38\u9519\u8BEF:\n {0}"},
141+ {"Internal exception:", "\u5185\u90E8\u5F02\u5E38\u9519\u8BEF:"},
142+ {"Invalid argument type name", "\u53C2\u6570\u7C7B\u578B\u540D\u79F0\u65E0\u6548"},
143+ {"Invalid assignment syntax", "\u8D4B\u503C\u8BED\u6CD5\u65E0\u6548"},
144+ {"Invalid command syntax", "\u547D\u4EE4\u8BED\u6CD5\u65E0\u6548"},
145+ {"Invalid connect type", "\u8FDE\u63A5\u7C7B\u578B\u65E0\u6548"},
146+ {"Invalid consecutive invocations", "\u8FDE\u7EED\u8C03\u7528\u65E0\u6548"},
147+ {"Invalid exception object", "\u5F02\u5E38\u9519\u8BEF\u5BF9\u8C61\u65E0\u6548"},
148+ {"Invalid method specification:", "\u65B9\u6CD5\u89C4\u8303\u65E0\u6548: {0}"},
149+ {"Invalid option on class command", "\u7C7B\u547D\u4EE4\u7684\u9009\u9879\u65E0\u6548"},
150+ {"invalid option", "\u9009\u9879\u65E0\u6548: {0}"},
151+ {"Invalid thread status.", "\u7EBF\u7A0B\u72B6\u6001\u65E0\u6548\u3002"},
152+ {"Invalid transport name:", "\u4F20\u8F93\u540D\u79F0\u65E0\u6548: {0}"},
153+ {"I/O exception occurred:", "\u51FA\u73B0 I/O \u5F02\u5E38\u9519\u8BEF: {0}"},
154+ {"is an ambiguous method name in", "\"{0}\" \u5728 \"{1}\" \u4E2D\u662F\u4E0D\u660E\u786E\u7684\u65B9\u6CD5\u540D\u79F0"},
155+ {"is an invalid line number for", "{0,number,integer} \u662F{1}\u7684\u65E0\u6548\u884C\u53F7"},
156+ {"is not a valid class name", "\"{0}\" \u4E0D\u662F\u6709\u6548\u7684\u7C7B\u540D\u3002"},
157+ {"is not a valid field name", "\"{0}\" \u4E0D\u662F\u6709\u6548\u7684\u5B57\u6BB5\u540D\u3002"},
158+ {"is not a valid id or class name", "\"{0}\" \u4E0D\u662F\u6709\u6548\u7684 ID \u6216\u7C7B\u540D\u3002"},
159+ {"is not a valid line number or method name for", "\"{0}\" \u4E0D\u662F\u7C7B \"{1}\" \u7684\u6709\u6548\u884C\u53F7\u6216\u65B9\u6CD5\u540D"},
160+ {"is not a valid method name", "\"{0}\" \u4E0D\u662F\u6709\u6548\u7684\u65B9\u6CD5\u540D\u3002"},
161+ {"is not a valid thread id", "\"{0}\" \u4E0D\u662F\u6709\u6548\u7684\u7EBF\u7A0B ID\u3002"},
162+ {"is not a valid threadgroup name", "\"{0}\" \u4E0D\u662F\u6709\u6548\u7684\u7EBF\u7A0B\u7EC4\u540D\u79F0\u3002"},
163+ {"jdb prompt with no current thread", "> "},
164+ {"jdb prompt thread name and current stack frame", "{0}[{1,number,integer}] "},
165+ {"killed", "{0}\u5DF2\u7EC8\u6B62"},
166+ {"killing thread:", "\u6B63\u5728\u7EC8\u6B62\u7EBF\u7A0B: {0}"},
167+ {"Line number information not available for", "\u6B64\u4F4D\u7F6E\u7684\u6E90\u884C\u53F7\u4E0D\u53EF\u7528\u3002"},
168+ {"line number", ":{0,number,integer}"},
169+ {"list field typename and name", "{0} {1}\n"},
170+ {"list field typename and name inherited", "{0} {1} (\u7EE7\u627F\u81EA{2})\n"},
171+ {"list field typename and name hidden", "{0} {1} (\u9690\u85CF)\n"},
172+ {"Listening at address:", "\u76D1\u542C\u5730\u5740: {0}"},
173+ {"Local variable information not available.", "\u672C\u5730\u53D8\u91CF\u4FE1\u606F\u4E0D\u53EF\u7528\u3002\u8BF7\u4F7F\u7528 -g \u7F16\u8BD1\u4EE5\u751F\u6210\u53D8\u91CF\u4FE1\u606F"},
174+ {"Local variables:", "\u672C\u5730\u53D8\u91CF:"},
175+ {"<location unavailable>", "<\u4F4D\u7F6E\u4E0D\u53EF\u7528>"},
176+ {"location", "\"\u7EBF\u7A0B={0}\", {1}"},
177+ {"locationString", "{0}.{1}(), \u884C={2,number,integer} bci={3,number,integer}"},
178+ {"Main class and arguments must be specified", "\u5FC5\u987B\u6307\u5B9A\u4E3B\u7C7B\u548C\u53C2\u6570"},
179+ {"Method arguments:", "\u65B9\u6CD5\u53C2\u6570:"},
180+ {"Method entered:", "\u5DF2\u8FDB\u5165\u65B9\u6CD5: "},
181+ {"Method exited:", "\u5DF2\u9000\u51FA\u65B9\u6CD5"},
182+ {"Method exitedValue:", "\u5DF2\u9000\u51FA\u65B9\u6CD5: \u8FD4\u56DE\u503C = {0}, "},
183+ {"Method is overloaded; specify arguments", "\u5DF2\u91CD\u8F7D\u65B9\u6CD5{0}; \u8BF7\u6307\u5B9A\u53C2\u6570"},
184+ {"minus version", "\u8FD9\u662F{0}\u7248\u672C {1,number,integer}.{2,number,integer} (Java SE \u7248\u672C {3})"},
185+ {"Monitor information for thread", "\u76D1\u89C6\u7EBF\u7A0B{0}\u7684\u4FE1\u606F:"},
186+ {"Monitor information for expr", "\u76D1\u89C6{0} ({1}) \u7684\u4FE1\u606F:"},
187+ {"More than one class named", "\u591A\u4E2A\u7C7B\u7684\u540D\u79F0\u4E3A: ''{0}''"},
188+ {"native method", "\u672C\u673A\u65B9\u6CD5"},
189+ {"nested:", "\u5D4C\u5957: {0}"},
190+ {"No attach address specified.", "\u672A\u6307\u5B9A\u9644\u52A0\u5730\u5740\u3002"},
191+ {"No breakpoints set.", "\u672A\u8BBE\u7F6E\u65AD\u70B9\u3002"},
192+ {"No class named", "\u6CA1\u6709\u540D\u4E3A ''{0}'' \u7684\u7C7B"},
193+ {"No class specified.", "\u672A\u6307\u5B9A\u7C7B\u3002"},
194+ {"No classpath specified.", "\u672A\u6307\u5B9A\u7C7B\u8DEF\u5F84\u3002"},
195+ {"No code at line", "{1}\u4E2D\u7684\u884C {0,number,integer} \u5904\u6CA1\u6709\u4EE3\u7801"},
196+ {"No connect specification.", "\u6CA1\u6709\u8FDE\u63A5\u89C4\u8303\u3002"},
197+ {"No connector named:", "\u6CA1\u6709\u540D\u4E3A{0}\u7684\u8FDE\u63A5\u5668"},
198+ {"No current thread", "\u6CA1\u6709\u5F53\u524D\u7EBF\u7A0B"},
199+ {"No default thread specified:", "\u672A\u6307\u5B9A\u9ED8\u8BA4\u7EBF\u7A0B: \u8BF7\u5148\u4F7F\u7528 \"thread\" \u547D\u4EE4\u3002"},
200+ {"No exception object specified.", "\u672A\u6307\u5B9A\u5F02\u5E38\u9519\u8BEF\u5BF9\u8C61\u3002"},
201+ {"No exceptions caught.", "\u672A\u6355\u83B7\u5230\u5F02\u5E38\u9519\u8BEF\u3002"},
202+ {"No expression specified.", "\u672A\u6307\u5B9A\u8868\u8FBE\u5F0F\u3002"},
203+ {"No field in", "{1}\u4E2D\u6CA1\u6709\u5B57\u6BB5{0}"},
204+ {"No frames on the current call stack", "\u5F53\u524D\u8C03\u7528\u5806\u6808\u4E0A\u6CA1\u6709\u5E27"},
205+ {"No linenumber information for", "{0}\u6CA1\u6709\u884C\u53F7\u4FE1\u606F\u3002\u8BF7\u5C1D\u8BD5\u5728\u542F\u7528\u8C03\u8BD5\u7684\u60C5\u51B5\u4E0B\u7F16\u8BD1\u3002"},
206+ {"No local variables", "\u6CA1\u6709\u672C\u5730\u53D8\u91CF"},
207+ {"No method in", "{1}\u4E2D\u6CA1\u6709\u65B9\u6CD5{0}"},
208+ {"No method specified.", "\u672A\u6307\u5B9A\u65B9\u6CD5\u3002"},
209+ {"No monitor numbered:", "\u6CA1\u6709\u7F16\u53F7\u4E3A {0} \u7684\u76D1\u89C6\u5668"},
210+ {"No monitors owned", " \u4E0D\u62E5\u6709\u76D1\u89C6\u5668"},
211+ {"No object specified.", "\u672A\u6307\u5B9A\u5BF9\u8C61\u3002"},
212+ {"No objects specified.", "\u672A\u6307\u5B9A\u5BF9\u8C61\u3002"},
213+ {"No save index specified.", "\u672A\u6307\u5B9A\u4FDD\u5B58\u7D22\u5F15\u3002"},
214+ {"No saved values", "\u6CA1\u6709\u4FDD\u5B58\u7684\u503C"},
215+ {"No source information available for:", "\u6CA1\u6709\u53EF\u7528\u4E8E{0}\u7684\u6E90\u4FE1\u606F"},
216+ {"No sourcedebugextension specified", "\u672A\u6307\u5B9A SourceDebugExtension"},
217+ {"No sourcepath specified.", "\u672A\u6307\u5B9A\u6E90\u8DEF\u5F84\u3002"},
218+ {"No thread specified.", "\u672A\u6307\u5B9A\u7EBF\u7A0B\u3002"},
219+ {"No VM connected", "\u672A\u8FDE\u63A5 VM"},
220+ {"No waiters", " \u6CA1\u6709\u7B49\u5F85\u8FDB\u7A0B"},
221+ {"not a class", "{0}\u4E0D\u662F\u7C7B"},
222+ {"Not a monitor number:", "\u4E0D\u662F\u76D1\u89C6\u5668\u7F16\u53F7: ''{0}''"},
223+ {"not found (try the full name)", "\u627E\u4E0D\u5230{0} (\u8BF7\u5C1D\u8BD5\u4F7F\u7528\u5168\u540D)"},
224+ {"Not found:", "\u627E\u4E0D\u5230: {0}"},
225+ {"not found", "\u627E\u4E0D\u5230{0}"},
226+ {"Not owned", " \u4E0D\u62E5\u6709"},
227+ {"Not waiting for a monitor", " \u672A\u7B49\u5F85\u76D1\u89C6\u5668"},
228+ {"Nothing suspended.", "\u672A\u6302\u8D77\u4EFB\u4F55\u5BF9\u8C61\u3002"},
229+ {"object description and hex id", "({0}){1}"},
230+ {"Operation is not supported on the target VM", "\u76EE\u6807 VM \u4E0D\u652F\u6301\u8BE5\u64CD\u4F5C"},
231+ {"operation not yet supported", "\u5C1A\u4E0D\u652F\u6301\u8BE5\u64CD\u4F5C"},
232+ {"Owned by:", " \u62E5\u6709\u8005: {0}, \u6761\u76EE\u8BA1\u6570: {1,number,integer}"},
233+ {"Owned monitor:", " \u62E5\u6709\u7684\u76D1\u89C6\u5668: {0}"},
234+ {"Parse exception:", "\u8BED\u6CD5\u5206\u6790\u5F02\u5E38\u9519\u8BEF: {0}"},
235+ {"printbreakpointcommandusage", "\u7528\u6CD5: {0} <class>:<line_number> \u6216\n {1} <class>.<method_name>[(argument_type,...)]"},
236+ {"Removed:", "\u5DF2\u5220\u9664: {0}"},
237+ {"Requested stack frame is no longer active:", "\u8BF7\u6C42\u7684\u5806\u6808\u5E27\u4E0D\u518D\u6709\u6548: {0,number,integer}"},
238+ {"run <args> command is valid only with launched VMs", "'run <args>' \u547D\u4EE4\u4EC5\u5BF9\u542F\u52A8\u7684 VM \u6709\u6548"},
239+ {"run", "\u8FD0\u884C{0}"},
240+ {"saved", "{0}\u5DF2\u4FDD\u5B58"},
241+ {"Set deferred", "\u8BBE\u7F6E\u5EF6\u8FDF\u7684{0}"},
242+ {"Set", "\u8BBE\u7F6E{0}"},
243+ {"Source file not found:", "\u627E\u4E0D\u5230\u6E90\u6587\u4EF6: {0}"},
244+ {"source line number and line", "{0,number,integer} {1}"},
245+ {"source line number current line and line", "{0,number,integer} => {1}"},
246+ {"sourcedebugextension", "SourceDebugExtension -- {0}"},
247+ {"Specify class and method", "\u6307\u5B9A\u7C7B\u548C\u65B9\u6CD5"},
248+ {"Specify classes to redefine", "\u6307\u5B9A\u8981\u91CD\u65B0\u5B9A\u4E49\u7684\u7C7B"},
249+ {"Specify file name for class", "\u6307\u5B9A\u7C7B{0}\u7684\u6587\u4EF6\u540D"},
250+ {"stack frame dump with pc", " [{0,number,integer}] {1}.{2} ({3}), pc = {4}"},
251+ {"stack frame dump", " [{0,number,integer}] {1}.{2} ({3})"},
252+ {"Step completed:", "\u5DF2\u5B8C\u6210\u7684\u6B65\u9AA4: "},
253+ {"Stopping due to deferred breakpoint errors.", "\u7531\u4E8E\u5EF6\u8FDF\u65AD\u70B9\u9519\u8BEF\u800C\u505C\u6B62\u3002\n"},
254+ {"subclass:", "\u5B50\u7C7B: {0}"},
255+ {"subinterface:", "\u5B50\u63A5\u53E3: {0}"},
256+ {"tab", "\t{0}"},
257+ {"Target VM failed to initialize.", "\u65E0\u6CD5\u521D\u59CB\u5316\u76EE\u6807 VM\u3002"},
258+ {"The application exited", "\u5E94\u7528\u7A0B\u5E8F\u5DF2\u9000\u51FA"},
259+ {"The application has been disconnected", "\u5E94\u7528\u7A0B\u5E8F\u5DF2\u65AD\u5F00\u8FDE\u63A5"},
260+ {"The gc command is no longer necessary.", "\u4E0D\u518D\u9700\u8981 'gc' \u547D\u4EE4\u3002\n\u6240\u6709\u5BF9\u8C61\u5DF2\u7167\u5E38\u8FDB\u884C\u5783\u573E\u6536\u96C6\u3002\u8BF7\u4F7F\u7528 'enablegc' \u548C 'disablegc'\n\u547D\u4EE4\u6765\u63A7\u5236\u5404\u4E2A\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\u3002"},
261+ {"The load command is no longer supported.", "\u4E0D\u518D\u652F\u6301 'load' \u547D\u4EE4\u3002"},
262+ {"The memory command is no longer supported.", "\u4E0D\u518D\u652F\u6301 'memory' \u547D\u4EE4\u3002"},
263+ {"The VM does not use paths", "VM \u4E0D\u4F7F\u7528\u8DEF\u5F84"},
264+ {"Thread is not running (no stack).", "\u7EBF\u7A0B\u672A\u8FD0\u884C (\u6CA1\u6709\u5806\u6808)\u3002"},
265+ {"Thread number not specified.", "\u672A\u6307\u5B9A\u7EBF\u7A0B\u7F16\u53F7\u3002"},
266+ {"Thread:", "{0}:"},
267+ {"Thread Group:", "\u7EC4{0}:"},
268+ {"Thread description name unknownStatus BP", " {0} {1}\u672A\u77E5 (\u5728\u65AD\u70B9\u5904)"},
269+ {"Thread description name unknownStatus", " {0} {1}\u672A\u77E5"},
270+ {"Thread description name zombieStatus BP", " {0} {1}\u5904\u4E8E\u50F5\u6B7B\u72B6\u6001 (\u5728\u65AD\u70B9\u5904)"},
271+ {"Thread description name zombieStatus", " {0} {1}\u5904\u4E8E\u50F5\u6B7B\u72B6\u6001"},
272+ {"Thread description name runningStatus BP", " {0} {1}\u6B63\u5728\u8FD0\u884C (\u5728\u65AD\u70B9\u5904)"},
273+ {"Thread description name runningStatus", " {0} {1}\u6B63\u5728\u8FD0\u884C"},
274+ {"Thread description name sleepingStatus BP", " {0} {1}\u6B63\u5728\u4F11\u7720 (\u5728\u65AD\u70B9\u5904)"},
275+ {"Thread description name sleepingStatus", " {0} {1}\u6B63\u5728\u4F11\u7720"},
276+ {"Thread description name waitingStatus BP", " {0} {1}\u6B63\u5728\u7B49\u5F85\u76D1\u89C6\u5668 (\u5728\u65AD\u70B9\u5904)"},
277+ {"Thread description name waitingStatus", " {0} {1}\u6B63\u5728\u7B49\u5F85\u76D1\u89C6\u5668"},
278+ {"Thread description name condWaitstatus BP", " {0} {1}\u6B63\u5728\u6267\u884C\u6761\u4EF6\u7B49\u5F85 (\u5728\u65AD\u70B9\u5904)"},
279+ {"Thread description name condWaitstatus", " {0} {1}\u6B63\u5728\u6267\u884C\u6761\u4EF6\u7B49\u5F85"},
280+ {"Thread has been resumed", "\u5DF2\u6062\u590D\u7EBF\u7A0B"},
281+ {"Thread not suspended", "\u672A\u6302\u8D77\u7EBF\u7A0B"},
282+ {"thread group number description name", "{0,number,integer}\u3002{1} {2}"},
283+ {"Threadgroup name not specified.", "\u672A\u6307\u5B9A\u7EBF\u7A0B\u7EC4\u540D\u3002"},
284+ {"Threads must be suspended", "\u5FC5\u987B\u6302\u8D77\u7EBF\u7A0B"},
285+ {"trace method exit in effect for", "\u6B63\u5728\u5BF9{0}\u5B9E\u884C trace method exit"},
286+ {"trace method exits in effect", "\u6B63\u5728\u5B9E\u884C trace method exits"},
287+ {"trace methods in effect", "\u6B63\u5728\u5B9E\u884C trace methods"},
288+ {"trace go method exit in effect for", "\u6B63\u5728\u5BF9{0}\u5B9E\u884C trace go method exit"},
289+ {"trace go method exits in effect", "\u6B63\u5728\u5B9E\u884C trace go method exits"},
290+ {"trace go methods in effect", "\u6B63\u5728\u5B9E\u884C trace go methods"},
291+ {"trace not in effect", "\u672A\u5B9E\u884C trace"},
292+ {"Unable to attach to target VM.", "\u65E0\u6CD5\u9644\u52A0\u5230\u76EE\u6807 VM\u3002"},
293+ {"Unable to display process output:", "\u65E0\u6CD5\u663E\u793A\u8FDB\u7A0B\u8F93\u51FA: {0}"},
294+ {"Unable to launch target VM.", "\u65E0\u6CD5\u542F\u52A8\u76EE\u6807 VM\u3002"},
295+ {"Unable to set deferred", "\u65E0\u6CD5\u8BBE\u7F6E\u5EF6\u8FDF\u7684{0}: {1}"},
296+ {"Unable to set main class and arguments", "\u65E0\u6CD5\u8BBE\u7F6E\u4E3B\u7C7B\u548C\u53C2\u6570"},
297+ {"Unable to set", "\u65E0\u6CD5\u8BBE\u7F6E{0}: {1}"},
298+ {"Unexpected event type", "\u610F\u5916\u7684\u4E8B\u4EF6\u7C7B\u578B: {0}"},
299+ {"unknown", "\u672A\u77E5"},
300+ {"Unmonitoring", "\u53D6\u6D88\u76D1\u89C6{0} "},
301+ {"Unrecognized command. Try help...", "\u65E0\u6CD5\u8BC6\u522B\u7684\u547D\u4EE4: ''{0}''\u3002\u8BF7\u5C1D\u8BD5\u83B7\u5F97\u5E2E\u52A9..."},
302+ {"Usage: catch exception", "\u7528\u6CD5: catch [uncaught|caught|all] <class id>|<class pattern>"},
303+ {"Usage: ignore exception", "\u7528\u6CD5: ignore [uncaught|caught|all] <class id>|<class pattern>"},
304+ {"Usage: down [n frames]", "\u7528\u6CD5: down [n frames]"},
305+ {"Usage: kill <thread id> <throwable>", "\u7528\u6CD5: kill <thread id> <throwable>"},
306+ {"Usage: read <command-filename>", "\u7528\u6CD5: read <command-filename>"},
307+ {"Usage: unmonitor <monitor#>", "\u7528\u6CD5: unmonitor <monitor#>"},
308+ {"Usage: up [n frames]", "\u7528\u6CD5: up [n frames]"},
309+ {"Use java minus X to see", "\u4F7F\u7528 'java -X' \u53EF\u4EE5\u67E5\u770B\u53EF\u7528\u7684\u975E\u6807\u51C6\u9009\u9879"},
310+ {"Use stop at to set a breakpoint at a line number", "\u4F7F\u7528 'stop at' \u53EF\u4EE5\u5728\u884C\u53F7\u5904\u8BBE\u7F6E\u65AD\u70B9"},
311+ {"VM already running. use cont to continue after events.", "VM \u5DF2\u5728\u8FD0\u884C\u3002\u8BF7\u4F7F\u7528 'cont' \u4EE5\u5728\u4E8B\u4EF6\u7ED3\u675F\u540E\u7EE7\u7EED\u3002"},
312+ {"VM Started:", "VM \u5DF2\u542F\u52A8: "},
313+ {"vmstartexception", "VM \u542F\u52A8\u5F02\u5E38\u9519\u8BEF: {0}"},
314+ {"Waiting for monitor:", " \u6B63\u5728\u7B49\u5F85\u76D1\u89C6\u5668: {0}"},
315+ {"Waiting thread:", " \u6B63\u5728\u7B49\u5F85\u7EBF\u7A0B: {0}"},
316+ {"watch accesses of", "\u76D1\u89C6{0}.{1}\u7684\u8BBF\u95EE"},
317+ {"watch modification of", "\u76D1\u89C6{0}.{1}\u7684\u4FEE\u6539"},
318+ {"zz help text",
319+ "** \u547D\u4EE4\u5217\u8868 **\nconnectors -- \u5217\u51FA\u6B64 VM \u4E2D\u53EF\u7528\u7684\u8FDE\u63A5\u5668\u548C\u4F20\u8F93\n\nrun [class [args]] -- \u5F00\u59CB\u6267\u884C\u5E94\u7528\u7A0B\u5E8F\u7684\u4E3B\u7C7B\n\nthreads [threadgroup] -- \u5217\u51FA\u7EBF\u7A0B\nthread <thread id> -- \u8BBE\u7F6E\u9ED8\u8BA4\u7EBF\u7A0B\nsuspend [thread id(s)] -- \u6302\u8D77\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nresume [thread id(s)] -- \u6062\u590D\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nwhere [<thread id> | all] -- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808\nwherei [<thread id> | all]-- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808, \u4EE5\u53CA pc \u4FE1\u606F\nup [n frames] -- \u4E0A\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\ndown [n frames] -- \u4E0B\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\nkill <thread id> <expr> -- \u7EC8\u6B62\u5177\u6709\u7ED9\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u5BF9\u8C61\u7684\u7EBF\u7A0B\ninterrupt <thread id> -- \u4E2D\u65AD\u7EBF\u7A0B\n\nprint <expr> -- \u8F93\u51FA\u8868\u8FBE\u5F0F\u7684\u503C\ndump <expr> -- \u8F93\u51FA\u6240\u6709\u5BF9\u8C61\u4FE1\u606F\neval <expr> -- \u5BF9\u8868\u8FBE\u5F0F\u6C42\u503C (\u4E0E print \u76F8\u540C)\nset <lvalue> = <expr> -- \u5411\u5B57\u6BB5/\u53D8\u91CF/\u6570\u7EC4\u5143\u7D20\u5206\u914D\u65B0\u503C\nlocals -- \u8F93\u51FA\u5F53\u524D\u5806\u6808\u5E27\u4E2D\u7684\u6240\u6709\u672C\u5730\u53D8\u91CF\n\nclasses -- \u5217\u51FA\u5F53\u524D\u5DF2\u77E5\u7684\u7C7B\nclass <class id> -- \u663E\u793A\u5DF2\u547D\u540D\u7C7B\u7684\u8BE6\u7EC6\u8D44\u6599\nmethods <class id> -- \u5217\u51FA\u7C7B\u7684\u65B9\u6CD5\nfields <class id> -- \u5217\u51FA\u7C7B\u7684\u5B57\u6BB5\n\nthreadgroups -- \u5217\u51FA\u7EBF\u7A0B\u7EC4\nthreadgroup <name> -- \u8BBE\u7F6E\u5F53\u524D\u7EBF\u7A0B\u7EC4\n\nstop in <class id>.<method>[(argument_type,...)]\n -- \u5728\u65B9\u6CD5\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nstop at <class id>:<line> -- \u5728\u884C\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nclear <class id>.<method>[(argument_type,...)]\n -- \u6E05\u9664\u65B9\u6CD5\u4E2D\u7684\u65AD\u70B9\nclear <class id>:<line> -- \u6E05\u9664\u884C\u4E2D\u7684\u65AD\u70B9\nclear -- \u5217\u51FA\u65AD\u70B9\ncatch [uncaught|caught|all] <class id>|<class pattern>\n -- \u51FA\u73B0\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u65F6\u4E2D\u65AD\nignore [uncaught|caught|all] <class id>|<class pattern>\n -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF, \u53D6\u6D88 'catch'\nwatch [access|all] <class id>.<field name>\n -- \u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\nunwatch [access|all] <class id>.<field name>\n -- \u505C\u6B62\u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\ntrace [go] methods [thread]\n -- \u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C\u9000\u51FA\u3002\n -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\ntrace [go] method exit | exits [thread]\n -- \u8DDF\u8E2A\u5F53\u524D\u65B9\u6CD5\u7684\u9000\u51FA, \u6216\u8005\u6240\u6709\u65B9\u6CD5\u7684\u9000\u51FA\n -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\nuntrace [methods] -- \u505C\u6B62\u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C/\u6216\u9000\u51FA\nstep -- \u6267\u884C\u5F53\u524D\u884C\nstep up -- \u4E00\u76F4\u6267\u884C, \u76F4\u5230\u5F53\u524D\u65B9\u6CD5\u8FD4\u56DE\u5230\u5176\u8C03\u7528\u65B9\nstepi -- \u6267\u884C\u5F53\u524D\u6307\u4EE4\nnext -- \u6B65\u8FDB\u4E00\u884C (\u6B65\u8FC7\u8C03\u7528)\ncont -- \u4ECE\u65AD\u70B9\u5904\u7EE7\u7EED\u6267\u884C\n\nlist [line number|method] -- \u8F93\u51FA\u6E90\u4EE3\u7801\nuse (\u6216 sourcepath) [source file path]\n -- \u663E\u793A\u6216\u66F4\u6539\u6E90\u8DEF\u5F84\nexclude [<class pattern>, ... | \"none\"]\n -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u7C7B, \u4E0D\u62A5\u544A\u6B65\u9AA4\u6216\u65B9\u6CD5\u4E8B\u4EF6\nclasspath -- \u4ECE\u76EE\u6807 VM \u8F93\u51FA\u7C7B\u8DEF\u5F84\u4FE1\u606F\n\nmonitor <command> -- \u6BCF\u6B21\u7A0B\u5E8F\u505C\u6B62\u65F6\u6267\u884C\u547D\u4EE4\nmonitor -- \u5217\u51FA\u76D1\u89C6\u5668\nunmonitor <monitor#> -- \u5220\u9664\u76D1\u89C6\u5668\nread <filename> -- \u8BFB\u53D6\u5E76\u6267\u884C\u547D\u4EE4\u6587\u4EF6\n\nlock <expr> -- \u8F93\u51FA\u5BF9\u8C61\u7684\u9501\u4FE1\u606F\nthreadlocks [thread id] -- \u8F93\u51FA\u7EBF\u7A0B\u7684\u9501\u4FE1\u606F\n\npop -- \u901A\u8FC7\u5F53\u524D\u5E27\u51FA\u6808, \u4E14\u5305\u542B\u5F53\u524D\u5E27\nreenter -- \u4E0E pop \u76F8\u540C, \u4F46\u91CD\u65B0\u8FDB\u5165\u5F53\u524D\u5E27\nredefine <class id> <class file name>\n -- \u91CD\u65B0\u5B9A\u4E49\u7C7B\u7684\u4EE3\u7801\n\ndisablegc <expr> -- \u7981\u6B62\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\nenablegc <expr> -- \u5141\u8BB8\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\n\n!! -- \u91CD\u590D\u6267\u884C\u6700\u540E\u4E00\u4E2A\u547D\u4EE4\n<n> <command> -- \u5C06\u547D\u4EE4\u91CD\u590D\u6267\u884C n \u6B21\n# <command> -- \u653E\u5F03 (\u65E0\u64CD\u4F5C)\nhelp (\u6216 ?) -- \u5217\u51FA\u547D\u4EE4\nversion -- \u8F93\u51FA\u7248\u672C\u4FE1\u606F\nexit (\u6216 quit) -- \u9000\u51FA\u8C03\u8BD5\u5668\n\n<class id>: \u5E26\u6709\u7A0B\u5E8F\u5305\u9650\u5B9A\u7B26\u7684\u5B8C\u6574\u7C7B\u540D\n<class pattern>: \u5E26\u6709\u524D\u5BFC\u6216\u5C3E\u968F\u901A\u914D\u7B26 ('*') \u7684\u7C7B\u540D\n<thread id>: 'threads' \u547D\u4EE4\u4E2D\u62A5\u544A\u7684\u7EBF\u7A0B\u7F16\u53F7\n<expr>: Java(TM) \u7F16\u7A0B\u8BED\u8A00\u8868\u8FBE\u5F0F\u3002\n\u652F\u6301\u5927\u591A\u6570\u5E38\u89C1\u8BED\u6CD5\u3002\n\n\u53EF\u4EE5\u5C06\u542F\u52A8\u547D\u4EE4\u7F6E\u4E8E \"jdb.ini\" \u6216 \".jdbrc\" \u4E2D\n\u4F4D\u4E8E user.home \u6216 user.dir \u4E2D"},
320+ {"zz usage text",
321+ "\u7528\u6CD5: {0} <options> <class> <arguments>\n\n\u5176\u4E2D, \u9009\u9879\u5305\u62EC:\n -help \u8F93\u51FA\u6B64\u6D88\u606F\u5E76\u9000\u51FA\n -sourcepath <\u7531 \"{1}\" \u5206\u9694\u7684\u76EE\u5F55>\n \u8981\u5728\u5176\u4E2D\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u76EE\u5F55\n -attach <address>\n \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u9644\u52A0\u5230\u6307\u5B9A\u5730\u5740\u5904\u6B63\u5728\u8FD0\u884C\u7684 VM\n -listen <address>\n \u7B49\u5F85\u6B63\u5728\u8FD0\u884C\u7684 VM \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u5728\u6307\u5B9A\u5730\u5740\u5904\u8FDE\u63A5\n -listenany\n \u7B49\u5F85\u6B63\u5728\u8FD0\u884C\u7684 VM \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u5728\u4EFB\u4F55\u53EF\u7528\u5730\u5740\u5904\u8FDE\u63A5\n -launch\n \u7ACB\u5373\u542F\u52A8 VM \u800C\u4E0D\u662F\u7B49\u5F85 ''run'' \u547D\u4EE4\n -listconnectors \u5217\u51FA\u6B64 VM \u4E2D\u7684\u53EF\u7528\u8FDE\u63A5\u5668\n -connect <connector-name>:<name1>=<value1>,...\n \u4F7F\u7528\u6240\u5217\u53C2\u6570\u503C\u901A\u8FC7\u6307\u5B9A\u7684\u8FDE\u63A5\u5668\u8FDE\u63A5\u5230\u76EE\u6807 VM\n -dbgtrace [flags] \u8F93\u51FA\u4FE1\u606F\u4F9B\u8C03\u8BD5{0}\n -tclient \u5728 HotSpot(TM) \u5BA2\u6237\u673A\u7F16\u8BD1\u5668\u4E2D\u8FD0\u884C\u5E94\u7528\u7A0B\u5E8F\n -tserver \u5728 HotSpot(TM) \u670D\u52A1\u5668\u7F16\u8BD1\u5668\u4E2D\u8FD0\u884C\u5E94\u7528\u7A0B\u5E8F\n\n\u8F6C\u53D1\u5230\u88AB\u8C03\u8BD5\u8FDB\u7A0B\u7684\u9009\u9879:\n -v -verbose[:class|gc|jni]\n \u542F\u7528\u8BE6\u7EC6\u6A21\u5F0F\n -D<name>=<value> \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n -classpath <\u7531 \"{1}\" \u5206\u9694\u7684\u76EE\u5F55>\n \u5217\u51FA\u8981\u5728\u5176\u4E2D\u67E5\u627E\u7C7B\u7684\u76EE\u5F55\n -X<option> \u975E\u6807\u51C6\u76EE\u6807 VM \u9009\u9879\n\n<class> \u662F\u8981\u5F00\u59CB\u8C03\u8BD5\u7684\u7C7B\u7684\u540D\u79F0\n<arguments> \u662F\u4F20\u9012\u5230 <class> \u7684 main() \u65B9\u6CD5\u7684\u53C2\u6570\n\n\u8981\u83B7\u5F97\u547D\u4EE4\u7684\u5E2E\u52A9, \u8BF7\u5728{0}\u63D0\u793A\u4E0B\u952E\u5165 ''help''"},
322+ // END OF MATERIAL TO LOCALIZE
323+ };
324+
325+ return temp;
326+ }
327+}
java/pkg/com/sun/tools/example/debug/tty/ThreadGroupIterator.java+104−0
@@ -0,0 +1,104 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.ThreadGroupReference;
29+import java.util.List;
30+import java.util.Stack;
31+import java.util.ArrayList;
32+import java.util.Iterator;
33+
34+/**
35+ * Descend the tree of thread groups.
36+ * @author Robert G. Field
37+ */
38+class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
39+ private final Stack<Iterator<ThreadGroupReference>> stack = new Stack<Iterator<ThreadGroupReference>>();
40+
41+ ThreadGroupIterator(List<ThreadGroupReference> tgl) {
42+ push(tgl);
43+ }
44+
45+ ThreadGroupIterator(ThreadGroupReference tg) {
46+ List<ThreadGroupReference> tgl = new ArrayList<ThreadGroupReference>();
47+ tgl.add(tg);
48+ push(tgl);
49+ }
50+
51+ ThreadGroupIterator() {
52+ this(Env.vm().topLevelThreadGroups());
53+ }
54+
55+ private Iterator<ThreadGroupReference> top() {
56+ return stack.peek();
57+ }
58+
59+ /**
60+ * The invariant in this class is that the top iterator
61+ * on the stack has more elements. If the stack is
62+ * empty, there is no top. This method assures
63+ * this invariant.
64+ */
65+ private void push(List<ThreadGroupReference> tgl) {
66+ stack.push(tgl.iterator());
67+ while (!stack.isEmpty() && !top().hasNext()) {
68+ stack.pop();
69+ }
70+ }
71+
72+ @Override
73+ public boolean hasNext() {
74+ return !stack.isEmpty();
75+ }
76+
77+ @Override
78+ public ThreadGroupReference next() {
79+ return nextThreadGroup();
80+ }
81+
82+ public ThreadGroupReference nextThreadGroup() {
83+ ThreadGroupReference tg = top().next();
84+ push(tg.threadGroups());
85+ return tg;
86+ }
87+
88+ @Override
89+ public void remove() {
90+ throw new UnsupportedOperationException();
91+ }
92+
93+ static ThreadGroupReference find(String name) {
94+ ThreadGroupIterator tgi = new ThreadGroupIterator();
95+ while (tgi.hasNext()) {
96+ ThreadGroupReference tg = tgi.nextThreadGroup();
97+ if (tg.name().equals(name)) {
98+ return tg;
99+ }
100+ }
101+ return null;
102+ }
103+
104+}
java/pkg/com/sun/tools/example/debug/tty/ThreadInfo.java+287−0
@@ -0,0 +1,287 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.ThreadReference;
29+import com.sun.jdi.ThreadGroupReference;
30+import com.sun.jdi.IncompatibleThreadStateException;
31+import com.sun.jdi.StackFrame;
32+import java.util.List;
33+import java.util.ArrayList;
34+import java.util.Collections;
35+
36+class ThreadInfo {
37+ // This is a list of all known ThreadInfo objects. It survives
38+ // ThreadInfo.invalidateAll, unlike the other static fields below.
39+ private static List<ThreadInfo> threads = Collections.synchronizedList(new ArrayList<ThreadInfo>());
40+ private static boolean gotInitialThreads = false;
41+
42+ private static ThreadInfo current = null;
43+ private static ThreadGroupReference group = null;
44+
45+ private final ThreadReference thread;
46+ private int currentFrameIndex = 0;
47+
48+ private ThreadInfo(ThreadReference thread) {
49+ this.thread = thread;
50+ if (thread == null) {
51+ MessageOutput.fatalError("Internal error: null ThreadInfo created");
52+ }
53+ }
54+
55+ private static void initThreads() {
56+ if (!gotInitialThreads) {
57+ for (ThreadReference thread : Env.vm().allThreads()) {
58+ threads.add(new ThreadInfo(thread));
59+ }
60+ gotInitialThreads = true;
61+ }
62+ }
63+
64+ static void addThread(ThreadReference thread) {
65+ synchronized (threads) {
66+ initThreads();
67+ ThreadInfo ti = new ThreadInfo(thread);
68+ // Guard against duplicates. Duplicates can happen during
69+ // initialization when a particular thread might be added both
70+ // by a thread start event and by the initial call to threads()
71+ if (getThreadInfo(thread) == null) {
72+ threads.add(ti);
73+ }
74+ }
75+ }
76+
77+ static void removeThread(ThreadReference thread) {
78+ if (thread.equals(ThreadInfo.current)) {
79+ // Current thread has died.
80+
81+ // Be careful getting the thread name. If its death happens
82+ // as part of VM termination, it may be too late to get the
83+ // information, and an exception will be thrown.
84+ String currentThreadName;
85+ try {
86+ currentThreadName = "\"" + thread.name() + "\"";
87+ } catch (Exception e) {
88+ currentThreadName = "";
89+ }
90+
91+ setCurrentThread(null);
92+
93+ MessageOutput.println();
94+ MessageOutput.println("Current thread died. Execution continuing...",
95+ currentThreadName);
96+ }
97+ threads.remove(getThreadInfo(thread));
98+ }
99+
100+ static List<ThreadInfo> threads() {
101+ synchronized(threads) {
102+ initThreads();
103+ // Make a copy to allow iteration without synchronization
104+ return new ArrayList<ThreadInfo>(threads);
105+ }
106+ }
107+
108+ static void invalidateAll() {
109+ current = null;
110+ group = null;
111+ synchronized (threads) {
112+ for (ThreadInfo ti : threads()) {
113+ ti.invalidate();
114+ }
115+ }
116+ }
117+
118+ static void setThreadGroup(ThreadGroupReference tg) {
119+ group = tg;
120+ }
121+
122+ static void setCurrentThread(ThreadReference tr) {
123+ if (tr == null) {
124+ setCurrentThreadInfo(null);
125+ } else {
126+ ThreadInfo tinfo = getThreadInfo(tr);
127+ setCurrentThreadInfo(tinfo);
128+ }
129+ }
130+
131+ static void setCurrentThreadInfo(ThreadInfo tinfo) {
132+ current = tinfo;
133+ if (current != null) {
134+ current.invalidate();
135+ }
136+ }
137+
138+ /**
139+ * Get the current ThreadInfo object.
140+ *
141+ * @return the ThreadInfo for the current thread.
142+ */
143+ static ThreadInfo getCurrentThreadInfo() {
144+ return current;
145+ }
146+
147+ /**
148+ * Get the thread from this ThreadInfo object.
149+ *
150+ * @return the Thread wrapped by this ThreadInfo.
151+ */
152+ ThreadReference getThread() {
153+ return thread;
154+ }
155+
156+ static ThreadGroupReference group() {
157+ if (group == null) {
158+ // Current thread group defaults to the first top level
159+ // thread group.
160+ setThreadGroup(Env.vm().topLevelThreadGroups().get(0));
161+ }
162+ return group;
163+ }
164+
165+ static ThreadInfo getThreadInfo(long id) {
166+ ThreadInfo retInfo = null;
167+
168+ synchronized (threads) {
169+ for (ThreadInfo ti : threads()) {
170+ if (ti.thread.uniqueID() == id) {
171+ retInfo = ti;
172+ break;
173+ }
174+ }
175+ }
176+ return retInfo;
177+ }
178+
179+ static ThreadInfo getThreadInfo(ThreadReference tr) {
180+ return getThreadInfo(tr.uniqueID());
181+ }
182+
183+ static ThreadInfo getThreadInfo(String idToken) {
184+ ThreadInfo tinfo = null;
185+ if (idToken.startsWith("t@")) {
186+ idToken = idToken.substring(2);
187+ }
188+ try {
189+ long threadId = Long.decode(idToken).longValue();
190+ tinfo = getThreadInfo(threadId);
191+ } catch (NumberFormatException e) {
192+ tinfo = null;
193+ }
194+ return tinfo;
195+ }
196+
197+ /**
198+ * Get the thread stack frames.
199+ *
200+ * @return a <code>List</code> of the stack frames.
201+ */
202+ List<StackFrame> getStack() throws IncompatibleThreadStateException {
203+ return thread.frames();
204+ }
205+
206+ /**
207+ * Get the current stackframe.
208+ *
209+ * @return the current stackframe.
210+ */
211+ StackFrame getCurrentFrame() throws IncompatibleThreadStateException {
212+ if (thread.frameCount() == 0) {
213+ return null;
214+ }
215+ return thread.frame(currentFrameIndex);
216+ }
217+
218+ /**
219+ * Invalidate the current stackframe index.
220+ */
221+ void invalidate() {
222+ currentFrameIndex = 0;
223+ }
224+
225+ /* Throw IncompatibleThreadStateException if not suspended */
226+ private void assureSuspended() throws IncompatibleThreadStateException {
227+ if (!thread.isSuspended()) {
228+ throw new IncompatibleThreadStateException();
229+ }
230+ }
231+
232+ /**
233+ * Get the current stackframe index.
234+ *
235+ * @return the number of the current stackframe. Frame zero is the
236+ * closest to the current program counter
237+ */
238+ int getCurrentFrameIndex() {
239+ return currentFrameIndex;
240+ }
241+
242+ /**
243+ * Set the current stackframe to a specific frame.
244+ *
245+ * @param nFrame the number of the desired stackframe. Frame zero is the
246+ * closest to the current program counter
247+ * @exception IllegalAccessError when the thread isn't
248+ * suspended or waiting at a breakpoint
249+ * @exception ArrayIndexOutOfBoundsException when the
250+ * requested frame is beyond the stack boundary
251+ */
252+ void setCurrentFrameIndex(int nFrame) throws IncompatibleThreadStateException {
253+ assureSuspended();
254+ if ((nFrame < 0) || (nFrame >= thread.frameCount())) {
255+ throw new ArrayIndexOutOfBoundsException();
256+ }
257+ currentFrameIndex = nFrame;
258+ }
259+
260+ /**
261+ * Change the current stackframe to be one or more frames higher
262+ * (as in, away from the current program counter).
263+ *
264+ * @param nFrames the number of stackframes
265+ * @exception IllegalAccessError when the thread isn't
266+ * suspended or waiting at a breakpoint
267+ * @exception ArrayIndexOutOfBoundsException when the
268+ * requested frame is beyond the stack boundary
269+ */
270+ void up(int nFrames) throws IncompatibleThreadStateException {
271+ setCurrentFrameIndex(currentFrameIndex + nFrames);
272+ }
273+
274+ /**
275+ * Change the current stackframe to be one or more frames lower
276+ * (as in, toward the current program counter). *
277+ * @param nFrames the number of stackframes
278+ * @exception IllegalAccessError when the thread isn't
279+ * suspended or waiting at a breakpoint
280+ * @exception ArrayIndexOutOfBoundsException when the
281+ * requested frame is beyond the stack boundary
282+ */
283+ void down(int nFrames) throws IncompatibleThreadStateException {
284+ setCurrentFrameIndex(currentFrameIndex - nFrames);
285+ }
286+
287+}
java/pkg/com/sun/tools/example/debug/tty/ThreadIterator.java+73−0
@@ -0,0 +1,73 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.ThreadGroupReference;
29+import com.sun.jdi.ThreadReference;
30+import java.util.List;
31+import java.util.Iterator;
32+
33+class ThreadIterator implements Iterator<ThreadReference> {
34+ Iterator<ThreadReference> it = null;
35+ ThreadGroupIterator tgi;
36+
37+ ThreadIterator(ThreadGroupReference tg) {
38+ tgi = new ThreadGroupIterator(tg);
39+ }
40+
41+ ThreadIterator(List<ThreadGroupReference> tgl) {
42+ tgi = new ThreadGroupIterator(tgl);
43+ }
44+
45+ ThreadIterator() {
46+ tgi = new ThreadGroupIterator();
47+ }
48+
49+ @Override
50+ public boolean hasNext() {
51+ while (it == null || !it.hasNext()) {
52+ if (!tgi.hasNext()) {
53+ return false; // no more
54+ }
55+ it = tgi.nextThreadGroup().threads().iterator();
56+ }
57+ return true;
58+ }
59+
60+ @Override
61+ public ThreadReference next() {
62+ return it.next();
63+ }
64+
65+ public ThreadReference nextThread() {
66+ return next();
67+ }
68+
69+ @Override
70+ public void remove() {
71+ throw new UnsupportedOperationException();
72+ }
73+}
java/pkg/com/sun/tools/example/debug/tty/VMConnection.java+376−0
@@ -0,0 +1,376 @@
1+/*
2+ * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+import com.sun.jdi.*;
29+import com.sun.jdi.connect.*;
30+import com.sun.jdi.request.EventRequestManager;
31+import com.sun.jdi.request.ThreadStartRequest;
32+import com.sun.jdi.request.ThreadDeathRequest;
33+
34+import java.util.*;
35+import java.util.regex.*;
36+import java.io.*;
37+
38+class VMConnection {
39+
40+ private VirtualMachine vm;
41+ private Process process = null;
42+ private int outputCompleteCount = 0;
43+
44+ private final Connector connector;
45+ private final Map<String, com.sun.jdi.connect.Connector.Argument> connectorArgs;
46+ private final int traceFlags;
47+
48+ synchronized void notifyOutputComplete() {
49+ outputCompleteCount++;
50+ notifyAll();
51+ }
52+
53+ synchronized void waitOutputComplete() {
54+ // Wait for stderr and stdout
55+ if (process != null) {
56+ while (outputCompleteCount < 2) {
57+ try {wait();} catch (InterruptedException e) {}
58+ }
59+ }
60+ }
61+
62+ private Connector findConnector(String name) {
63+ for (Connector connector :
64+ Bootstrap.virtualMachineManager().allConnectors()) {
65+ if (connector.name().equals(name)) {
66+ return connector;
67+ }
68+ }
69+ return null;
70+ }
71+
72+ private Map <String, com.sun.jdi.connect.Connector.Argument> parseConnectorArgs(Connector connector, String argString) {
73+ Map<String, com.sun.jdi.connect.Connector.Argument> arguments = connector.defaultArguments();
74+
75+ /*
76+ * We are parsing strings of the form:
77+ * name1=value1,[name2=value2,...]
78+ * However, the value1...valuen substrings may contain
79+ * embedded comma(s), so make provision for quoting inside
80+ * the value substrings. (Bug ID 4285874)
81+ */
82+ String regexPattern =
83+ "(quote=[^,]+,)|" + // special case for quote=.,
84+ "(\\w+=)" + // name=
85+ "(((\"[^\"]*\")|" + // ( "l , ue"
86+ "('[^']*')|" + // 'l , ue'
87+ "([^,'\"]+))+,)"; // v a l u e )+ ,
88+ Pattern p = Pattern.compile(regexPattern);
89+ Matcher m = p.matcher(argString);
90+ while (m.find()) {
91+ int startPosition = m.start();
92+ int endPosition = m.end();
93+ if (startPosition > 0) {
94+ /*
95+ * It is an error if parsing skips over any part of argString.
96+ */
97+ throw new IllegalArgumentException
98+ (MessageOutput.format("Illegal connector argument",
99+ argString));
100+ }
101+
102+ String token = argString.substring(startPosition, endPosition);
103+ int index = token.indexOf('=');
104+ String name = token.substring(0, index);
105+ String value = token.substring(index + 1,
106+ token.length() - 1); // Remove comma delimiter
107+
108+ Connector.Argument argument = arguments.get(name);
109+ if (argument == null) {
110+ throw new IllegalArgumentException
111+ (MessageOutput.format("Argument is not defined for connector:",
112+ new Object [] {name, connector.name()}));
113+ }
114+ argument.setValue(value);
115+
116+ argString = argString.substring(endPosition); // Remove what was just parsed...
117+ m = p.matcher(argString); // and parse again on what is left.
118+ }
119+ if ((! argString.equals(",")) && (argString.length() > 0)) {
120+ /*
121+ * It is an error if any part of argString is left over,
122+ * unless it was empty to begin with.
123+ */
124+ throw new IllegalArgumentException
125+ (MessageOutput.format("Illegal connector argument", argString));
126+ }
127+ return arguments;
128+ }
129+
130+ VMConnection(String connectSpec, int traceFlags) {
131+ String nameString;
132+ String argString;
133+ int index = connectSpec.indexOf(':');
134+ if (index == -1) {
135+ nameString = connectSpec;
136+ argString = "";
137+ } else {
138+ nameString = connectSpec.substring(0, index);
139+ argString = connectSpec.substring(index + 1);
140+ }
141+
142+ connector = findConnector(nameString);
143+ if (connector == null) {
144+ throw new IllegalArgumentException
145+ (MessageOutput.format("No connector named:", nameString));
146+ }
147+
148+ connectorArgs = parseConnectorArgs(connector, argString);
149+ this.traceFlags = traceFlags;
150+ }
151+
152+ synchronized VirtualMachine open() {
153+ if (connector instanceof LaunchingConnector) {
154+ vm = launchTarget();
155+ } else if (connector instanceof AttachingConnector) {
156+ vm = attachTarget();
157+ } else if (connector instanceof ListeningConnector) {
158+ vm = listenTarget();
159+ } else {
160+ throw new InternalError
161+ (MessageOutput.format("Invalid connect type"));
162+ }
163+ vm.setDebugTraceMode(traceFlags);
164+ if (vm.canBeModified()){
165+ setEventRequests(vm);
166+ resolveEventRequests();
167+ }
168+ /*
169+ * Now that the vm connection is open, fetch the debugee
170+ * classpath and set up a default sourcepath.
171+ * (Unless user supplied a sourcepath on the command line)
172+ * (Bug ID 4186582)
173+ */
174+ if (Env.getSourcePath().length() == 0) {
175+ if (vm instanceof PathSearchingVirtualMachine) {
176+ PathSearchingVirtualMachine psvm =
177+ (PathSearchingVirtualMachine) vm;
178+ Env.setSourcePath(psvm.classPath());
179+ } else {
180+ Env.setSourcePath(".");
181+ }
182+ }
183+
184+ return vm;
185+ }
186+
187+ boolean setConnectorArg(String name, String value) {
188+ /*
189+ * Too late if the connection already made
190+ */
191+ if (vm != null) {
192+ return false;
193+ }
194+
195+ Connector.Argument argument = connectorArgs.get(name);
196+ if (argument == null) {
197+ return false;
198+ }
199+ argument.setValue(value);
200+ return true;
201+ }
202+
203+ String connectorArg(String name) {
204+ Connector.Argument argument = connectorArgs.get(name);
205+ if (argument == null) {
206+ return "";
207+ }
208+ return argument.value();
209+ }
210+
211+ public synchronized VirtualMachine vm() {
212+ if (vm == null) {
213+ throw new VMNotConnectedException();
214+ } else {
215+ return vm;
216+ }
217+ }
218+
219+ boolean isOpen() {
220+ return (vm != null);
221+ }
222+
223+ boolean isLaunch() {
224+ return (connector instanceof LaunchingConnector);
225+ }
226+
227+ public void disposeVM() {
228+ try {
229+ if (vm != null) {
230+ vm.dispose();
231+ vm = null;
232+ }
233+ } finally {
234+ if (process != null) {
235+ process.destroy();
236+ process = null;
237+ }
238+ waitOutputComplete();
239+ }
240+ }
241+
242+ private void setEventRequests(VirtualMachine vm) {
243+ EventRequestManager erm = vm.eventRequestManager();
244+
245+ // Normally, we want all uncaught exceptions. We request them
246+ // via the same mechanism as Commands.commandCatchException()
247+ // so the user can ignore them later if they are not
248+ // interested.
249+ // FIXME: this works but generates spurious messages on stdout
250+ // during startup:
251+ // Set uncaught java.lang.Throwable
252+ // Set deferred uncaught java.lang.Throwable
253+ Commands evaluator = new Commands();
254+ evaluator.commandCatchException
255+ (new StringTokenizer("uncaught java.lang.Throwable"));
256+
257+ ThreadStartRequest tsr = erm.createThreadStartRequest();
258+ tsr.enable();
259+ ThreadDeathRequest tdr = erm.createThreadDeathRequest();
260+ tdr.enable();
261+ }
262+
263+ private void resolveEventRequests() {
264+ Env.specList.resolveAll();
265+ }
266+
267+ private void dumpStream(InputStream stream) throws IOException {
268+ BufferedReader in =
269+ new BufferedReader(new InputStreamReader(stream));
270+ int i;
271+ try {
272+ while ((i = in.read()) != -1) {
273+ MessageOutput.printDirect((char)i);// Special case: use
274+ // printDirect()
275+ }
276+ } catch (IOException ex) {
277+ String s = ex.getMessage();
278+ if (!s.startsWith("Bad file number")) {
279+ throw ex;
280+ }
281+ // else we got a Bad file number IOException which just means
282+ // that the debuggee has gone away. We'll just treat it the
283+ // same as if we got an EOF.
284+ }
285+ }
286+
287+ /**
288+ * Create a Thread that will retrieve and display any output.
289+ * Needs to be high priority, else debugger may exit before
290+ * it can be displayed.
291+ */
292+ private void displayRemoteOutput(final InputStream stream) {
293+ Thread thr = new Thread("output reader") {
294+ @Override
295+ public void run() {
296+ try {
297+ dumpStream(stream);
298+ } catch (IOException ex) {
299+ MessageOutput.fatalError("Failed reading output");
300+ } finally {
301+ notifyOutputComplete();
302+ }
303+ }
304+ };
305+ thr.setPriority(Thread.MAX_PRIORITY-1);
306+ thr.start();
307+ }
308+
309+ private void dumpFailedLaunchInfo(Process process) {
310+ try {
311+ dumpStream(process.getErrorStream());
312+ dumpStream(process.getInputStream());
313+ } catch (IOException e) {
314+ MessageOutput.println("Unable to display process output:",
315+ e.getMessage());
316+ }
317+ }
318+
319+ /* launch child target vm */
320+ private VirtualMachine launchTarget() {
321+ LaunchingConnector launcher = (LaunchingConnector)connector;
322+ try {
323+ VirtualMachine vm = launcher.launch(connectorArgs);
324+ process = vm.process();
325+ displayRemoteOutput(process.getErrorStream());
326+ displayRemoteOutput(process.getInputStream());
327+ return vm;
328+ } catch (IOException ioe) {
329+ ioe.printStackTrace();
330+ MessageOutput.fatalError("Unable to launch target VM.");
331+ } catch (IllegalConnectorArgumentsException icae) {
332+ icae.printStackTrace();
333+ MessageOutput.fatalError("Internal debugger error.");
334+ } catch (VMStartException vmse) {
335+ MessageOutput.println("vmstartexception", vmse.getMessage());
336+ MessageOutput.println();
337+ dumpFailedLaunchInfo(vmse.process());
338+ MessageOutput.fatalError("Target VM failed to initialize.");
339+ }
340+ return null; // Shuts up the compiler
341+ }
342+
343+ /* attach to running target vm */
344+ private VirtualMachine attachTarget() {
345+ AttachingConnector attacher = (AttachingConnector)connector;
346+ try {
347+ return attacher.attach(connectorArgs);
348+ } catch (IOException ioe) {
349+ ioe.printStackTrace();
350+ MessageOutput.fatalError("Unable to attach to target VM.");
351+ } catch (IllegalConnectorArgumentsException icae) {
352+ icae.printStackTrace();
353+ MessageOutput.fatalError("Internal debugger error.");
354+ }
355+ return null; // Shuts up the compiler
356+ }
357+
358+ /* listen for connection from target vm */
359+ private VirtualMachine listenTarget() {
360+ ListeningConnector listener = (ListeningConnector)connector;
361+ try {
362+ String retAddress = listener.startListening(connectorArgs);
363+ MessageOutput.println("Listening at address:", retAddress);
364+ vm = listener.accept(connectorArgs);
365+ listener.stopListening(connectorArgs);
366+ return vm;
367+ } catch (IOException ioe) {
368+ ioe.printStackTrace();
369+ MessageOutput.fatalError("Unable to attach to target VM.");
370+ } catch (IllegalConnectorArgumentsException icae) {
371+ icae.printStackTrace();
372+ MessageOutput.fatalError("Internal debugger error.");
373+ }
374+ return null; // Shuts up the compiler
375+ }
376+}
java/pkg/com/sun/tools/example/debug/tty/VMNotConnectedException.java+39−0
@@ -0,0 +1,39 @@
1+/*
2+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+public class VMNotConnectedException extends RuntimeException {
29+
30+ private static final long serialVersionUID = -7433430494903950165L;
31+
32+ public VMNotConnectedException() {
33+ super();
34+ }
35+
36+ public VMNotConnectedException(String s) {
37+ super(s);
38+ }
39+}
java/pkg/com/sun/tools/example/debug/tty/WatchpointSpec.java+68−0
@@ -0,0 +1,68 @@
1+/*
2+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package com.sun.tools.example.debug.tty;
27+
28+abstract class WatchpointSpec extends EventRequestSpec {
29+ final String fieldId;
30+
31+ WatchpointSpec(ReferenceTypeSpec refSpec, String fieldId)
32+ throws MalformedMemberNameException {
33+ super(refSpec);
34+ this.fieldId = fieldId;
35+ if (!isJavaIdentifier(fieldId)) {
36+ throw new MalformedMemberNameException(fieldId);
37+ }
38+ }
39+
40+ @Override
41+ public int hashCode() {
42+ return refSpec.hashCode() + fieldId.hashCode() +
43+ getClass().hashCode();
44+ }
45+
46+ @Override
47+ public boolean equals(Object obj) {
48+ if (obj instanceof WatchpointSpec) {
49+ WatchpointSpec watchpoint = (WatchpointSpec)obj;
50+
51+ return fieldId.equals(watchpoint.fieldId) &&
52+ refSpec.equals(watchpoint.refSpec) &&
53+ getClass().equals(watchpoint.getClass());
54+ } else {
55+ return false;
56+ }
57+ }
58+
59+ @Override
60+ String errorMessageFor(Exception e) {
61+ if (e instanceof NoSuchFieldException) {
62+ return (MessageOutput.format("No field in",
63+ new Object [] {fieldId, refSpec.toString()}));
64+ } else {
65+ return super.errorMessageFor(e);
66+ }
67+ }
68+}
java/pkg/com/sun/tools/example/debug/tty/mkfile+34−0
@@ -0,0 +1,34 @@
1+<../../../../../../../../mkconfig
2+
3+TARG=\
4+ AccessWatchpointSpec.dis\
5+ AmbiguousMethodException.dis\
6+ BreakpointSpec.dis\
7+ Commands.dis\
8+ Env.dis\
9+ EventHandler.dis\
10+ EventNotifier.dis\
11+ EventRequestSpec.dis\
12+ EventRequestSpecList.dis\
13+ ExceptionSpec.dis\
14+ LineNotFoundException.dis\
15+ MalformedMemberNameException.dis\
16+ MessageOutput.dis\
17+ ModificationWatchpointSpec.dis\
18+ PatternReferenceTypeSpec.dis\
19+ ReferenceTypeSpec.dis\
20+ SourceMapper.dis\
21+ ThreadGroupIterator.dis\
22+ ThreadInfo.dis\
23+ ThreadIterator.dis\
24+ TTY.dis\
25+ TTYResources.dis\
26+ TTYResources_ja.dis\
27+ TTYResources_zh_CN.dis\
28+ VMConnection.dis\
29+ VMNotConnectedException.dis\
30+ WatchpointSpec.dis\
31+
32+DISBIN=$ROOT/java/dis/java/java/com/sun/tools/example/debug/tty
33+
34+<$ROOT/mkfiles/mkjava