harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Popov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-2892) [jdktools][jdwp] Support on-demand debugger attach in JDWP agent
Date Wed, 04 Jul 2007 12:41:05 GMT

     [ 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.


Mime
View raw message