mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-15 21:05:11 +00:00
7029383: Refresh of non-client demos
Reviewed-by: mchung, ohair
This commit is contained in:
parent
dc6eb040b7
commit
a5e7b8d0d7
@ -26,7 +26,6 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
public class AccessWatchpointSpec extends WatchpointSpec {
|
||||
|
||||
@ -38,6 +37,7 @@ public class AccessWatchpointSpec extends WatchpointSpec {
|
||||
/**
|
||||
* The 'refType' is known to match.
|
||||
*/
|
||||
@Override
|
||||
void resolve(ReferenceType refType) throws InvalidTypeException,
|
||||
NoSuchFieldException {
|
||||
if (!(refType instanceof ClassType)) {
|
||||
@ -51,6 +51,7 @@ public class AccessWatchpointSpec extends WatchpointSpec {
|
||||
.createAccessWatchpointRequest(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof AccessWatchpointSpec) && super.equals(obj);
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class AmbiguousMethodException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 7793370943251707514L;
|
||||
|
||||
public AmbiguousMethodException()
|
||||
{
|
||||
super();
|
||||
|
||||
@ -25,30 +25,33 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
public abstract class BreakpointSpec extends EventRequestSpec {
|
||||
|
||||
BreakpointSpec(EventRequestSpecList specs, ReferenceTypeSpec refSpec) {
|
||||
super(specs, refSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifySet(SpecListener listener, SpecEvent evt) {
|
||||
listener.breakpointSet(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyDeferred(SpecListener listener, SpecEvent evt) {
|
||||
listener.breakpointDeferred(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyResolved(SpecListener listener, SpecEvent evt) {
|
||||
listener.breakpointResolved(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyDeleted(SpecListener listener, SpecEvent evt) {
|
||||
listener.breakpointDeleted(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyError(SpecListener listener, SpecErrorEvent evt) {
|
||||
listener.breakpointError(evt);
|
||||
}
|
||||
|
||||
@ -43,10 +43,6 @@ class ChildSession extends Session {
|
||||
private BufferedReader out;
|
||||
private BufferedReader err;
|
||||
|
||||
private InputWriter inputWriter;
|
||||
private OutputReader outputReader;
|
||||
private OutputReader errorReader;
|
||||
|
||||
private InputListener input;
|
||||
private OutputListener output;
|
||||
private OutputListener error;
|
||||
@ -84,6 +80,7 @@ class ChildSession extends Session {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attach() {
|
||||
|
||||
if (!connectToVMProcess()) {
|
||||
@ -131,6 +128,7 @@ class ChildSession extends Session {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
|
||||
//### debug
|
||||
@ -242,10 +240,7 @@ class ChildSession extends Session {
|
||||
this.diagnostics = diagnostics;
|
||||
}
|
||||
|
||||
public void quit() {
|
||||
running = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
int count;
|
||||
@ -254,6 +249,7 @@ class ChildSession extends Session {
|
||||
// Run in Swing event dispatcher thread.
|
||||
final String chars = new String(buffer, 0, count);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
output.putString(chars);
|
||||
}
|
||||
@ -264,6 +260,7 @@ class ChildSession extends Session {
|
||||
} catch (IOException e) {
|
||||
// Run in Swing event dispatcher thread.
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
diagnostics.putString("IO error reading " +
|
||||
streamName +
|
||||
@ -288,11 +285,7 @@ class ChildSession extends Session {
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
public void quit() {
|
||||
//### Won't have much effect if blocked on input!
|
||||
running = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String line;
|
||||
while (running) {
|
||||
|
||||
@ -25,4 +25,7 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class EvaluationException extends Exception {}
|
||||
public class EvaluationException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 4947109680354951694L;
|
||||
}
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.EventRequest;
|
||||
|
||||
|
||||
@ -26,11 +26,6 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ExceptionSpec extends EventRequestSpec {
|
||||
|
||||
@ -45,22 +40,27 @@ public class ExceptionSpec extends EventRequestSpec {
|
||||
this.notifyUncaught = notifyUncaught;
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifySet(SpecListener listener, SpecEvent evt) {
|
||||
listener.exceptionInterceptSet(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyDeferred(SpecListener listener, SpecEvent evt) {
|
||||
listener.exceptionInterceptDeferred(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyResolved(SpecListener listener, SpecEvent evt) {
|
||||
listener.exceptionInterceptResolved(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyDeleted(SpecListener listener, SpecEvent evt) {
|
||||
listener.exceptionInterceptDeleted(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyError(SpecListener listener, SpecErrorEvent evt) {
|
||||
listener.exceptionInterceptError(evt);
|
||||
}
|
||||
@ -68,16 +68,19 @@ public class ExceptionSpec extends EventRequestSpec {
|
||||
/**
|
||||
* The 'refType' is known to match.
|
||||
*/
|
||||
@Override
|
||||
void resolve(ReferenceType refType) {
|
||||
setRequest(refType.virtualMachine().eventRequestManager()
|
||||
.createExceptionRequest(refType,
|
||||
notifyCaught, notifyUncaught));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return refSpec.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ExceptionSpec) {
|
||||
ExceptionSpec es = (ExceptionSpec)obj;
|
||||
@ -88,6 +91,7 @@ public class ExceptionSpec extends EventRequestSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer("exception catch ");
|
||||
buffer.append(refSpec.toString());
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
import com.sun.jdi.request.*;
|
||||
import com.sun.jdi.connect.*;
|
||||
import com.sun.tools.example.debug.expr.ExpressionParser;
|
||||
@ -56,7 +55,7 @@ public class ExecutionManager {
|
||||
|
||||
// Session Listeners
|
||||
|
||||
Vector<SessionListener> sessionListeners = new Vector<SessionListener>();
|
||||
ArrayList<SessionListener> sessionListeners = new ArrayList<SessionListener>();
|
||||
|
||||
public void addSessionListener(SessionListener listener) {
|
||||
sessionListeners.add(listener);
|
||||
@ -68,7 +67,7 @@ public class ExecutionManager {
|
||||
|
||||
// Spec Listeners
|
||||
|
||||
Vector<SpecListener> specListeners = new Vector<SpecListener>();
|
||||
ArrayList<SpecListener> specListeners = new ArrayList<SpecListener>();
|
||||
|
||||
public void addSpecListener(SpecListener cl) {
|
||||
specListeners.add(cl);
|
||||
@ -80,7 +79,7 @@ public class ExecutionManager {
|
||||
|
||||
// JDI Listeners
|
||||
|
||||
Vector<JDIListener> jdiListeners = new Vector<JDIListener>();
|
||||
ArrayList<JDIListener> jdiListeners = new ArrayList<JDIListener>();
|
||||
|
||||
/**
|
||||
* Adds a JDIListener
|
||||
@ -105,50 +104,50 @@ public class ExecutionManager {
|
||||
|
||||
// App Echo Listeners
|
||||
|
||||
private Vector<OutputListener> appEchoListeners = new Vector<OutputListener>();
|
||||
private ArrayList<OutputListener> appEchoListeners = new ArrayList<OutputListener>();
|
||||
|
||||
public void addApplicationEchoListener(OutputListener l) {
|
||||
appEchoListeners.addElement(l);
|
||||
appEchoListeners.add(l);
|
||||
}
|
||||
|
||||
public void removeApplicationEchoListener(OutputListener l) {
|
||||
appEchoListeners.removeElement(l);
|
||||
appEchoListeners.remove(l);
|
||||
}
|
||||
|
||||
// App Output Listeners
|
||||
|
||||
private Vector<OutputListener> appOutputListeners = new Vector<OutputListener>();
|
||||
private ArrayList<OutputListener> appOutputListeners = new ArrayList<OutputListener>();
|
||||
|
||||
public void addApplicationOutputListener(OutputListener l) {
|
||||
appOutputListeners.addElement(l);
|
||||
appOutputListeners.add(l);
|
||||
}
|
||||
|
||||
public void removeApplicationOutputListener(OutputListener l) {
|
||||
appOutputListeners.removeElement(l);
|
||||
appOutputListeners.remove(l);
|
||||
}
|
||||
|
||||
// App Error Listeners
|
||||
|
||||
private Vector<OutputListener> appErrorListeners = new Vector<OutputListener>();
|
||||
private ArrayList<OutputListener> appErrorListeners = new ArrayList<OutputListener>();
|
||||
|
||||
public void addApplicationErrorListener(OutputListener l) {
|
||||
appErrorListeners.addElement(l);
|
||||
appErrorListeners.add(l);
|
||||
}
|
||||
|
||||
public void removeApplicationErrorListener(OutputListener l) {
|
||||
appErrorListeners.removeElement(l);
|
||||
appErrorListeners.remove(l);
|
||||
}
|
||||
|
||||
// Diagnostic Listeners
|
||||
|
||||
private Vector<OutputListener> diagnosticsListeners = new Vector<OutputListener>();
|
||||
private ArrayList<OutputListener> diagnosticsListeners = new ArrayList<OutputListener>();
|
||||
|
||||
public void addDiagnosticsListener(OutputListener l) {
|
||||
diagnosticsListeners.addElement(l);
|
||||
diagnosticsListeners.add(l);
|
||||
}
|
||||
|
||||
public void removeDiagnosticsListener(OutputListener l) {
|
||||
diagnosticsListeners.removeElement(l);
|
||||
diagnosticsListeners.remove(l);
|
||||
}
|
||||
|
||||
/////////// End Listener Registration //////////////
|
||||
@ -159,7 +158,9 @@ public class ExecutionManager {
|
||||
}
|
||||
|
||||
void ensureActiveSession() throws NoSessionException {
|
||||
if (session == null) throw new NoSessionException();
|
||||
if (session == null) {
|
||||
throw new NoSessionException();
|
||||
}
|
||||
}
|
||||
|
||||
public EventRequestManager eventRequestManager() {
|
||||
@ -293,6 +294,7 @@ public class ExecutionManager {
|
||||
ensureActiveSession();
|
||||
if (f != null) {
|
||||
frameGetter = new ExpressionParser.GetFrame() {
|
||||
@Override
|
||||
public StackFrame get() /* throws IncompatibleThreadStateException */ {
|
||||
return f;
|
||||
}
|
||||
@ -628,35 +630,35 @@ public class ExecutionManager {
|
||||
*/
|
||||
|
||||
private void notifyInterrupted() {
|
||||
Vector l = (Vector)sessionListeners.clone();
|
||||
ArrayList<SessionListener> l = new ArrayList<SessionListener>(sessionListeners);
|
||||
EventObject evt = new EventObject(this);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((SessionListener)l.elementAt(i)).sessionInterrupt(evt);
|
||||
l.get(i).sessionInterrupt(evt);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyContinued() {
|
||||
Vector l = (Vector)sessionListeners.clone();
|
||||
ArrayList<SessionListener> l = new ArrayList<SessionListener>(sessionListeners);
|
||||
EventObject evt = new EventObject(this);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((SessionListener)l.elementAt(i)).sessionContinue(evt);
|
||||
l.get(i).sessionContinue(evt);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifySessionStart() {
|
||||
Vector l = (Vector)sessionListeners.clone();
|
||||
ArrayList<SessionListener> l = new ArrayList<SessionListener>(sessionListeners);
|
||||
EventObject evt = new EventObject(this);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((SessionListener)l.elementAt(i)).sessionStart(evt);
|
||||
l.get(i).sessionStart(evt);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifySessionDeath() {
|
||||
/*** noop for now
|
||||
Vector l = (Vector)sessionListeners.clone();
|
||||
ArrayList<SessionListener> l = new ArrayList<SessionListener>(sessionListeners);
|
||||
EventObject evt = new EventObject(this);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((SessionListener)l.elementAt(i)).sessionDeath(evt);
|
||||
((SessionListener)l.get(i)).sessionDeath(evt);
|
||||
}
|
||||
****/
|
||||
}
|
||||
@ -684,6 +686,7 @@ public class ExecutionManager {
|
||||
}
|
||||
|
||||
private InputListener appInput = new InputListener() {
|
||||
@Override
|
||||
public String getLine() {
|
||||
// Don't allow reader to be interrupted -- catch and retry.
|
||||
String line = null;
|
||||
@ -703,6 +706,7 @@ public class ExecutionManager {
|
||||
// Run in Swing event dispatcher thread.
|
||||
final String input = line;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
echoInputLine(input);
|
||||
}
|
||||
@ -714,37 +718,40 @@ public class ExecutionManager {
|
||||
private static String newline = System.getProperty("line.separator");
|
||||
|
||||
private void echoInputLine(String line) {
|
||||
Vector l = (Vector)appEchoListeners.clone();
|
||||
ArrayList<OutputListener> l = new ArrayList<OutputListener>(appEchoListeners);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
OutputListener ol = (OutputListener)l.elementAt(i);
|
||||
OutputListener ol = l.get(i);
|
||||
ol.putString(line);
|
||||
ol.putString(newline);
|
||||
}
|
||||
}
|
||||
|
||||
private OutputListener appOutput = new OutputListener() {
|
||||
@Override
|
||||
public void putString(String string) {
|
||||
Vector l = (Vector)appOutputListeners.clone();
|
||||
ArrayList<OutputListener> l = new ArrayList<OutputListener>(appEchoListeners);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((OutputListener)l.elementAt(i)).putString(string);
|
||||
l.get(i).putString(string);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private OutputListener appError = new OutputListener() {
|
||||
@Override
|
||||
public void putString(String string) {
|
||||
Vector l = (Vector)appErrorListeners.clone();
|
||||
ArrayList<OutputListener> l = new ArrayList<OutputListener>(appEchoListeners);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((OutputListener)l.elementAt(i)).putString(string);
|
||||
l.get(i).putString(string);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private OutputListener diagnostics = new OutputListener() {
|
||||
@Override
|
||||
public void putString(String string) {
|
||||
Vector l = (Vector)diagnosticsListeners.clone();
|
||||
ArrayList<OutputListener> l = new ArrayList<OutputListener>(diagnosticsListeners);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((OutputListener)l.elementAt(i)).putString(string);
|
||||
l.get(i).putString(string);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -25,4 +25,7 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class FrameIndexOutOfBoundsException extends IndexOutOfBoundsException {}
|
||||
public class FrameIndexOutOfBoundsException extends IndexOutOfBoundsException {
|
||||
|
||||
private static final long serialVersionUID = -4870148107027371437L;
|
||||
}
|
||||
|
||||
@ -28,8 +28,6 @@ package com.sun.tools.example.debug.bdi;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.tools.example.debug.event.*;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
@ -55,6 +53,7 @@ class JDIEventSource extends Thread {
|
||||
this.queue = session.vm.eventQueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
runLoop();
|
||||
@ -78,6 +77,7 @@ class JDIEventSource extends Thread {
|
||||
//### Gross foul hackery!
|
||||
private void dispatchEventSet(final AbstractEventSet es) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean interrupted = es.suspendedAll();
|
||||
es.notify(firstListener);
|
||||
@ -117,54 +117,65 @@ class JDIEventSource extends Thread {
|
||||
//### This is a Hack, deal with it
|
||||
private class FirstListener implements JDIListener {
|
||||
|
||||
@Override
|
||||
public void accessWatchpoint(AccessWatchpointEventSet e) {
|
||||
session.runtime.validateThreadInfo();
|
||||
wantInterrupt = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classPrepare(ClassPrepareEventSet e) {
|
||||
wantInterrupt = false;
|
||||
runtime.resolve(e.getReferenceType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classUnload(ClassUnloadEventSet e) {
|
||||
wantInterrupt = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exception(ExceptionEventSet e) {
|
||||
wantInterrupt = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locationTrigger(LocationTriggerEventSet e) {
|
||||
session.runtime.validateThreadInfo();
|
||||
wantInterrupt = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modificationWatchpoint(ModificationWatchpointEventSet e) {
|
||||
session.runtime.validateThreadInfo();
|
||||
wantInterrupt = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadDeath(ThreadDeathEventSet e) {
|
||||
wantInterrupt = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadStart(ThreadStartEventSet e) {
|
||||
wantInterrupt = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDeath(VMDeathEventSet e) {
|
||||
//### Should have some way to notify user
|
||||
//### that VM died before the session ended.
|
||||
wantInterrupt = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDisconnect(VMDisconnectEventSet e) {
|
||||
//### Notify user?
|
||||
wantInterrupt = false;
|
||||
session.runtime.endSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmStart(VMStartEventSet e) {
|
||||
//### Do we need to do anything with it?
|
||||
wantInterrupt = false;
|
||||
|
||||
@ -26,11 +26,7 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class LineBreakpointSpec extends BreakpointSpec {
|
||||
int lineNumber;
|
||||
@ -44,6 +40,7 @@ public class LineBreakpointSpec extends BreakpointSpec {
|
||||
/**
|
||||
* The 'refType' is known to match.
|
||||
*/
|
||||
@Override
|
||||
void resolve(ReferenceType refType) throws InvalidTypeException,
|
||||
LineNotFoundException {
|
||||
if (!(refType instanceof ClassType)) {
|
||||
@ -81,10 +78,12 @@ public class LineBreakpointSpec extends BreakpointSpec {
|
||||
return lineNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return refSpec.hashCode() + lineNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof LineBreakpointSpec) {
|
||||
LineBreakpointSpec breakpoint = (LineBreakpointSpec)obj;
|
||||
@ -96,6 +95,7 @@ public class LineBreakpointSpec extends BreakpointSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String errorMessageFor(Exception e) {
|
||||
if (e instanceof LineNotFoundException) {
|
||||
return ("No code at line " + lineNumber() + " in " + refSpec);
|
||||
@ -107,6 +107,7 @@ public class LineBreakpointSpec extends BreakpointSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer("breakpoint ");
|
||||
buffer.append(refSpec.toString());
|
||||
|
||||
@ -27,6 +27,9 @@ package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class LineNotFoundException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -5630418117861587582L;
|
||||
|
||||
public LineNotFoundException()
|
||||
{
|
||||
super();
|
||||
|
||||
@ -26,6 +26,9 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
class MalformedMemberNameException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -7726664097374844485L;
|
||||
|
||||
public MalformedMemberNameException() {
|
||||
super();
|
||||
}
|
||||
|
||||
@ -26,11 +26,8 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class MethodBreakpointSpec extends BreakpointSpec {
|
||||
String methodId;
|
||||
@ -47,6 +44,7 @@ public class MethodBreakpointSpec extends BreakpointSpec {
|
||||
/**
|
||||
* The 'refType' is known to match.
|
||||
*/
|
||||
@Override
|
||||
void resolve(ReferenceType refType) throws MalformedMemberNameException,
|
||||
AmbiguousMethodException,
|
||||
InvalidTypeException,
|
||||
@ -80,12 +78,14 @@ public class MethodBreakpointSpec extends BreakpointSpec {
|
||||
return methodArgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return refSpec.hashCode() +
|
||||
((methodId != null) ? methodId.hashCode() : 0) +
|
||||
((methodArgs != null) ? methodArgs.hashCode() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof MethodBreakpointSpec) {
|
||||
MethodBreakpointSpec breakpoint = (MethodBreakpointSpec)obj;
|
||||
@ -98,6 +98,7 @@ public class MethodBreakpointSpec extends BreakpointSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String errorMessageFor(Exception e) {
|
||||
if (e instanceof AmbiguousMethodException) {
|
||||
return ("Method " + methodName() + " is overloaded; specify arguments");
|
||||
@ -114,6 +115,7 @@ public class MethodBreakpointSpec extends BreakpointSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer("breakpoint ");
|
||||
buffer.append(refSpec.toString());
|
||||
@ -257,7 +259,7 @@ public class MethodBreakpointSpec extends BreakpointSpec {
|
||||
*/
|
||||
if ((name.indexOf('.') == -1) || name.startsWith("*.")) {
|
||||
try {
|
||||
List refs = specs.runtime.findClassesMatchingPattern(name);
|
||||
List<?> refs = specs.runtime.findClassesMatchingPattern(name);
|
||||
if (refs.size() > 0) { //### ambiguity???
|
||||
name = ((ReferenceType)(refs.get(0))).name();
|
||||
}
|
||||
|
||||
@ -27,6 +27,8 @@ package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class MethodNotFoundException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = -2064968107599632609L;
|
||||
|
||||
public MethodNotFoundException()
|
||||
{
|
||||
super();
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
public class ModificationWatchpointSpec extends WatchpointSpec {
|
||||
|
||||
@ -38,6 +37,7 @@ public class ModificationWatchpointSpec extends WatchpointSpec {
|
||||
/**
|
||||
* The 'refType' is known to match.
|
||||
*/
|
||||
@Override
|
||||
void resolve(ReferenceType refType) throws InvalidTypeException,
|
||||
NoSuchFieldException {
|
||||
if (!(refType instanceof ClassType)) {
|
||||
@ -51,6 +51,7 @@ public class ModificationWatchpointSpec extends WatchpointSpec {
|
||||
.createModificationWatchpointRequest(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof ModificationWatchpointSpec) &&
|
||||
super.equals(obj);
|
||||
|
||||
@ -25,4 +25,7 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class NoSessionException extends Exception {}
|
||||
public class NoSessionException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -7324357828115128603L;
|
||||
}
|
||||
|
||||
@ -25,4 +25,8 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class NoThreadException extends Exception {}
|
||||
public class NoThreadException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1846613539928921998L;
|
||||
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
/**
|
||||
* Does the specified ReferenceType match this spec.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(ReferenceType refType) {
|
||||
if (isWild) {
|
||||
return refType.name().endsWith(classId);
|
||||
@ -55,10 +56,12 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return classId.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof PatternReferenceTypeSpec) {
|
||||
PatternReferenceTypeSpec spec = (PatternReferenceTypeSpec)obj;
|
||||
@ -89,6 +92,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return isWild? "*" + classId : classId;
|
||||
}
|
||||
|
||||
@ -33,7 +33,9 @@ interface ReferenceTypeSpec {
|
||||
*/
|
||||
boolean matches(ReferenceType refType);
|
||||
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
@Override
|
||||
boolean equals(Object obj);
|
||||
}
|
||||
|
||||
@ -27,7 +27,6 @@ package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
import com.sun.jdi.event.EventSet;
|
||||
|
||||
/**
|
||||
* Our repository of what we know about the state of one
|
||||
|
||||
@ -39,6 +39,7 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
/**
|
||||
* Does the specified ReferenceType match this spec.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(ReferenceType refType) {
|
||||
try {
|
||||
if (refType.sourceName().equals(sourceName)) {
|
||||
@ -48,9 +49,6 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
return true;
|
||||
} catch(AbsentInformationException exc) {
|
||||
} catch(ObjectCollectedException exc) {
|
||||
} catch(InvalidLineNumberException exc) {
|
||||
// } catch(ClassNotPreparedException exc) {
|
||||
// -- should not happen, so don't catch this ---
|
||||
}
|
||||
}
|
||||
} catch(AbsentInformationException exc) {
|
||||
@ -59,10 +57,12 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return sourceName.hashCode() + linenumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof SourceNameReferenceTypeSpec) {
|
||||
SourceNameReferenceTypeSpec spec = (SourceNameReferenceTypeSpec)obj;
|
||||
@ -74,6 +74,7 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return sourceName + "@" + linenumber;
|
||||
}
|
||||
|
||||
@ -25,10 +25,9 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
public class SpecErrorEvent extends SpecEvent {
|
||||
|
||||
private static final long serialVersionUID = 8162634387866409578L;
|
||||
private Exception reason;
|
||||
|
||||
public SpecErrorEvent(EventRequestSpec eventRequestSpec,
|
||||
|
||||
@ -31,6 +31,7 @@ import com.sun.jdi.request.EventRequest;
|
||||
|
||||
public class SpecEvent extends EventObject {
|
||||
|
||||
private static final long serialVersionUID = 4820735456787276230L;
|
||||
private EventRequestSpec eventRequestSpec;
|
||||
|
||||
public SpecEvent(EventRequestSpec eventRequestSpec) {
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.ThreadGroupReference;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.ArrayList;
|
||||
@ -73,10 +72,12 @@ public class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return !stack.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreadGroupReference next() {
|
||||
return nextThreadGroup();
|
||||
}
|
||||
@ -87,6 +88,7 @@ public class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
|
||||
return tg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@ -26,9 +26,6 @@
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
//### Should handle target VM death or connection failure cleanly.
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ public class ThreadIterator implements Iterator<ThreadReference> {
|
||||
tgi = new ThreadGroupIterator(tgl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
while (it == null || !it.hasNext()) {
|
||||
if (!tgi.hasNext()) {
|
||||
@ -53,6 +54,7 @@ public class ThreadIterator implements Iterator<ThreadReference> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreadReference next() {
|
||||
return it.next();
|
||||
}
|
||||
@ -61,6 +63,7 @@ public class ThreadIterator implements Iterator<ThreadReference> {
|
||||
return next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@ -26,9 +26,6 @@
|
||||
package com.sun.tools.example.debug.bdi; //### does it belong here?
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.jdi.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Utils {
|
||||
|
||||
|
||||
@ -25,4 +25,7 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class VMLaunchFailureException extends Exception {}
|
||||
public class VMLaunchFailureException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -2439646729274310108L;
|
||||
}
|
||||
|
||||
@ -25,4 +25,7 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
public class VMNotInterruptedException extends Exception {}
|
||||
public class VMNotInterruptedException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 8111074582188765600L;
|
||||
}
|
||||
|
||||
@ -25,9 +25,6 @@
|
||||
|
||||
package com.sun.tools.example.debug.bdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
public abstract class WatchpointSpec extends EventRequestSpec {
|
||||
final String fieldId;
|
||||
|
||||
@ -40,31 +37,38 @@ public abstract class WatchpointSpec extends EventRequestSpec {
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifySet(SpecListener listener, SpecEvent evt) {
|
||||
listener.watchpointSet(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyDeferred(SpecListener listener, SpecEvent evt) {
|
||||
listener.watchpointDeferred(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyResolved(SpecListener listener, SpecEvent evt) {
|
||||
listener.watchpointResolved(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyDeleted(SpecListener listener, SpecEvent evt) {
|
||||
listener.watchpointDeleted(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
void notifyError(SpecListener listener, SpecErrorEvent evt) {
|
||||
listener.watchpointError(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return refSpec.hashCode() + fieldId.hashCode() +
|
||||
getClass().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof WatchpointSpec) {
|
||||
WatchpointSpec watchpoint = (WatchpointSpec)obj;
|
||||
@ -77,6 +81,7 @@ public abstract class WatchpointSpec extends EventRequestSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String errorMessageFor(Exception e) {
|
||||
if (e instanceof NoSuchFieldException) {
|
||||
return ("No field " + fieldId + " in " + refSpec);
|
||||
|
||||
@ -33,6 +33,7 @@ import java.util.*;
|
||||
|
||||
public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
|
||||
private static final long serialVersionUID = 2772717574222076977L;
|
||||
private final EventSet jdiEventSet;
|
||||
final Event oneEvent;
|
||||
|
||||
@ -81,6 +82,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
|
||||
// Implement Mirror
|
||||
|
||||
@Override
|
||||
public VirtualMachine virtualMachine() {
|
||||
return jdiEventSet.virtualMachine();
|
||||
}
|
||||
@ -105,10 +107,12 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
return jdiEventSet.suspendPolicy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
jdiEventSet.resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int suspendPolicy() {
|
||||
return jdiEventSet.suspendPolicy();
|
||||
}
|
||||
@ -128,6 +132,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
/**
|
||||
* Return an iterator specific to {@link Event} objects.
|
||||
*/
|
||||
@Override
|
||||
public EventIterator eventIterator() {
|
||||
return jdiEventSet.eventIterator();
|
||||
}
|
||||
@ -142,6 +147,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
*
|
||||
* @return the number of elements in this set (its cardinality).
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
return jdiEventSet.size();
|
||||
}
|
||||
@ -151,6 +157,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
*
|
||||
* @return <tt>true</tt> if this set contains no elements.
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return jdiEventSet.isEmpty();
|
||||
}
|
||||
@ -163,6 +170,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
*
|
||||
* @return <tt>true</tt> if this set contains the specified element.
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return jdiEventSet.contains(o);
|
||||
}
|
||||
@ -174,6 +182,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
*
|
||||
* @return an iterator over the elements in this set.
|
||||
*/
|
||||
@Override
|
||||
public Iterator<Event> iterator() {
|
||||
return jdiEventSet.iterator();
|
||||
}
|
||||
@ -184,6 +193,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
*
|
||||
* @return an array containing all of the elements in this set.
|
||||
*/
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return jdiEventSet.toArray();
|
||||
}
|
||||
@ -202,6 +212,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
* @throws ArrayStoreException the runtime type of a is not a supertype
|
||||
* of the runtime type of every element in this set.
|
||||
*/
|
||||
@Override
|
||||
public <T> T[] toArray(T a[]) {
|
||||
return jdiEventSet.toArray(a);
|
||||
}
|
||||
@ -217,6 +228,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
* @return <tt>true</tt> if this set contains all of the elements of the
|
||||
* specified collection.
|
||||
*/
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return jdiEventSet.containsAll(c);
|
||||
}
|
||||
@ -224,21 +236,27 @@ public abstract class AbstractEventSet extends EventObject implements EventSet {
|
||||
|
||||
// Make the rest of Set unmodifiable
|
||||
|
||||
@Override
|
||||
public boolean add(Event e){
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends Event> coll) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> coll) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> coll) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public void clear() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@ -25,15 +25,17 @@
|
||||
|
||||
package com.sun.tools.example.debug.event;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
|
||||
public class AccessWatchpointEventSet extends WatchpointEventSet {
|
||||
|
||||
private static final long serialVersionUID = -2620394219156607673L;
|
||||
|
||||
AccessWatchpointEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.accessWatchpoint(this);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class ClassPrepareEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = 5958493423581010491L;
|
||||
|
||||
ClassPrepareEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
@ -55,6 +57,7 @@ public class ClassPrepareEventSet extends AbstractEventSet {
|
||||
return ((ClassPrepareEvent)oneEvent).referenceType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.classPrepare(this);
|
||||
}
|
||||
|
||||
@ -25,11 +25,12 @@
|
||||
|
||||
package com.sun.tools.example.debug.event;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
|
||||
public class ClassUnloadEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = 8370341450345835866L;
|
||||
|
||||
ClassUnloadEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
@ -48,6 +49,7 @@ public class ClassUnloadEventSet extends AbstractEventSet {
|
||||
return ((ClassUnloadEvent)oneEvent).classSignature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.classUnload(this);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class ExceptionEventSet extends LocatableEventSet {
|
||||
|
||||
private static final long serialVersionUID = 5328140167954640711L;
|
||||
|
||||
ExceptionEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
@ -75,6 +77,7 @@ public class ExceptionEventSet extends LocatableEventSet {
|
||||
return ((ExceptionEvent)oneEvent).catchLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.exception(this);
|
||||
}
|
||||
|
||||
@ -33,36 +33,47 @@ package com.sun.tools.example.debug.event;
|
||||
*/
|
||||
public class JDIAdapter implements JDIListener {
|
||||
|
||||
@Override
|
||||
public void accessWatchpoint(AccessWatchpointEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classPrepare(ClassPrepareEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classUnload(ClassUnloadEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exception(ExceptionEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locationTrigger(LocationTriggerEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modificationWatchpoint(ModificationWatchpointEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadDeath(ThreadDeathEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadStart(ThreadStartEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDeath(VMDeathEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDisconnect(VMDisconnectEventSet e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmStart(VMStartEventSet e) {
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@ import com.sun.jdi.event.*;
|
||||
*/
|
||||
public abstract class LocatableEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = 1027131209997915620L;
|
||||
|
||||
LocatableEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
|
||||
@ -25,15 +25,17 @@
|
||||
|
||||
package com.sun.tools.example.debug.event;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
|
||||
public class LocationTriggerEventSet extends LocatableEventSet {
|
||||
|
||||
private static final long serialVersionUID = -3674631710485872487L;
|
||||
|
||||
LocationTriggerEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.locationTrigger(this);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class ModificationWatchpointEventSet extends WatchpointEventSet {
|
||||
|
||||
private static final long serialVersionUID = -680889300856154719L;
|
||||
|
||||
ModificationWatchpointEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
@ -42,6 +44,7 @@ public class ModificationWatchpointEventSet extends WatchpointEventSet {
|
||||
return ((ModificationWatchpointEvent)oneEvent).valueToBe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.modificationWatchpoint(this);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class ThreadDeathEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = -8801604712308151331L;
|
||||
|
||||
ThreadDeathEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
@ -44,6 +46,7 @@ public class ThreadDeathEventSet extends AbstractEventSet {
|
||||
return ((ThreadDeathEvent)oneEvent).thread();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.threadDeath(this);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class ThreadStartEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = -3802096132294933502L;
|
||||
|
||||
ThreadStartEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
@ -44,6 +46,7 @@ public class ThreadStartEventSet extends AbstractEventSet {
|
||||
return ((ThreadStartEvent)oneEvent).thread();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.threadStart(this);
|
||||
}
|
||||
|
||||
@ -29,10 +29,13 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class VMDeathEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = 1163097303940092229L;
|
||||
|
||||
VMDeathEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.vmDeath(this);
|
||||
}
|
||||
|
||||
@ -29,10 +29,13 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class VMDisconnectEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = 7968123152344675342L;
|
||||
|
||||
VMDisconnectEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.vmDisconnect(this);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public class VMStartEventSet extends AbstractEventSet {
|
||||
|
||||
private static final long serialVersionUID = -3384957227835478191L;
|
||||
|
||||
VMStartEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
@ -44,6 +46,7 @@ public class VMStartEventSet extends AbstractEventSet {
|
||||
return ((VMStartEvent)oneEvent).thread();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(JDIListener listener) {
|
||||
listener.vmStart(this);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import com.sun.jdi.event.*;
|
||||
|
||||
public abstract class WatchpointEventSet extends LocatableEventSet {
|
||||
|
||||
private static final long serialVersionUID = 5606285209703845409L;
|
||||
|
||||
WatchpointEventSet(EventSet jdiEventSet) {
|
||||
super(jdiEventSet);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -156,6 +156,7 @@ abstract class LValue {
|
||||
return new LValueArrayElement(interiorGetValue(), index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return interiorGetValue().toString();
|
||||
@ -419,6 +420,7 @@ abstract class LValue {
|
||||
this.var = var;
|
||||
}
|
||||
|
||||
@Override
|
||||
Value getValue() {
|
||||
if (jdiValue == null) {
|
||||
jdiValue = frame.getValue(var);
|
||||
@ -426,12 +428,14 @@ abstract class LValue {
|
||||
return jdiValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setValue0(Value val) throws InvalidTypeException,
|
||||
ClassNotLoadedException {
|
||||
frame.setValue(var, val);
|
||||
jdiValue = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
void invokeWith(List<Value> arguments) throws ParseException {
|
||||
throw new ParseException(var.name() + " is not a method");
|
||||
}
|
||||
@ -469,6 +473,7 @@ abstract class LValue {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
Value getValue() throws InvocationException, InvalidTypeException,
|
||||
ClassNotLoadedException, IncompatibleThreadStateException,
|
||||
ParseException {
|
||||
@ -485,6 +490,7 @@ abstract class LValue {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setValue0(Value val) throws ParseException,
|
||||
InvalidTypeException,
|
||||
ClassNotLoadedException {
|
||||
@ -495,6 +501,7 @@ abstract class LValue {
|
||||
jdiValue = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
void invokeWith(List<Value> arguments) throws ParseException {
|
||||
if (matchingMethod != null) {
|
||||
throw new ParseException("Invalid consecutive invocations");
|
||||
@ -531,6 +538,7 @@ abstract class LValue {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
Value getValue() throws InvocationException, InvalidTypeException,
|
||||
ClassNotLoadedException, IncompatibleThreadStateException,
|
||||
ParseException {
|
||||
@ -548,6 +556,7 @@ abstract class LValue {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setValue0(Value val)
|
||||
throws ParseException, InvalidTypeException,
|
||||
ClassNotLoadedException {
|
||||
@ -562,6 +571,7 @@ abstract class LValue {
|
||||
jdiValue = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
void invokeWith(List<Value> arguments) throws ParseException {
|
||||
if (matchingMethod != null) {
|
||||
throw new ParseException("Invalid consecutive invocations");
|
||||
@ -589,6 +599,7 @@ abstract class LValue {
|
||||
this.arrayRef = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
Value getValue() {
|
||||
if (jdiValue == null) {
|
||||
jdiValue = arrayRef.virtualMachine().mirrorOf(arrayRef.length());
|
||||
@ -596,10 +607,12 @@ abstract class LValue {
|
||||
return jdiValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setValue0(Value value) throws ParseException {
|
||||
throw new ParseException("Cannot set constant: " + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
void invokeWith(List<Value> arguments) throws ParseException {
|
||||
throw new ParseException("Array element is not a method");
|
||||
}
|
||||
@ -618,6 +631,7 @@ abstract class LValue {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
Value getValue() {
|
||||
if (jdiValue == null) {
|
||||
jdiValue = array.getValue(index);
|
||||
@ -625,12 +639,14 @@ abstract class LValue {
|
||||
return jdiValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setValue0(Value val) throws InvalidTypeException,
|
||||
ClassNotLoadedException {
|
||||
array.setValue(index, val);
|
||||
jdiValue = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
void invokeWith(List<Value> arguments) throws ParseException {
|
||||
throw new ParseException("Array element is not a method");
|
||||
}
|
||||
@ -643,6 +659,7 @@ abstract class LValue {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
Value getValue() {
|
||||
if (jdiValue == null) {
|
||||
jdiValue = value;
|
||||
@ -650,10 +667,12 @@ abstract class LValue {
|
||||
return jdiValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setValue0(Value val) throws ParseException {
|
||||
throw new ParseException("Cannot set constant: " + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
void invokeWith(List<Value> arguments) throws ParseException {
|
||||
throw new ParseException("Constant is not a method");
|
||||
}
|
||||
|
||||
@ -37,6 +37,8 @@ package com.sun.tools.example.debug.expr;
|
||||
*/
|
||||
public class ParseException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 7978489144303647901L;
|
||||
|
||||
/**
|
||||
* This constructor is used by the method "generateParseException"
|
||||
* in the generated parser. Calling this constructor generates
|
||||
@ -119,20 +121,21 @@ public class ParseException extends Exception {
|
||||
* of the final stack trace, and hence the correct error message
|
||||
* gets displayed.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
if (!specialConstructor) {
|
||||
return super.getMessage();
|
||||
}
|
||||
String expected = "";
|
||||
int maxSize = 0;
|
||||
for (int i = 0; i < expectedTokenSequences.length; i++) {
|
||||
if (maxSize < expectedTokenSequences[i].length) {
|
||||
maxSize = expectedTokenSequences[i].length;
|
||||
for (int[] expectedTokenSequence : expectedTokenSequences) {
|
||||
if (maxSize < expectedTokenSequence.length) {
|
||||
maxSize = expectedTokenSequence.length;
|
||||
}
|
||||
for (int j = 0; j < expectedTokenSequences[i].length; j++) {
|
||||
expected += tokenImage[expectedTokenSequences[i][j]] + " ";
|
||||
for (int j = 0; j < expectedTokenSequence.length; j++) {
|
||||
expected += tokenImage[expectedTokenSequence[j]] + " ";
|
||||
}
|
||||
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
|
||||
if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) {
|
||||
expected += "...";
|
||||
}
|
||||
expected += eol + " ";
|
||||
@ -140,7 +143,9 @@ public class ParseException extends Exception {
|
||||
String retval = "Encountered \"";
|
||||
Token tok = currentToken.next;
|
||||
for (int i = 0; i < maxSize; i++) {
|
||||
if (i != 0) retval += " ";
|
||||
if (i != 0) {
|
||||
retval += " ";
|
||||
}
|
||||
if (tok.kind == 0) {
|
||||
retval += tokenImage[0];
|
||||
break;
|
||||
|
||||
@ -78,6 +78,7 @@ public class Token {
|
||||
/**
|
||||
* Returns the image.
|
||||
*/
|
||||
@Override
|
||||
public final String toString()
|
||||
{
|
||||
return image;
|
||||
|
||||
@ -32,6 +32,8 @@ public class TokenMgrError extends Error
|
||||
* Ordinals for various reasons why an Error of this type can be thrown.
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = -6236440836177601522L;
|
||||
|
||||
/**
|
||||
* Lexical error occured.
|
||||
*/
|
||||
@ -136,6 +138,7 @@ public class TokenMgrError extends Error
|
||||
*
|
||||
* from this method for such cases in the release version of your parser.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return super.getMessage();
|
||||
}
|
||||
|
||||
@ -29,12 +29,12 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
public class ApplicationTool extends JPanel {
|
||||
|
||||
private Environment env;
|
||||
private static final long serialVersionUID = 310966063293205714L;
|
||||
|
||||
private ExecutionManager runtime;
|
||||
|
||||
private TypeScript script;
|
||||
@ -45,13 +45,13 @@ public class ApplicationTool extends JPanel {
|
||||
|
||||
super(new BorderLayout());
|
||||
|
||||
this.env = env;
|
||||
this.runtime = env.getExecutionManager();
|
||||
|
||||
this.script = new TypeScript(PROMPT, false); // No implicit echo.
|
||||
this.add(script);
|
||||
|
||||
script.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
runtime.sendLineToApplication(script.readln());
|
||||
}
|
||||
|
||||
@ -25,12 +25,10 @@
|
||||
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import javax.swing.event.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
@ -40,6 +38,8 @@ import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
public class ClassTreeTool extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 526178912591739259L;
|
||||
|
||||
private Environment env;
|
||||
|
||||
private ExecutionManager runtime;
|
||||
@ -49,7 +49,7 @@ public class ClassTreeTool extends JPanel {
|
||||
private JTree tree;
|
||||
private DefaultTreeModel treeModel;
|
||||
private ClassTreeNode root;
|
||||
private SearchPath sourcePath;
|
||||
// private SearchPath sourcePath;
|
||||
|
||||
private CommandInterpreter interpreter;
|
||||
|
||||
@ -87,6 +87,7 @@ public class ClassTreeTool extends JPanel {
|
||||
******/
|
||||
|
||||
MouseListener ml = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int selRow = tree.getRowForLocation(e.getX(), e.getY());
|
||||
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
|
||||
@ -121,6 +122,7 @@ public class ClassTreeTool extends JPanel {
|
||||
|
||||
// SessionListener
|
||||
|
||||
@Override
|
||||
public void sessionStart(EventObject e) {
|
||||
// Get system classes and any others loaded before attaching.
|
||||
try {
|
||||
@ -134,19 +136,24 @@ public class ClassTreeTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionInterrupt(EventObject e) {}
|
||||
@Override
|
||||
public void sessionContinue(EventObject e) {}
|
||||
|
||||
// JDIListener
|
||||
|
||||
@Override
|
||||
public void classPrepare(ClassPrepareEventSet e) {
|
||||
root.addClass(e.getReferenceType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classUnload(ClassUnloadEventSet e) {
|
||||
root.removeClass(e.getClassName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDisconnect(VMDisconnectEventSet e) {
|
||||
// Clear contents of this view.
|
||||
root = createClassTree(HEADING);
|
||||
@ -169,6 +176,7 @@ public class ClassTreeTool extends JPanel {
|
||||
this.refTy = refTy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
@ -185,6 +193,7 @@ public class ClassTreeTool extends JPanel {
|
||||
return (refTy == null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaf() {
|
||||
return !isPackage();
|
||||
}
|
||||
|
||||
@ -29,8 +29,6 @@ import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
public class CommandInterpreter {
|
||||
@ -93,9 +91,9 @@ public class CommandInterpreter {
|
||||
try {
|
||||
ThreadReference[] threads = threads();
|
||||
long threadID = Long.parseLong(id, 16);
|
||||
for (int i = 0; i < threads.length; i++) {
|
||||
if (threads[i].uniqueID() == threadID) {
|
||||
thread = threads[i];
|
||||
for (ThreadReference thread2 : threads) {
|
||||
if (thread2.uniqueID() == threadID) {
|
||||
thread = thread2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -239,16 +237,18 @@ public class CommandInterpreter {
|
||||
for (int i = 0 ; i < tlist.size() ; i++) {
|
||||
ThreadReference thr = tlist.get(i);
|
||||
int len = Utils.description(thr).length();
|
||||
if (len > maxId)
|
||||
if (len > maxId) {
|
||||
maxId = len;
|
||||
}
|
||||
String name = thr.name();
|
||||
int iDot = name.lastIndexOf('.');
|
||||
if (iDot >= 0 && name.length() > iDot) {
|
||||
name = name.substring(iDot + 1);
|
||||
}
|
||||
if (name.length() > maxName)
|
||||
if (name.length() > maxName) {
|
||||
maxName = name.length();
|
||||
}
|
||||
}
|
||||
String maxNumString = String.valueOf(iThread + tlist.size());
|
||||
int maxNumDigits = maxNumString.length();
|
||||
for (int i = 0 ; i < tlist.size() ; i++) {
|
||||
@ -616,7 +616,6 @@ public class CommandInterpreter {
|
||||
int cnt = 1;
|
||||
if (t.hasMoreTokens()) {
|
||||
String idToken = t.nextToken();
|
||||
int n;
|
||||
try {
|
||||
cnt = Integer.valueOf(idToken).intValue();
|
||||
} catch (NumberFormatException e) {
|
||||
@ -885,7 +884,6 @@ public class CommandInterpreter {
|
||||
}
|
||||
|
||||
private void commandStop(StringTokenizer t) throws NoSessionException {
|
||||
Location bploc;
|
||||
String token;
|
||||
|
||||
if (!t.hasMoreTokens()) {
|
||||
|
||||
@ -40,6 +40,8 @@ import com.sun.tools.example.debug.event.*;
|
||||
|
||||
public class CommandTool extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 8613516856378346415L;
|
||||
|
||||
private Environment env;
|
||||
|
||||
private ContextManager context;
|
||||
@ -68,6 +70,7 @@ public class CommandTool extends JPanel {
|
||||
// Establish handler for incoming commands.
|
||||
|
||||
script.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
interpreter.executeCommand(script.readln());
|
||||
}
|
||||
@ -107,15 +110,17 @@ public class CommandTool extends JPanel {
|
||||
|
||||
// JDIListener
|
||||
|
||||
@Override
|
||||
public void accessWatchpoint(AccessWatchpointEventSet e) {
|
||||
setThread(e);
|
||||
for (EventIterator it = e.eventIterator(); it.hasNext(); ) {
|
||||
Event evt = it.nextEvent();
|
||||
it.nextEvent();
|
||||
diagnostics.putString("Watchpoint hit: " +
|
||||
locationString(e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classPrepare(ClassPrepareEventSet e) {
|
||||
if (context.getVerboseFlag()) {
|
||||
String name = e.getReferenceType().name();
|
||||
@ -123,6 +128,7 @@ public class CommandTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classUnload(ClassUnloadEventSet e) {
|
||||
if (context.getVerboseFlag()) {
|
||||
diagnostics.putString("Class " + e.getClassName() +
|
||||
@ -130,12 +136,14 @@ public class CommandTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exception(ExceptionEventSet e) {
|
||||
setThread(e);
|
||||
String name = e.getException().referenceType().name();
|
||||
diagnostics.putString("Exception: " + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locationTrigger(LocationTriggerEventSet e) {
|
||||
String locString = locationString(e);
|
||||
setThread(e);
|
||||
@ -155,15 +163,17 @@ public class CommandTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modificationWatchpoint(ModificationWatchpointEventSet e) {
|
||||
setThread(e);
|
||||
for (EventIterator it = e.eventIterator(); it.hasNext(); ) {
|
||||
Event evt = it.nextEvent();
|
||||
it.nextEvent();
|
||||
diagnostics.putString("Watchpoint hit: " +
|
||||
locationString(e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadDeath(ThreadDeathEventSet e) {
|
||||
if (context.getVerboseFlag()) {
|
||||
diagnostics.putString("Thread " + e.getThread() +
|
||||
@ -171,6 +181,7 @@ public class CommandTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadStart(ThreadStartEventSet e) {
|
||||
if (context.getVerboseFlag()) {
|
||||
diagnostics.putString("Thread " + e.getThread() +
|
||||
@ -178,16 +189,19 @@ public class CommandTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDeath(VMDeathEventSet e) {
|
||||
script.setPrompt(DEFAULT_CMD_PROMPT);
|
||||
diagnostics.putString("VM exited");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDisconnect(VMDisconnectEventSet e) {
|
||||
script.setPrompt(DEFAULT_CMD_PROMPT);
|
||||
diagnostics.putString("Disconnected from VM");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmStart(VMStartEventSet e) {
|
||||
script.setPrompt(DEFAULT_CMD_PROMPT);
|
||||
diagnostics.putString("VM started");
|
||||
@ -195,14 +209,17 @@ public class CommandTool extends JPanel {
|
||||
|
||||
// SessionListener
|
||||
|
||||
@Override
|
||||
public void sessionStart(EventObject e) {}
|
||||
|
||||
@Override
|
||||
public void sessionInterrupt(EventObject e) {
|
||||
Thread.yield(); // fetch output
|
||||
diagnostics.putString("VM interrupted by user.");
|
||||
script.setPrompt(DEFAULT_CMD_PROMPT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionContinue(EventObject e) {
|
||||
diagnostics.putString("Execution resumed.");
|
||||
script.setPrompt(DEFAULT_CMD_PROMPT);
|
||||
@ -210,23 +227,28 @@ public class CommandTool extends JPanel {
|
||||
|
||||
// SpecListener
|
||||
|
||||
@Override
|
||||
public void breakpointSet(SpecEvent e) {
|
||||
EventRequestSpec spec = e.getEventRequestSpec();
|
||||
diagnostics.putString("Breakpoint set at " + spec + ".");
|
||||
}
|
||||
@Override
|
||||
public void breakpointDeferred(SpecEvent e) {
|
||||
EventRequestSpec spec = e.getEventRequestSpec();
|
||||
diagnostics.putString("Breakpoint will be set at " +
|
||||
spec + " when its class is loaded.");
|
||||
}
|
||||
@Override
|
||||
public void breakpointDeleted(SpecEvent e) {
|
||||
EventRequestSpec spec = e.getEventRequestSpec();
|
||||
diagnostics.putString("Breakpoint at " + spec.toString() + " deleted.");
|
||||
}
|
||||
@Override
|
||||
public void breakpointResolved(SpecEvent e) {
|
||||
EventRequestSpec spec = e.getEventRequestSpec();
|
||||
diagnostics.putString("Breakpoint resolved to " + spec.toString() + ".");
|
||||
}
|
||||
@Override
|
||||
public void breakpointError(SpecErrorEvent e) {
|
||||
EventRequestSpec spec = e.getEventRequestSpec();
|
||||
diagnostics.putString("Deferred breakpoint at " +
|
||||
@ -236,25 +258,35 @@ public class CommandTool extends JPanel {
|
||||
|
||||
//### Add info for watchpoints and exceptions
|
||||
|
||||
@Override
|
||||
public void watchpointSet(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointDeferred(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointDeleted(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointResolved(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointError(SpecErrorEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionInterceptSet(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptDeferred(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptDeleted(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptResolved(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptError(SpecErrorEvent e) {
|
||||
}
|
||||
|
||||
@ -263,6 +295,7 @@ public class CommandTool extends JPanel {
|
||||
|
||||
// If the user selects a new current thread or frame, update prompt.
|
||||
|
||||
@Override
|
||||
public void currentFrameChanged(CurrentFrameChangedEvent e) {
|
||||
// Update prompt only if affect thread is current.
|
||||
ThreadReference thread = e.getThread();
|
||||
|
||||
@ -46,7 +46,7 @@ public class ContextManager {
|
||||
|
||||
private boolean verbose;
|
||||
|
||||
private Vector<ContextListener> contextListeners = new Vector<ContextListener>();
|
||||
private ArrayList<ContextListener> contextListeners = new ArrayList<ContextListener>();
|
||||
|
||||
public ContextManager(Environment env) {
|
||||
classManager = env.getClassManager();
|
||||
@ -264,11 +264,11 @@ public class ContextManager {
|
||||
|
||||
private void notifyCurrentFrameChanged(ThreadInfo tinfo, int index,
|
||||
boolean invalidate) {
|
||||
Vector l = (Vector)contextListeners.clone();
|
||||
ArrayList<ContextListener> l = new ArrayList<ContextListener>(contextListeners);
|
||||
CurrentFrameChangedEvent evt =
|
||||
new CurrentFrameChangedEvent(this, tinfo, index, invalidate);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((ContextListener)l.elementAt(i)).currentFrameChanged(evt);
|
||||
l.get(i).currentFrameChanged(evt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,28 +277,34 @@ public class ContextManager {
|
||||
|
||||
// SessionListener
|
||||
|
||||
@Override
|
||||
public void sessionStart(EventObject e) {
|
||||
invalidateCurrentThread();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionInterrupt(EventObject e) {
|
||||
setCurrentThreadInvalidate(currentThread);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionContinue(EventObject e) {
|
||||
invalidateCurrentThread();
|
||||
}
|
||||
|
||||
// JDIListener
|
||||
|
||||
@Override
|
||||
public void locationTrigger(LocationTriggerEventSet e) {
|
||||
setCurrentThreadInvalidate(e.getThread());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exception(ExceptionEventSet e) {
|
||||
setCurrentThreadInvalidate(e.getThread());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDisconnect(VMDisconnectEventSet e) {
|
||||
invalidateCurrentThread();
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import java.util.EventObject;
|
||||
|
||||
public class CurrentFrameChangedEvent extends EventObject {
|
||||
|
||||
private static final long serialVersionUID = 4214479486546762179L;
|
||||
private ThreadInfo tinfo;
|
||||
private int index;
|
||||
private boolean invalidate;
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import java.awt.*;
|
||||
@ -38,6 +36,7 @@ import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
public class GUI extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 3292463234530679091L;
|
||||
private CommandTool cmdTool;
|
||||
private ApplicationTool appTool;
|
||||
//###HACK##
|
||||
@ -87,7 +86,7 @@ public class GUI extends JPanel {
|
||||
threadTreeTool = new ThreadTreeTool(env);
|
||||
threadTreeTool.setPreferredSize(new java.awt.Dimension(200, 450));
|
||||
|
||||
JTabbedPane treePane = new JTabbedPane(JTabbedPane.BOTTOM);
|
||||
JTabbedPane treePane = new JTabbedPane(SwingConstants.BOTTOM);
|
||||
treePane.addTab("Source", null, sourceTreeTool);
|
||||
treePane.addTab("Classes", null, classTreeTool);
|
||||
treePane.addTab("Threads", null, threadTreeTool);
|
||||
@ -139,12 +138,9 @@ public class GUI extends JPanel {
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
String remote = null;
|
||||
String clsName = "";
|
||||
String progArgs = "";
|
||||
String javaArgs = "";
|
||||
boolean verbose = false; //### Not implemented.
|
||||
|
||||
final Environment env = new Environment();
|
||||
|
||||
JPanel mainPanel = new GUI(env);
|
||||
@ -246,13 +242,14 @@ public class GUI extends JPanel {
|
||||
frame.setContentPane(mainPanel);
|
||||
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
env.terminate();
|
||||
}
|
||||
});
|
||||
|
||||
frame.pack();
|
||||
frame.show();
|
||||
frame.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@ package com.sun.tools.example.debug.gui;
|
||||
import java.io.File;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Enumeration;
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.*;
|
||||
|
||||
//### Renamed from 'ExampleFileFilter.java' provided with Swing demos.
|
||||
@ -93,8 +92,12 @@ public class JDBFileFilter extends FileFilter {
|
||||
*/
|
||||
public JDBFileFilter(String extension, String description) {
|
||||
this();
|
||||
if(extension!=null) addExtension(extension);
|
||||
if(description!=null) setDescription(description);
|
||||
if(extension!=null) {
|
||||
addExtension(extension);
|
||||
}
|
||||
if(description!=null) {
|
||||
setDescription(description);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,11 +123,13 @@ public class JDBFileFilter extends FileFilter {
|
||||
*/
|
||||
public JDBFileFilter(String[] filters, String description) {
|
||||
this();
|
||||
for (int i = 0; i < filters.length; i++) {
|
||||
for (String filter : filters) {
|
||||
// add filters one by one
|
||||
addExtension(filters[i]);
|
||||
addExtension(filter);
|
||||
}
|
||||
if(description!=null) setDescription(description);
|
||||
if(description!=null) {
|
||||
setDescription(description);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,6 +141,7 @@ public class JDBFileFilter extends FileFilter {
|
||||
* @see #getExtension
|
||||
* @see FileFilter#accepts
|
||||
*/
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
if(f != null) {
|
||||
if(f.isDirectory()) {
|
||||
@ -196,6 +202,7 @@ public class JDBFileFilter extends FileFilter {
|
||||
* @see isExtensionListInDescription
|
||||
* @see FileFilter#getDescription
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if(fullDescription == null) {
|
||||
if(description == null || isExtensionListInDescription()) {
|
||||
|
||||
@ -31,7 +31,6 @@ import java.awt.event.*;
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
//### This is currently just a placeholder!
|
||||
@ -57,6 +56,7 @@ class JDBMenuBar extends JMenuBar {
|
||||
|
||||
JMenuItem openItem = new JMenuItem("Open...", 'O');
|
||||
openItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
openCommand();
|
||||
}
|
||||
@ -93,6 +93,7 @@ class JDBMenuBar extends JMenuBar {
|
||||
|
||||
JMenuItem monitorItem = new JMenuItem("Monitor Expression...", 'M');
|
||||
monitorItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
monitorCommand();
|
||||
}
|
||||
@ -101,6 +102,7 @@ class JDBMenuBar extends JMenuBar {
|
||||
|
||||
JMenuItem unmonitorItem = new JMenuItem("Unmonitor Expression...");
|
||||
unmonitorItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
unmonitorCommand();
|
||||
}
|
||||
@ -110,6 +112,7 @@ class JDBMenuBar extends JMenuBar {
|
||||
JMenu breakpointMenu = new JMenu("Breakpoint");
|
||||
JMenuItem stopItem = new JMenuItem("Stop in...", 'S');
|
||||
stopItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
buildBreakpoint();
|
||||
}
|
||||
@ -176,6 +179,7 @@ class JDBMenuBar extends JMenuBar {
|
||||
mi.setToolTipText(toolTip);
|
||||
final String cmd = command;
|
||||
mi.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
interpreter.executeCommand(cmd);
|
||||
}
|
||||
|
||||
@ -26,10 +26,8 @@
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
class JDBToolBar extends JToolBar {
|
||||
@ -92,6 +90,7 @@ class JDBToolBar extends JToolBar {
|
||||
button.setToolTipText(toolTip);
|
||||
final String cmd = command;
|
||||
button.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
interpreter.executeCommand(cmd);
|
||||
}
|
||||
|
||||
@ -29,18 +29,10 @@ import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.TitledBorder;
|
||||
@ -98,6 +90,7 @@ class LaunchTool {
|
||||
comp.add(panel);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getText() {
|
||||
return textField.getText();
|
||||
}
|
||||
@ -114,6 +107,7 @@ class LaunchTool {
|
||||
comp.add(panel);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getText() {
|
||||
return ((Connector.BooleanArgument)arg)
|
||||
.stringValueOf(check.getModel().isSelected());
|
||||
@ -147,6 +141,7 @@ class LaunchTool {
|
||||
|
||||
final boolean[] oked = {false};
|
||||
JPanel buttonPanel = okCancel( dialog, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (radioGroup.getSelection() == null) {
|
||||
JOptionPane.showMessageDialog(dialog,
|
||||
@ -162,7 +157,7 @@ class LaunchTool {
|
||||
} );
|
||||
content.add(BorderLayout.SOUTH, buttonPanel);
|
||||
dialog.pack();
|
||||
dialog.show();
|
||||
dialog.setVisible(true);
|
||||
|
||||
return oked[0] ?
|
||||
modelToConnector.get(radioGroup.getSelection()) :
|
||||
@ -178,7 +173,7 @@ class LaunchTool {
|
||||
Container content = dialog.getContentPane();
|
||||
JPanel guts = new JPanel();
|
||||
Border etched = BorderFactory.createEtchedBorder();
|
||||
Border titled = BorderFactory.createTitledBorder(etched,
|
||||
BorderFactory.createTitledBorder(etched,
|
||||
connector.description(),
|
||||
TitledBorder.LEFT, TitledBorder.TOP);
|
||||
guts.setBorder(etched);
|
||||
@ -199,6 +194,7 @@ class LaunchTool {
|
||||
content.add(guts);
|
||||
|
||||
JPanel buttonPanel = okCancel( dialog, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
for (ArgRep ar : argReps) {
|
||||
if (!ar.isSpecified()) {
|
||||
@ -236,7 +232,7 @@ class LaunchTool {
|
||||
} );
|
||||
content.add(BorderLayout.SOUTH, buttonPanel);
|
||||
dialog.pack();
|
||||
dialog.show();
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
private JPanel okCancel(final JDialog dialog, ActionListener okListener) {
|
||||
@ -247,6 +243,7 @@ class LaunchTool {
|
||||
buttonPanel.add(cancel);
|
||||
ok.addActionListener(okListener);
|
||||
cancel.addActionListener( new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
dialog.setVisible(false);
|
||||
dialog.dispose();
|
||||
|
||||
@ -42,10 +42,12 @@ public class MonitorListModel extends AbstractListModel {
|
||||
//### remove listeners on exit!
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
return monitors.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return monitors.size();
|
||||
}
|
||||
@ -70,7 +72,7 @@ public class MonitorListModel extends AbstractListModel {
|
||||
return Collections.unmodifiableList(monitors);
|
||||
}
|
||||
|
||||
public Iterator iterator() {
|
||||
public Iterator<?> iterator() {
|
||||
return monitors().iterator();
|
||||
}
|
||||
|
||||
@ -80,7 +82,8 @@ public class MonitorListModel extends AbstractListModel {
|
||||
|
||||
private class MonitorListListener implements ContextListener {
|
||||
|
||||
public void currentFrameChanged(CurrentFrameChangedEvent e) {
|
||||
@Override
|
||||
public void currentFrameChanged(final CurrentFrameChangedEvent e) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,15 +25,9 @@
|
||||
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import javax.swing.event.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
import com.sun.tools.example.debug.expr.ExpressionParser;
|
||||
@ -41,6 +35,7 @@ import com.sun.tools.example.debug.expr.ParseException;
|
||||
|
||||
public class MonitorTool extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = -645235951031726647L;
|
||||
private ExecutionManager runtime;
|
||||
private ContextManager context;
|
||||
|
||||
@ -64,6 +59,7 @@ public class MonitorTool extends JPanel {
|
||||
}
|
||||
|
||||
private class MonitorToolListener implements ListSelectionListener {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
int index = list.getSelectedIndex();
|
||||
if (index != -1) {
|
||||
@ -78,6 +74,7 @@ public class MonitorTool extends JPanel {
|
||||
IncompatibleThreadStateException {
|
||||
ExpressionParser.GetFrame frameGetter =
|
||||
new ExpressionParser.GetFrame() {
|
||||
@Override
|
||||
public StackFrame get()
|
||||
throws IncompatibleThreadStateException
|
||||
{
|
||||
@ -93,6 +90,7 @@ public class MonitorTool extends JPanel {
|
||||
|
||||
private class MonitorRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list,
|
||||
Object value,
|
||||
int index,
|
||||
|
||||
@ -58,8 +58,8 @@ public class SearchPath {
|
||||
}
|
||||
|
||||
public File resolve(String relativeFileName) {
|
||||
for (int i = 0; i < pathArray.length; i++) {
|
||||
File path = new File(pathArray[i], relativeFileName);
|
||||
for (String element : pathArray) {
|
||||
File path = new File(element, relativeFileName);
|
||||
if (path.exists()) {
|
||||
return path;
|
||||
}
|
||||
@ -76,8 +76,8 @@ public class SearchPath {
|
||||
// classpath is retained. This is the one that will be
|
||||
// found if we later do a 'resolve'.
|
||||
SortedSet<String> s = new TreeSet<String>(); // sorted, no duplicates
|
||||
for (int i = 0; i < pathArray.length; i++) {
|
||||
File path = new File(pathArray[i], relativeDirName);
|
||||
for (String element : pathArray) {
|
||||
File path = new File(element, relativeDirName);
|
||||
if (path.exists()) {
|
||||
String[] childArray = path.list(filter);
|
||||
if (childArray != null) {
|
||||
|
||||
@ -25,22 +25,25 @@
|
||||
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
|
||||
public class SingleLeafTreeSelectionModel extends DefaultTreeSelectionModel {
|
||||
|
||||
private static final long serialVersionUID = -7849105107888117679L;
|
||||
|
||||
SingleLeafTreeSelectionModel() {
|
||||
super();
|
||||
selectionMode = SINGLE_TREE_SELECTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectionPath(TreePath path) {
|
||||
if(((TreeNode)(path.getLastPathComponent())).isLeaf()) {
|
||||
super.setSelectionPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectionPaths(TreePath[] paths) {
|
||||
// Only look at first path, as all others will be
|
||||
// ignored anyway in single tree selection mode.
|
||||
@ -49,12 +52,14 @@ public class SingleLeafTreeSelectionModel extends DefaultTreeSelectionModel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionPath(TreePath path) {
|
||||
if(((TreeNode)(path.getLastPathComponent())).isLeaf()) {
|
||||
super.setSelectionPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionPaths(TreePath[] paths) {
|
||||
// Only look at first path, as all others will be
|
||||
// ignored anyway in single tree selection mode.
|
||||
|
||||
@ -31,7 +31,6 @@ import java.util.*;
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import com.sun.tools.example.debug.event.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
/**
|
||||
* Manage the list of source files.
|
||||
@ -45,7 +44,7 @@ public class SourceManager {
|
||||
private List<SourceModel> sourceList;
|
||||
private SearchPath sourcePath;
|
||||
|
||||
private Vector<SourceListener> sourceListeners = new Vector<SourceListener>();
|
||||
private ArrayList<SourceListener> sourceListeners = new ArrayList<SourceListener>();
|
||||
|
||||
private Map<ReferenceType, SourceModel> classToSource = new HashMap<ReferenceType, SourceModel>();
|
||||
|
||||
@ -79,18 +78,18 @@ public class SourceManager {
|
||||
}
|
||||
|
||||
public void addSourceListener(SourceListener l) {
|
||||
sourceListeners.addElement(l);
|
||||
sourceListeners.add(l);
|
||||
}
|
||||
|
||||
public void removeSourceListener(SourceListener l) {
|
||||
sourceListeners.removeElement(l);
|
||||
sourceListeners.remove(l);
|
||||
}
|
||||
|
||||
private void notifySourcepathChanged() {
|
||||
Vector l = (Vector)sourceListeners.clone();
|
||||
ArrayList<SourceListener> l = new ArrayList<SourceListener>(sourceListeners);
|
||||
SourcepathChangedEvent evt = new SourcepathChangedEvent(this);
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
((SourceListener)l.elementAt(i)).sourcepathChanged(evt);
|
||||
l.get(i).sourcepathChanged(evt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,6 +162,7 @@ public class SourceManager {
|
||||
private class SMClassListener extends JDIAdapter
|
||||
implements JDIListener {
|
||||
|
||||
@Override
|
||||
public void classPrepare(ClassPrepareEventSet e) {
|
||||
ReferenceType refType = e.getReferenceType();
|
||||
SourceModel sm = sourceForClass(refType);
|
||||
@ -171,6 +171,7 @@ public class SourceManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classUnload(ClassUnloadEventSet e) {
|
||||
//### iterate through looking for (e.getTypeName()).
|
||||
//### then remove it.
|
||||
|
||||
@ -31,8 +31,6 @@ import java.util.*;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
@ -101,6 +99,7 @@ public class SourceModel extends AbstractListModel {
|
||||
|
||||
// **** Implement ListModel *****
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
if (sourceLines == null) {
|
||||
initialize();
|
||||
@ -108,6 +107,7 @@ public class SourceModel extends AbstractListModel {
|
||||
return sourceLines.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (sourceLines == null) {
|
||||
initialize();
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
@ -35,13 +33,12 @@ import javax.swing.*;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
import com.sun.tools.example.debug.event.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SourceTool extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = -5461299294186395257L;
|
||||
|
||||
private Environment env;
|
||||
|
||||
private ExecutionManager runtime;
|
||||
@ -99,6 +96,7 @@ public class SourceTool extends JPanel {
|
||||
|
||||
// ContextListener
|
||||
|
||||
@Override
|
||||
public void currentFrameChanged(CurrentFrameChangedEvent e) {
|
||||
showSourceContext(e.getThread(), e.getIndex());
|
||||
}
|
||||
@ -108,6 +106,7 @@ public class SourceTool extends JPanel {
|
||||
|
||||
// SourceListener
|
||||
|
||||
@Override
|
||||
public void sourcepathChanged(SourcepathChangedEvent e) {
|
||||
// Reload source view if its contents depend
|
||||
// on the source path.
|
||||
@ -120,12 +119,15 @@ public class SourceTool extends JPanel {
|
||||
|
||||
// SpecListener
|
||||
|
||||
@Override
|
||||
public void breakpointSet(SpecEvent e) {
|
||||
breakpointResolved(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointDeferred(SpecEvent e) { }
|
||||
|
||||
@Override
|
||||
public void breakpointDeleted(SpecEvent e) {
|
||||
BreakpointRequest req = (BreakpointRequest)e.getEventRequest();
|
||||
Location loc = req.location();
|
||||
@ -139,6 +141,7 @@ public class SourceTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointResolved(SpecEvent e) {
|
||||
BreakpointRequest req = (BreakpointRequest)e.getEventRequest();
|
||||
Location loc = req.location();
|
||||
@ -150,29 +153,40 @@ public class SourceTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointError(SpecErrorEvent e) {
|
||||
breakpointDeleted(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watchpointSet(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointDeferred(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointDeleted(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointResolved(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void watchpointError(SpecErrorEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionInterceptSet(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptDeferred(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptDeleted(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptResolved(SpecEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void exceptionInterceptError(SpecErrorEvent e) {
|
||||
}
|
||||
}
|
||||
@ -269,6 +283,7 @@ public class SourceTool extends JPanel {
|
||||
|
||||
private class SourceLineRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list,
|
||||
Object value,
|
||||
int index,
|
||||
@ -301,6 +316,7 @@ public class SourceTool extends JPanel {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension dim = super.getPreferredSize();
|
||||
return new Dimension(dim.width, dim.height-5);
|
||||
@ -309,6 +325,7 @@ public class SourceTool extends JPanel {
|
||||
}
|
||||
|
||||
private class STMouseListener extends MouseAdapter implements MouseListener {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
showPopupMenu((Component)e.getSource(),
|
||||
@ -316,6 +333,7 @@ public class SourceTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
showPopupMenu((Component)e.getSource(),
|
||||
@ -354,6 +372,7 @@ public class SourceTool extends JPanel {
|
||||
private JMenuItem commandItem(String label, final String cmd) {
|
||||
JMenuItem item = new JMenuItem(label);
|
||||
item.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
interpreter.executeCommand(cmd);
|
||||
}
|
||||
|
||||
@ -30,15 +30,15 @@ import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import javax.swing.event.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
public class SourceTreeTool extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 3336680912107956419L;
|
||||
|
||||
private Environment env;
|
||||
|
||||
private ExecutionManager runtime;
|
||||
@ -81,6 +81,7 @@ public class SourceTreeTool extends JPanel {
|
||||
******/
|
||||
|
||||
MouseListener ml = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int selRow = tree.getRowForLocation(e.getX(), e.getY());
|
||||
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
|
||||
@ -112,6 +113,7 @@ public class SourceTreeTool extends JPanel {
|
||||
|
||||
private class SourceTreeToolListener implements SourceListener {
|
||||
|
||||
@Override
|
||||
public void sourcepathChanged(SourcepathChangedEvent e) {
|
||||
sourcePath = sourceManager.getSourcePath();
|
||||
root = createDirectoryTree(HEADING);
|
||||
@ -121,6 +123,7 @@ public class SourceTreeTool extends JPanel {
|
||||
}
|
||||
|
||||
private static class SourceOrDirectoryFilter implements FilenameFilter {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return (name.endsWith(".java") ||
|
||||
new File(dir, name).isDirectory());
|
||||
@ -158,6 +161,7 @@ public class SourceTreeTool extends JPanel {
|
||||
this.isDirectory = isDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
@ -195,6 +199,7 @@ public class SourceTreeTool extends JPanel {
|
||||
* Returns the child <code>TreeNode</code> at index
|
||||
* <code>childIndex</code>.
|
||||
*/
|
||||
@Override
|
||||
public TreeNode getChildAt(int childIndex) {
|
||||
expandIfNeeded();
|
||||
return children[childIndex];
|
||||
@ -204,6 +209,7 @@ public class SourceTreeTool extends JPanel {
|
||||
* Returns the number of children <code>TreeNode</code>s the receiver
|
||||
* contains.
|
||||
*/
|
||||
@Override
|
||||
public int getChildCount() {
|
||||
expandIfNeeded();
|
||||
return children.length;
|
||||
@ -212,6 +218,7 @@ public class SourceTreeTool extends JPanel {
|
||||
/**
|
||||
* Returns the parent <code>TreeNode</code> of the receiver.
|
||||
*/
|
||||
@Override
|
||||
public TreeNode getParent() {
|
||||
return parent;
|
||||
}
|
||||
@ -221,18 +228,21 @@ public class SourceTreeTool extends JPanel {
|
||||
* If the receiver does not contain <code>node</code>, -1 will be
|
||||
* returned.
|
||||
*/
|
||||
@Override
|
||||
public int getIndex(TreeNode node) {
|
||||
expandIfNeeded();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
if (children[i] == node)
|
||||
if (children[i] == node) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the receiver allows children.
|
||||
*/
|
||||
@Override
|
||||
public boolean getAllowsChildren() {
|
||||
return isDirectory;
|
||||
}
|
||||
@ -240,6 +250,7 @@ public class SourceTreeTool extends JPanel {
|
||||
/**
|
||||
* Returns true if the receiver is a leaf.
|
||||
*/
|
||||
@Override
|
||||
public boolean isLeaf() {
|
||||
expandIfNeeded();
|
||||
return !isDirectory;
|
||||
@ -248,13 +259,16 @@ public class SourceTreeTool extends JPanel {
|
||||
/**
|
||||
* Returns the children of the receiver as an Enumeration.
|
||||
*/
|
||||
@Override
|
||||
public Enumeration children() {
|
||||
expandIfNeeded();
|
||||
return new Enumeration() {
|
||||
int i = 0;
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
return (i < children.length);
|
||||
}
|
||||
@Override
|
||||
public Object nextElement() throws NoSuchElementException {
|
||||
if (i >= children.length) {
|
||||
throw new NoSuchElementException();
|
||||
|
||||
@ -29,6 +29,8 @@ import java.util.EventObject;
|
||||
|
||||
public class SourcepathChangedEvent extends EventObject {
|
||||
|
||||
private static final long serialVersionUID = 8762169481005804121L;
|
||||
|
||||
public SourcepathChangedEvent(Object source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@ -25,21 +25,16 @@
|
||||
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.List; // Must import explicitly due to conflict with javax.awt.List
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import javax.swing.event.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
public class StackTraceTool extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 9140041989427965718L;
|
||||
|
||||
private Environment env;
|
||||
|
||||
private ExecutionManager runtime;
|
||||
@ -85,6 +80,7 @@ public class StackTraceTool extends JPanel {
|
||||
|
||||
//### I suspect we handle the case badly that the VM is not interrupted.
|
||||
|
||||
@Override
|
||||
public void currentFrameChanged(CurrentFrameChangedEvent e) {
|
||||
// If the current frame of the thread appearing in this
|
||||
// view is changed, move the selection to track it.
|
||||
@ -103,6 +99,7 @@ public class StackTraceTool extends JPanel {
|
||||
|
||||
// ListSelectionListener
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
int index = list.getSelectedIndex();
|
||||
if (index != -1) {
|
||||
@ -117,6 +114,7 @@ public class StackTraceTool extends JPanel {
|
||||
|
||||
private class StackFrameRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list,
|
||||
Object value,
|
||||
int index,
|
||||
@ -174,6 +172,7 @@ public class StackTraceTool extends JPanel {
|
||||
this.tinfo = tinfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
try {
|
||||
return tinfo == null? null : tinfo.getFrame(index);
|
||||
@ -186,6 +185,7 @@ public class StackTraceTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
try {
|
||||
return tinfo == null? 1 : tinfo.getFrameCount();
|
||||
|
||||
@ -25,13 +25,11 @@
|
||||
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.List; // Must import explicitly due to conflict with javax.awt.List
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import javax.swing.event.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
@ -45,6 +43,8 @@ import com.sun.tools.example.debug.bdi.*;
|
||||
|
||||
public class ThreadTreeTool extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 4168599992853038878L;
|
||||
|
||||
private Environment env;
|
||||
|
||||
private ExecutionManager runtime;
|
||||
@ -79,6 +79,7 @@ public class ThreadTreeTool extends JPanel {
|
||||
tree.setSelectionModel(new SingleLeafTreeSelectionModel());
|
||||
|
||||
MouseListener ml = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int selRow = tree.getRowForLocation(e.getX(), e.getY());
|
||||
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
|
||||
@ -131,6 +132,7 @@ public class ThreadTreeTool extends JPanel {
|
||||
|
||||
// SessionListener
|
||||
|
||||
@Override
|
||||
public void sessionStart(EventObject e) {
|
||||
try {
|
||||
for (ThreadReference thread : runtime.allThreads()) {
|
||||
@ -143,20 +145,25 @@ public class ThreadTreeTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionInterrupt(EventObject e) {}
|
||||
@Override
|
||||
public void sessionContinue(EventObject e) {}
|
||||
|
||||
|
||||
// JDIListener
|
||||
|
||||
@Override
|
||||
public void threadStart(ThreadStartEventSet e) {
|
||||
root.addThread(e.getThread());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadDeath(ThreadDeathEventSet e) {
|
||||
root.removeThread(e.getThread());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDisconnect(VMDisconnectEventSet e) {
|
||||
// Clear the contents of this view.
|
||||
root = createThreadTree(HEADING);
|
||||
@ -193,6 +200,7 @@ public class ThreadTreeTool extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return description;
|
||||
}
|
||||
@ -213,6 +221,7 @@ public class ThreadTreeTool extends JPanel {
|
||||
return (thread == null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaf() {
|
||||
return !isThreadGroup();
|
||||
}
|
||||
|
||||
@ -28,10 +28,10 @@ package com.sun.tools.example.debug.gui;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
public class TypeScript extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = -983704841363534885L;
|
||||
private JTextArea history;
|
||||
private JTextField entry;
|
||||
|
||||
@ -41,7 +41,6 @@ public class TypeScript extends JPanel {
|
||||
private JScrollBar historyHScrollBar;
|
||||
|
||||
private boolean echoInput = false;
|
||||
private boolean nlPending = false;
|
||||
|
||||
private static String newline = System.getProperty("line.separator");
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.tools.example.debug.gui;
|
||||
|
||||
import javax.swing.*;
|
||||
import com.sun.tools.example.debug.bdi.OutputListener;
|
||||
|
||||
public class TypeScriptOutputListener implements OutputListener {
|
||||
@ -42,10 +41,12 @@ public class TypeScriptOutputListener implements OutputListener {
|
||||
this.appendNewline = appendNewline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putString(String s) {
|
||||
script.append(s);
|
||||
if (appendNewline)
|
||||
if (appendNewline) {
|
||||
script.newline();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -35,14 +35,17 @@ public class TypeScriptWriter extends Writer {
|
||||
this.script = script;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char[] cbuf, int off, int len) throws IOException {
|
||||
script.append(String.valueOf(cbuf, off, len));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
script.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
script.flush();
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ class AccessWatchpointSpec extends WatchpointSpec {
|
||||
/**
|
||||
* The 'refType' is known to match, return the EventRequest.
|
||||
*/
|
||||
@Override
|
||||
EventRequest resolveEventRequest(ReferenceType refType)
|
||||
throws NoSuchFieldException {
|
||||
Field field = refType.fieldByName(fieldId);
|
||||
@ -48,6 +49,7 @@ class AccessWatchpointSpec extends WatchpointSpec {
|
||||
return wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MessageOutput.format("watch accesses of",
|
||||
new Object [] {refSpec.toString(),
|
||||
|
||||
@ -27,6 +27,8 @@ package com.sun.tools.example.debug.tty;
|
||||
|
||||
public class AmbiguousMethodException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = -5372629264936918654L;
|
||||
|
||||
public AmbiguousMethodException()
|
||||
{
|
||||
super();
|
||||
|
||||
@ -30,7 +30,6 @@ import com.sun.jdi.request.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
class BreakpointSpec extends EventRequestSpec {
|
||||
String methodId;
|
||||
@ -58,6 +57,7 @@ class BreakpointSpec extends EventRequestSpec {
|
||||
/**
|
||||
* The 'refType' is known to match, return the EventRequest.
|
||||
*/
|
||||
@Override
|
||||
EventRequest resolveEventRequest(ReferenceType refType)
|
||||
throws AmbiguousMethodException,
|
||||
AbsentInformationException,
|
||||
@ -91,12 +91,14 @@ class BreakpointSpec extends EventRequestSpec {
|
||||
return (methodId != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return refSpec.hashCode() + lineNumber +
|
||||
((methodId != null) ? methodId.hashCode() : 0) +
|
||||
((methodArgs != null) ? methodArgs.hashCode() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof BreakpointSpec) {
|
||||
BreakpointSpec breakpoint = (BreakpointSpec)obj;
|
||||
@ -114,6 +116,7 @@ class BreakpointSpec extends EventRequestSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
String errorMessageFor(Exception e) {
|
||||
if (e instanceof AmbiguousMethodException) {
|
||||
return (MessageOutput.format("Method is overloaded; specify arguments",
|
||||
@ -140,6 +143,7 @@ class BreakpointSpec extends EventRequestSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer(refSpec.toString());
|
||||
if (isMethodBreakpoint()) {
|
||||
|
||||
@ -51,6 +51,7 @@ class Commands {
|
||||
final ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
|
||||
final int stackFrame = threadInfo == null? 0 : threadInfo.getCurrentFrameIndex();
|
||||
Thread thread = new Thread("asynchronous jdb command") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
action();
|
||||
@ -95,6 +96,7 @@ class Commands {
|
||||
final ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
|
||||
if ((threadInfo != null) && (threadInfo.getCurrentFrame() != null)) {
|
||||
frameGetter = new ExpressionParser.GetFrame() {
|
||||
@Override
|
||||
public StackFrame get() throws IncompatibleThreadStateException {
|
||||
return threadInfo.getCurrentFrame();
|
||||
}
|
||||
@ -224,7 +226,6 @@ class Commands {
|
||||
}
|
||||
|
||||
void commandClass(StringTokenizer t) {
|
||||
List<ReferenceType> list = Env.vm().allClasses();
|
||||
|
||||
if (!t.hasMoreTokens()) {
|
||||
MessageOutput.println("No class specified.");
|
||||
@ -709,6 +710,7 @@ class Commands {
|
||||
void doKillThread(final ThreadReference threadToKill,
|
||||
final StringTokenizer tokenizer) {
|
||||
new AsyncExecution() {
|
||||
@Override
|
||||
void action() {
|
||||
doKill(threadToKill, tokenizer);
|
||||
}
|
||||
@ -1118,7 +1120,6 @@ class Commands {
|
||||
}
|
||||
|
||||
void commandStop(StringTokenizer t) {
|
||||
Location bploc;
|
||||
String atIn;
|
||||
byte suspendPolicy = EventRequest.SUSPEND_ALL;
|
||||
|
||||
@ -1665,6 +1666,7 @@ class Commands {
|
||||
|
||||
void commandPrint(final StringTokenizer t, final boolean dumpObject) {
|
||||
new AsyncExecution() {
|
||||
@Override
|
||||
void action() {
|
||||
doPrint(t, dumpObject);
|
||||
}
|
||||
@ -1734,6 +1736,7 @@ class Commands {
|
||||
|
||||
void commandLock(final StringTokenizer t) {
|
||||
new AsyncExecution() {
|
||||
@Override
|
||||
void action() {
|
||||
doLock(t);
|
||||
}
|
||||
@ -1809,6 +1812,7 @@ class Commands {
|
||||
|
||||
void commandDisableGC(final StringTokenizer t) {
|
||||
new AsyncExecution() {
|
||||
@Override
|
||||
void action() {
|
||||
doDisableGC(t);
|
||||
}
|
||||
@ -1837,6 +1841,7 @@ class Commands {
|
||||
|
||||
void commandEnableGC(final StringTokenizer t) {
|
||||
new AsyncExecution() {
|
||||
@Override
|
||||
void action() {
|
||||
doEnableGC(t);
|
||||
}
|
||||
@ -1892,6 +1897,7 @@ class Commands {
|
||||
}
|
||||
} else {
|
||||
new AsyncExecution() {
|
||||
@Override
|
||||
void action() {
|
||||
doSave(t);
|
||||
}
|
||||
|
||||
@ -29,7 +29,6 @@ import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.StepRequest;
|
||||
import com.sun.jdi.request.MethodEntryRequest;
|
||||
import com.sun.jdi.request.MethodExitRequest;
|
||||
import com.sun.tools.jdi.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
|
||||
@ -27,14 +27,8 @@ package com.sun.tools.example.debug.tty;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
import com.sun.jdi.request.EventRequestManager;
|
||||
import com.sun.jdi.request.EventRequest;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class EventHandler implements Runnable {
|
||||
|
||||
EventNotifier notifier;
|
||||
@ -59,6 +53,7 @@ public class EventHandler implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
EventQueue queue = Env.vm().eventQueue();
|
||||
while (connected) {
|
||||
|
||||
@ -30,9 +30,7 @@ import com.sun.jdi.request.EventRequest;
|
||||
import com.sun.jdi.request.ExceptionRequest;
|
||||
import com.sun.jdi.request.ClassPrepareRequest;
|
||||
import com.sun.jdi.event.ClassPrepareEvent;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
abstract class EventRequestSpec {
|
||||
|
||||
|
||||
@ -25,15 +25,12 @@
|
||||
|
||||
package com.sun.tools.example.debug.tty;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.request.EventRequest;
|
||||
import com.sun.jdi.event.ClassPrepareEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
class EventRequestSpecList {
|
||||
|
||||
|
||||
@ -28,10 +28,6 @@ package com.sun.tools.example.debug.tty;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.sun.jdi.request.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
class ExceptionSpec extends EventRequestSpec {
|
||||
private boolean notifyCaught;
|
||||
private boolean notifyUncaught;
|
||||
@ -51,6 +47,7 @@ class ExceptionSpec extends EventRequestSpec {
|
||||
/**
|
||||
* The 'refType' is known to match, return the EventRequest.
|
||||
*/
|
||||
@Override
|
||||
EventRequest resolveEventRequest(ReferenceType refType) {
|
||||
EventRequestManager em = refType.virtualMachine().eventRequestManager();
|
||||
ExceptionRequest excReq = em.createExceptionRequest(refType,
|
||||
@ -68,6 +65,7 @@ class ExceptionSpec extends EventRequestSpec {
|
||||
return notifyUncaught;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
//Reference: Effective Java[tm] (Bloch, 2001), Item 8
|
||||
int result = 17;
|
||||
@ -77,6 +75,7 @@ class ExceptionSpec extends EventRequestSpec {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ExceptionSpec) {
|
||||
ExceptionSpec es = (ExceptionSpec)obj;
|
||||
@ -90,6 +89,7 @@ class ExceptionSpec extends EventRequestSpec {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s;
|
||||
if (notifyCaught && !notifyUncaught) {
|
||||
|
||||
@ -27,6 +27,8 @@ package com.sun.tools.example.debug.tty;
|
||||
|
||||
public class LineNotFoundException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 3748297722519448995L;
|
||||
|
||||
public LineNotFoundException()
|
||||
{
|
||||
super();
|
||||
|
||||
@ -26,6 +26,8 @@
|
||||
package com.sun.tools.example.debug.tty;
|
||||
|
||||
class MalformedMemberNameException extends Exception {
|
||||
private static final long serialVersionUID = 7759071468833196630L;
|
||||
|
||||
public MalformedMemberNameException() {
|
||||
super();
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ class ModificationWatchpointSpec extends WatchpointSpec {
|
||||
/**
|
||||
* The 'refType' is known to match, return the EventRequest.
|
||||
*/
|
||||
@Override
|
||||
EventRequest resolveEventRequest(ReferenceType refType)
|
||||
throws NoSuchFieldException {
|
||||
Field field = refType.fieldByName(fieldId);
|
||||
@ -48,6 +49,7 @@ class ModificationWatchpointSpec extends WatchpointSpec {
|
||||
return wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MessageOutput.format("watch modification of",
|
||||
new Object [] {refSpec.toString(),
|
||||
|
||||
@ -55,6 +55,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
/**
|
||||
* Does the specified ReferenceType match this spec.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(ReferenceType refType) {
|
||||
if (classId.startsWith("*")) {
|
||||
return refType.name().endsWith(stem);
|
||||
@ -65,6 +66,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassPrepareRequest createPrepareRequest() {
|
||||
ClassPrepareRequest request =
|
||||
Env.vm().eventRequestManager().createClassPrepareRequest();
|
||||
@ -73,10 +75,12 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return classId.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof PatternReferenceTypeSpec) {
|
||||
PatternReferenceTypeSpec spec = (PatternReferenceTypeSpec)obj;
|
||||
@ -125,6 +129,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return classId;
|
||||
}
|
||||
|
||||
@ -35,7 +35,9 @@ interface ReferenceTypeSpec {
|
||||
boolean matches(ReferenceType refType);
|
||||
ClassPrepareRequest createPrepareRequest();
|
||||
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
@Override
|
||||
boolean equals(Object obj);
|
||||
}
|
||||
|
||||
@ -27,11 +27,8 @@ package com.sun.tools.example.debug.tty;
|
||||
|
||||
import com.sun.jdi.Location;
|
||||
import com.sun.jdi.AbsentInformationException;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.StringTokenizer;
|
||||
import java.io.*;
|
||||
|
||||
|
||||
@ -47,34 +47,43 @@ public class TTY implements EventNotifier {
|
||||
*/
|
||||
private static final String progname = "jdb";
|
||||
|
||||
@Override
|
||||
public void vmStartEvent(VMStartEvent se) {
|
||||
Thread.yield(); // fetch output
|
||||
MessageOutput.lnprint("VM Started:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDeathEvent(VMDeathEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmDisconnectEvent(VMDisconnectEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadStartEvent(ThreadStartEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadDeathEvent(ThreadDeathEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classPrepareEvent(ClassPrepareEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void classUnloadEvent(ClassUnloadEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointEvent(BreakpointEvent be) {
|
||||
Thread.yield(); // fetch output
|
||||
MessageOutput.lnprint("Breakpoint hit:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fieldWatchEvent(WatchpointEvent fwe) {
|
||||
Field field = fwe.field();
|
||||
ObjectReference obj = fwe.object();
|
||||
@ -90,11 +99,13 @@ public class TTY implements EventNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stepEvent(StepEvent se) {
|
||||
Thread.yield(); // fetch output
|
||||
MessageOutput.lnprint("Step completed:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionEvent(ExceptionEvent ee) {
|
||||
Thread.yield(); // fetch output
|
||||
Location catchLocation = ee.catchLocation();
|
||||
@ -108,6 +119,7 @@ public class TTY implements EventNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void methodEntryEvent(MethodEntryEvent me) {
|
||||
Thread.yield(); // fetch output
|
||||
/*
|
||||
@ -125,6 +137,7 @@ public class TTY implements EventNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean methodExitEvent(MethodExitEvent me) {
|
||||
Thread.yield(); // fetch output
|
||||
/*
|
||||
@ -173,6 +186,7 @@ public class TTY implements EventNotifier {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vmInterrupted() {
|
||||
Thread.yield(); // fetch output
|
||||
printCurrentLocation();
|
||||
@ -184,6 +198,7 @@ public class TTY implements EventNotifier {
|
||||
MessageOutput.printPrompt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receivedEvent(Event event) {
|
||||
}
|
||||
|
||||
@ -317,18 +332,19 @@ public class TTY implements EventNotifier {
|
||||
// Adapted for use with String[][0].
|
||||
int low = 0;
|
||||
int high = commandList.length - 1;
|
||||
long i = 0;
|
||||
while (low <= high) {
|
||||
int mid = (low + high) >>> 1;
|
||||
String midVal = commandList[mid][0];
|
||||
int compare = midVal.compareTo(key);
|
||||
if (compare < 0)
|
||||
if (compare < 0) {
|
||||
low = mid + 1;
|
||||
else if (compare > 0)
|
||||
} else if (compare > 0) {
|
||||
high = mid - 1;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return mid; // key found
|
||||
}
|
||||
}
|
||||
return -(low + 1); // key not found.
|
||||
};
|
||||
|
||||
@ -336,7 +352,9 @@ public class TTY implements EventNotifier {
|
||||
* Return true if the command is OK when disconnected.
|
||||
*/
|
||||
private boolean isDisconnectCmd(int ii) {
|
||||
if (ii < 0 || ii >= commandList.length) return false;
|
||||
if (ii < 0 || ii >= commandList.length) {
|
||||
return false;
|
||||
}
|
||||
return (commandList[ii][1].equals("y"));
|
||||
}
|
||||
|
||||
@ -344,7 +362,9 @@ public class TTY implements EventNotifier {
|
||||
* Return true if the command is OK when readonly.
|
||||
*/
|
||||
private boolean isReadOnlyCmd(int ii) {
|
||||
if (ii < 0 || ii >= commandList.length) return false;
|
||||
if (ii < 0 || ii >= commandList.length) {
|
||||
return false;
|
||||
}
|
||||
return (commandList[ii][2].equals("y"));
|
||||
};
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ public class TTYResources extends java.util.ListResourceBundle {
|
||||
*
|
||||
* @return the contents of this <code>ResourceBundle</code>.
|
||||
*/
|
||||
@Override
|
||||
public Object[][] getContents() {
|
||||
Object[][] temp = new Object[][] {
|
||||
// NOTE: The value strings in this file containing "{0}" are
|
||||
|
||||
@ -44,6 +44,7 @@ public class TTYResources_ja extends java.util.ListResourceBundle {
|
||||
*
|
||||
* @return the contents of this <code>ResourceBundle</code>.
|
||||
*/
|
||||
@Override
|
||||
public Object[][] getContents() {
|
||||
Object[][] temp = new Object[][] {
|
||||
// NOTE: The value strings in this file containing "{0}" are
|
||||
|
||||
@ -44,6 +44,7 @@ public class TTYResources_zh_CN extends java.util.ListResourceBundle {
|
||||
*
|
||||
* @return the contents of this <code>ResourceBundle</code>.
|
||||
*/
|
||||
@Override
|
||||
public Object[][] getContents() {
|
||||
Object[][] temp = new Object[][] {
|
||||
// NOTE: The value strings in this file containing "{0}" are
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
package com.sun.tools.example.debug.tty;
|
||||
|
||||
import com.sun.jdi.ThreadGroupReference;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.ArrayList;
|
||||
@ -70,10 +69,12 @@ class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return !stack.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreadGroupReference next() {
|
||||
return nextThreadGroup();
|
||||
}
|
||||
@ -84,6 +85,7 @@ class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
|
||||
return tg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@ -32,8 +32,6 @@ import com.sun.jdi.StackFrame;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.io.*;
|
||||
|
||||
class ThreadInfo {
|
||||
// This is a list of all known ThreadInfo objects. It survives
|
||||
|
||||
@ -46,6 +46,7 @@ class ThreadIterator implements Iterator<ThreadReference> {
|
||||
tgi = new ThreadGroupIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
while (it == null || !it.hasNext()) {
|
||||
if (!tgi.hasNext()) {
|
||||
@ -56,6 +57,7 @@ class ThreadIterator implements Iterator<ThreadReference> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreadReference next() {
|
||||
return it.next();
|
||||
}
|
||||
@ -64,6 +66,7 @@ class ThreadIterator implements Iterator<ThreadReference> {
|
||||
return next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user