com.sun.jdi.connect.spi.Connection Java Examples

The following examples show how to use com.sun.jdi.connect.spi.Connection. 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: SimpleLaunchingConnector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #2
Source File: SimpleLaunchingConnector.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #3
Source File: SimpleLaunchingConnector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #4
Source File: TargetVM.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #5
Source File: TargetVM.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #6
Source File: TargetVM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #7
Source File: SimpleLaunchingConnector.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #8
Source File: TargetVM.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #9
Source File: SimpleLaunchingConnector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #10
Source File: TargetVM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #11
Source File: SimpleLaunchingConnector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #12
Source File: TargetVM.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #13
Source File: SimpleLaunchingConnector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #14
Source File: TargetVM.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #15
Source File: TargetVM.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #16
Source File: TargetVM.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #17
Source File: SimpleLaunchingConnector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #18
Source File: TargetVM.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #19
Source File: SimpleLaunchingConnector.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #20
Source File: TargetVM.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #21
Source File: SimpleLaunchingConnector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #22
Source File: TargetVM.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #23
Source File: SimpleLaunchingConnector.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #24
Source File: TargetVM.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
TargetVM(VirtualMachineImpl vm, Connection connection) {
    this.vm = vm;
    this.connection = connection;
    this.readerThread = new Thread(vm.threadGroupForJDI(),
                                   this, "JDI Target VM Interface");
    this.readerThread.setDaemon(true);
}
 
Example #25
Source File: SimpleLaunchingConnector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #26
Source File: SimpleLaunchingConnector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #27
Source File: VirtualMachineImpl.java    From openjdk-8-source 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 #28
Source File: VirtualMachineImpl.java    From hottub 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 #29
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 #30
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();
}