in core/src/main/java/com/jetbrains/sa/SaJdwpListeningServer.java [33:65]
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]);
final SocketTransportService socketTransportService = new SocketTransportService();
final TransportService.ListenKey listenKey = socketTransportService.startListening(args.length > 1 ? args[1] : null);
System.err.println(WAITING_FOR_DEBUGGER + listenKey.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();
socketTransportService.stopListening(listenKey);
} catch (IllegalArgumentException ignored) {
} catch (IOException e) {
e.printStackTrace();
}
}
}));
Connection connection = socketTransportService.accept(listenKey, 0, 0);
socketTransportService.stopListening(listenKey);
JDWPProxy.reply(connection, vm);
}