You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ivan Popov (JIRA)" <ji...@apache.org> on 2007/07/04 14:41:05 UTC

[jira] Updated: (HARMONY-2892) [jdktools][jdwp] Support on-demand debugger attach in JDWP agent

     [ https://issues.apache.org/jira/browse/HARMONY-2892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Popov updated HARMONY-2892:
--------------------------------

    Attachment: H2892_jdwp_agent.patch

Agent options used for launching debugger on demand are described here:
http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html#Invocation

Attached patch 'H2892_jdwp_agent.patch' adds this functionality to JDWP agent. It should be applied after HARMONY-4324, otherwise it will warn about shifted hunks.

To use this functionality one needs Java debugger that can connect to a Java application from command line. For example, JDB from RI JDK, which uses the following syntax to connect to debugged application via specific TCP/IP port:

  $JDK/bin/jdb -connect com.sun.jdi.SocketAttach:port=<number>

Simple batch file is required to invoke JDB with correct arguments:

---- run.sh ---
#!/bin/sh
# $1 - transport name (will be dt_socket)
# $2 - transport address (TCP/IP port number)

$JDK=<path-to-jdk-with-jdb>

echo "attach debugger: transport=$1, address=$2"
$JDK/bin/jdb -connect com.sun.jdi.SocketAttach:port=$2
------------------

Now, use the following command line to start any application that throws exception :

$HY_JDK/bin/java -cp . -agentlib:jdwp=transport=dt_socket,server=y,launch=run.sh <application>

Once exception is thrown, JDWP agent launches debugger using specified script and providing connection address, and allows user to debug application.One can also specify particular kind of application, e.g, to catch only java.lang.RuntimeException :

$HY_JDK/bin/java -cp . -agentlib:jdwp=transport=dt_socket,server=y,onthrow=java.lang.RuntimeException,launch=run.sh <application>

Patched JDWP agent works fine on top of Sun JVM, but DRLVM crashes with assertion in JNI function NewStringUTF() invoked from Exception callback, when agent performs deferred initialization. I submitted this problem to HARMONY-4338.


> [jdktools][jdwp] Support on-demand debugger attach in JDWP agent
> ----------------------------------------------------------------
>
>                 Key: HARMONY-2892
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2892
>             Project: Harmony
>          Issue Type: Improvement
>          Components: JDK
>            Reporter: Ivan Popov
>            Priority: Minor
>         Attachments: H2892_jdwp_agent.patch
>
>
> JDWP agent implementation in RI provides user with an ability to launch debugger on-demand when exception is thrown in an application. Though this is not required by JDWP spec, but this feature is very useful and worth to be implemented in Harmony's JDWP agent.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.