/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
/**
* Move this towards being only state and functionality
* that spans across Sessions (and thus VMs).
*/
public class ExecutionManager {
/**
*/
////////////////// Listener registration //////////////////
// Session Listeners
}
}
// Spec Listeners
}
}
// JDI Listeners
/**
* Adds a JDIListener
*/
}
/**
* Adds a JDIListener - at the specified position
*/
}
/**
* Removes a JDIListener
*/
}
// App Echo Listeners
appEchoListeners.add(l);
}
}
// App Output Listeners
}
}
// App Error Listeners
appErrorListeners.add(l);
}
}
// Diagnostic Listeners
}
}
/////////// End Listener Registration //////////////
//### We probably don't want this public
}
throw new NoSessionException();
}
}
}
/**
* Get JDI trace mode.
*/
return traceMode;
}
/**
* Set JDI trace mode.
*/
}
}
/**
* Determine if VM is interrupted, i.e, present and not running.
*/
// ensureActiveSession();
return session.interrupted;
}
/**
* Return a list of ReferenceType objects for all
* currently loaded classes and interfaces.
* Array types are not returned.
*/
return vm().allClasses();
}
/**
* Return a ReferenceType object for the currently
* loaded class or interface whose fully-qualified
* class name is specified, else return null if there
* is none.
*
* In general, we must return a list of types, because
* multiple class loaders could have loaded a class
* with the same fully-qualified name.
*/
}
/**
* Return a list of ReferenceType objects for all
* currently loaded classes and interfaces whose name
* matches the given pattern. The pattern syntax is
* open to some future revision, but currently consists
* of a fully-qualified class name in which the first
* component may optionally be a "*" character, designating
* an arbitrary prefix.
*/
throws NoSessionException {
// Wildcard matches any leading package name.
}
}
return result;
} else {
// It's a class name.
}
}
/*
* Return a list of ThreadReference objects corresponding
* to the threads that are currently active in the VM.
* A thread is removed from the list just before the
* thread terminates.
*/
return vm().allThreads();
}
/*
* Return a list of ThreadGroupReference objects corresponding
* to the top-level threadgroups that are currently active in the VM.
* Note that a thread group may be empty, or contain no threads as
* descendents.
*/
return vm().topLevelThreadGroups();
}
/*
* Return the system threadgroup.
*/
throws NoSessionException {
}
/*
* Evaluate an expression.
*/
throws ParseException,
if (f != null) {
return f;
}
};
}
}
/*
* Start a new VM.
*/
endSession();
//### Set a breakpoint on 'main' method.
//### Would be cleaner if we could just bring up VM already suspended.
if (suspended) {
//### Set breakpoint at 'main(java.lang.String[])'.
}
diagnostics));
}
/*
* Attach to an existing VM.
*/
endSession();
//### Changes made here for connectors have broken the
//### the 'Session' abstraction. The 'Session.attach()'
//### method is intended to encapsulate all of the various
//### ways in which session start-up can fail. (maddox 12/18/98)
/*
* Now that attaches and launches both go through Connectors,
* it may be worth creating a new subclass of Session for
* attach sessions.
*/
if (newSession != null) {
}
}
try {
} catch (IOException ioe) {
ioe.getMessage());
} catch (IllegalConnectorArgumentsException icae) {
icae.getMessage());
}
return null;
}
try {
} catch (IOException ioe) {
"\n Unable to accept connection to target VM: " +
ioe.getMessage());
} catch (IllegalConnectorArgumentsException icae) {
icae.getMessage());
}
return null;
}
/*
* Connect via user specified arguments
* @return true on success
*/
throws VMLaunchFailureException {
endSession();
if (connector instanceof LaunchingConnector) {
// we were launched, use ChildSession
} else if (connector instanceof AttachingConnector) {
} else if (connector instanceof ListeningConnector) {
} else {
}
if (newSession != null) {
}
return newSession != null;
}
/*
* Detach from VM. If VM was started by debugger, terminate it.
*/
endSession();
}
if (!s.attach()) {
throw new VMLaunchFailureException();
}
session = s;
//### We must allow the deferred breakpoints to be resolved before
//### we continue executing the class. We could optimize if there
//### were no deferred breakpoints outstanding for a particular class.
//### Can we do this with JDI?
session.interrupted = true;
}
void endSession() {
}
}
/*
* Suspend all VM activity.
*/
//### Is it guaranteed that the interrupt has happened?
session.interrupted = true;
}
/*
* Resume interrupted VM.
*/
session.interrupted = false;
}
/*
* Stepping.
*/
/*
* A previous step may not have completed on this thread;
* if so, it gets removed here.
*/
break;
}
}
}
throws NoSessionException {
session.interrupted = false;
// We want just the next step event and no others
}
throws NoSessionException {
}
throws NoSessionException {
}
throws NoSessionException,
}
throws NoSessionException,
}
throws NoSessionException {
}
/*
* Thread control.
*/
}
}
//### Need an exception now. Which one to use?
//thread.stop();
}
/*
* ThreadInfo objects -- Allow query of thread status and stack.
*/
//### Should be weak! (in the value, not the key)
private HashMap<ThreadReference, ThreadInfo> threadInfoMap = new HashMap<ThreadReference, ThreadInfo>();
return null;
}
//### Should not hardcode initial frame count and prefetch here!
//info = new ThreadInfo(thread, 10, 10);
if (session.interrupted) {
}
}
return info;
}
void validateThreadInfo() {
session.interrupted = true;
}
}
private void invalidateThreadInfo() {
session.interrupted = false;
}
}
}
info.invalidate();
}
}
/*
* Listen for Session control events.
*/
private void notifyInterrupted() {
for (int i = 0; i < l.size(); i++) {
}
}
private void notifyContinued() {
for (int i = 0; i < l.size(); i++) {
}
}
private void notifySessionStart() {
for (int i = 0; i < l.size(); i++) {
}
}
private void notifySessionDeath() {
/*** noop for now
ArrayList<SessionListener> l = new ArrayList<SessionListener>(sessionListeners);
EventObject evt = new EventObject(this);
for (int i = 0; i < l.size(); i++) {
((SessionListener)l.get(i)).sessionDeath(evt);
}
****/
}
/*
* Listen for input and output requests from the application
* being debugged. These are generated only when the debuggee
* is spawned as a child of the debugger.
*/
private void resetInputBuffer() {
synchronized (inputLock) {
}
}
synchronized (inputLock) {
}
}
// Don't allow reader to be interrupted -- catch and retry.
synchronized (inputLock) {
try {
}
} catch (InterruptedException e) {}
}
}
// We must not be holding inputLock here, as the listener
// that we call to echo a line might call us re-entrantly
// to provide another line of input.
// Run in Swing event dispatcher thread.
public void run() {
}
});
return line;
}
};
for (int i = 0; i < l.size(); i++) {
}
}
for (int i = 0; i < l.size(); i++) {
}
}
};
for (int i = 0; i < l.size(); i++) {
}
}
};
for (int i = 0; i < l.size(); i++) {
}
}
};
public BreakpointSpec
}
public BreakpointSpec
}
public BreakpointSpec
}
public ExceptionSpec
boolean notifyCaught,
boolean notifyUncaught) {
}
public AccessWatchpointSpec
}
public ModificationWatchpointSpec
fieldId);
}
}
}
}
return specList.eventRequestSpecs();
}
}