Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Debugging custom scripts interpreted in Java


  the 'javaw.exe' binary is not a part of the command line that is used to launch the dltk script. dltk makes a call to the DebugPlugin.exec method and passes it the command line of the interpreter for the specific script being launched along with any other arguments it needs to run. in the case of jython, 'javaw.exe' is only being launched so the interpreter can start up.

  in order to accomplish this, i believe you would need a launcher that knew how to start up the jython interpreter using the '-agentlib' flag (this would also require that your java code was on the interpreter's classpath so it could be found when stepped into) and spawn the dltk process that listens for incoming debugging connections. however, dltk doesn't support jython at this point, so i don't believe this is possible.

  however, you may be able to accomplish this through 'remote' debugging.

  if you have a way to get the jython interpreter to 'speak' dbgp, then you could spawn a remote debugging process for java and a remote debugging process for the script and things should work, but don't hold me to that.

  on a separate note, when you tried to debug a python script using dltk, did you grab the latest version of the debugging engine from active state?

  i'll try testing out the debugger this weekend to see if it works for me.

On Fri, Sep 12, 2008 at 4:17 PM, Andrew Mickish <mickish@xxxxxxx> wrote:
Jae Gangemi wrote:
 i believe what johan is saying is that you need to fire off two debugging processes, one for the dltk script, and one for the java code you wish to intercept.
Couldn't the launched process simultaneously interact with Eclipse's "native" Java -agentlib:jdwp protocol AND the dbgp protocol?

I can stop at Java breakpoints when I run my python script from Eclipse directly with Jython (i.e., without the pydevd.py wrapper).  In this scenario, my Eclipse launcher produces a command line like this:

C:\Program Files\Java\jdk1.6.0_02\bin\javaw.exe
  -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:4088
  -Dfile.encoding=Cp1252
  -classpath C:\jython2.2.1\jython.jar org.python.util.jython src\example.py

However, when I run my python script from Eclipse using PyDev, there is no -agentlib:jdwp in the command line:

C:\Program Files\Java\jdk1.6.0_02\bin\javaw.exe
  -classpath "C:\jython2.2.1\jython.jar;...;C:\Program Files\Java\jdk1.6.0_02\jre\lib\ext\tools.jar"
  -Dpython.security.respectJavaAccessibility=false
  org.python.util.jython
  pydevd.py
  --vm_type jython --client localhost --port 3088 --file src\example.py

The -agentlib:jdwp is the link between the launched process and the Eclipse debugger, and should be activated on all launched Java processes.  The agent is built-in to every JVM, and Eclipse just activates it in the launched process, then connects to it.

Seems that any Java process implementing the dbgp protocol could be launched with the -agentlib:jdwp switch, and all debugging would be integrated.  No?

--Andy


_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



--
-jae

Back to the top