Java Code Examples for com.sun.jdi.request.EventRequest#enable()

The following examples show how to use com.sun.jdi.request.EventRequest#enable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModificationWatchpointSpec.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The 'refType' is known to match, return the EventRequest.
 */
@Override
EventRequest resolveEventRequest(ReferenceType refType)
                                  throws NoSuchFieldException {
    Field field = refType.fieldByName(fieldId);
    EventRequestManager em = refType.virtualMachine().eventRequestManager();
    EventRequest wp = em.createModificationWatchpointRequest(field);
    wp.setSuspendPolicy(suspendPolicy);
    wp.enable();
    return wp;
}
 
Example 2
Source File: ModificationWatchpointSpec.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The 'refType' is known to match, return the EventRequest.
 */
@Override
EventRequest resolveEventRequest(ReferenceType refType)
                                  throws NoSuchFieldException {
    Field field = refType.fieldByName(fieldId);
    EventRequestManager em = refType.virtualMachine().eventRequestManager();
    EventRequest wp = em.createModificationWatchpointRequest(field);
    wp.setSuspendPolicy(suspendPolicy);
    wp.enable();
    return wp;
}
 
Example 3
Source File: ModificationWatchpointSpec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The 'refType' is known to match, return the EventRequest.
 */
@Override
EventRequest resolveEventRequest(ReferenceType refType)
                                  throws NoSuchFieldException {
    Field field = refType.fieldByName(fieldId);
    EventRequestManager em = refType.virtualMachine().eventRequestManager();
    EventRequest wp = em.createModificationWatchpointRequest(field);
    wp.setSuspendPolicy(suspendPolicy);
    wp.enable();
    return wp;
}
 
Example 4
Source File: ModificationWatchpointSpec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The 'refType' is known to match, return the EventRequest.
 */
@Override
EventRequest resolveEventRequest(ReferenceType refType)
                                  throws NoSuchFieldException {
    Field field = refType.fieldByName(fieldId);
    EventRequestManager em = refType.virtualMachine().eventRequestManager();
    EventRequest wp = em.createModificationWatchpointRequest(field);
    wp.setSuspendPolicy(suspendPolicy);
    wp.enable();
    return wp;
}
 
Example 5
Source File: ModificationWatchpointSpec.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The 'refType' is known to match, return the EventRequest.
 */
@Override
EventRequest resolveEventRequest(ReferenceType refType)
                                  throws NoSuchFieldException {
    Field field = refType.fieldByName(fieldId);
    EventRequestManager em = refType.virtualMachine().eventRequestManager();
    EventRequest wp = em.createModificationWatchpointRequest(field);
    wp.setSuspendPolicy(suspendPolicy);
    wp.enable();
    return wp;
}
 
Example 6
Source File: ModificationWatchpointSpec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The 'refType' is known to match, return the EventRequest.
 */
@Override
EventRequest resolveEventRequest(ReferenceType refType)
                                  throws NoSuchFieldException {
    Field field = refType.fieldByName(fieldId);
    EventRequestManager em = refType.virtualMachine().eventRequestManager();
    EventRequest wp = em.createModificationWatchpointRequest(field);
    wp.setSuspendPolicy(suspendPolicy);
    wp.enable();
    return wp;
}
 
Example 7
Source File: ModificationWatchpointSpec.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The 'refType' is known to match, return the EventRequest.
 */
@Override
EventRequest resolveEventRequest(ReferenceType refType)
                                  throws NoSuchFieldException {
    Field field = refType.fieldByName(fieldId);
    EventRequestManager em = refType.virtualMachine().eventRequestManager();
    EventRequest wp = em.createModificationWatchpointRequest(field);
    wp.setSuspendPolicy(suspendPolicy);
    wp.enable();
    return wp;
}
 
Example 8
Source File: VirtualMachineImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 9
Source File: VirtualMachineImpl.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 10
Source File: VirtualMachineImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 11
Source File: VirtualMachineImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 12
Source File: EventRequestSpec.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
void setRequest(EventRequest request) {
    this.request = request;
    request.putProperty(specPropertyKey, this);
    request.enable();
}
 
Example 13
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 14
Source File: EventRequestSpec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void setRequest(EventRequest request) {
    this.request = request;
    request.putProperty(specPropertyKey, this);
    request.enable();
}
 
Example 15
Source File: VirtualMachineImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 16
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 17
Source File: VirtualMachineImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;
    sizeofModuleRef = idSizes.objectIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}
 
Example 18
Source File: EventRequestSpec.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
void setRequest(EventRequest request) {
    this.request = request;
    request.putProperty(specPropertyKey, this);
    request.enable();
}
 
Example 19
Source File: EventRequestSpec.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void setRequest(EventRequest request) {
    this.request = request;
    request.putProperty(specPropertyKey, this);
    request.enable();
}
 
Example 20
Source File: VirtualMachineImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
VirtualMachineImpl(VirtualMachineManager manager,
                   Connection connection, Process process,
                   int sequenceNumber) {
    super(null);  // Can't use super(this)
    vm = this;

    this.vmManager = (VirtualMachineManagerImpl)manager;
    this.process = process;
    this.sequenceNumber = sequenceNumber;

    /* Create ThreadGroup to be used by all threads servicing
     * this VM.
     */
    threadGroupForJDI = new ThreadGroup(vmManager.mainGroupForJDI(),
                                        "JDI [" +
                                        this.hashCode() + "]");

    /*
     * Set up a thread to communicate with the target VM over
     * the specified transport.
     */
    target = new TargetVM(this, connection);

    /*
     * Set up a thread to handle events processed internally
     * the JDI implementation.
     */
    EventQueueImpl internalEventQueue = new EventQueueImpl(this, target);
    new InternalEventHandler(this, internalEventQueue);
    /*
     * Initialize client access to event setting and handling
     */
    eventQueue = new EventQueueImpl(this, target);
    eventRequestManager = new EventRequestManagerImpl(this);

    target.start();

    /*
     * Many ids are variably sized, depending on target VM.
     * Find out the sizes right away.
     */
    JDWP.VirtualMachine.IDSizes idSizes;
    try {
        idSizes = JDWP.VirtualMachine.IDSizes.process(vm);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
    sizeofFieldRef  = idSizes.fieldIDSize;
    sizeofMethodRef = idSizes.methodIDSize;
    sizeofObjectRef = idSizes.objectIDSize;
    sizeofClassRef = idSizes.referenceTypeIDSize;
    sizeofFrameRef  = idSizes.frameIDSize;

    /**
     * Set up requests needed by internal event handler.
     * Make sure they are distinguished by creating them with
     * an internal event request manager.
     *
     * Warning: create events only with SUSPEND_NONE policy.
     * In the current implementation other policies will not
     * be handled correctly when the event comes in. (notfiySuspend()
     * will not be properly called, and if the event is combined
     * with external events in the same set, suspend policy is not
     * correctly determined for the internal vs. external event sets)
     */
    internalEventRequestManager = new EventRequestManagerImpl(this);
    EventRequest er = internalEventRequestManager.createClassPrepareRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();
    er = internalEventRequestManager.createClassUnloadRequest();
    er.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    er.enable();

    /*
     * Tell other threads, notably TargetVM, that initialization
     * is complete.
     */
    notifyInitCompletion();
}