plugin invoke debug attach

I need the plugin to call
Debugger = JPDA
Connector = Socket Attach
Transport = dt_socket
Host = localhost
Port = 5005
Timeout = 5000

The goal is to perform some processing and then call "Debug Attach"
automatically and have it open the developer's debug session.

I would like to point out that everything works manually using "Debug
Attach".

It is possible to add this type of resource to the plugin, I would
appreciate if you could help me.

I tried this way but without any success

Does not work

How to solve?

public void attachDebug() {

             for (AttachingConnector ac :
Bootstrap.virtualMachineManager().attachingConnectors()) {
                   if ("com.sun.jdi.SocketAttach".equals(ac.name())) {
                       System.out.println("conector-> "  + ac.name() );
                       connector = ac;
                       break;
                   }
               }

               if (connector == null) {
                   System.err.println("JPDA SocketAttach connector not found.");
                   return;
               }


               Map<String, Connector.Argument> args =
connector.defaultArguments();
               args.get    ("hostname").setValue("localhost");
               args.get("port").setValue(5005;
               args.get("timeout").setValue("10000");

               AttachingDICookie cookie =
AttachingDICookie.create(connector, args);

               DebuggerInfo info = DebuggerInfo.create(
                  "JPDA_ATTACH",
                  new Object[]{cookie}
              );


              DebuggerEngine[] engines =
DebuggerManager.getDebuggerManager().startDebugging(info);
              System.out.println("Engines: " + engines.length);
}

Reply via email to