in core/src/main/java/com/jetbrains/sa/SaJdwpAttachingServer.java [30:63]
public static void main(String[] args) throws Exception {
// By default SA agent classes prefer Windows process debugger
// to windbg debugger. SA expects special properties to be set
// to choose other debuggers. We will set those here before
// attaching to SA agent.
System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true");
final VirtualMachineImpl vm = SaJdwpUtils.createVirtualMachine(args[0]);
String address = args[1];
System.out.println(SERVER_READY);
System.out.println("Connecting to " + address);
final SocketTransportService socketTransportService = new SocketTransportService();
final Connection connection = socketTransportService.attach(address, 0, 0);
System.out.println("Connected to " + address);
// shutdown hook to clean-up the server in case of forced exit.
Runtime.getRuntime().addShutdownHook(new Thread(
new Runnable() {
public void run() {
try {
vm.dispose();
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}));
JDWPProxy.reply(connection, vm);
}