Attaching to a JVM Suspended on a Thrown Exception
The target JVM can be invoked and then later suspended when a particular Java exception
is thrown. The debugger can then attach to the suspended target JVM.
There are two ways to attach the debugger to the target JVM: via shared memory or a network socket.
Shared Memory
Shared memory has the fastest debugging performance if it is supported by your JVM platform.
The debugger and the target JVM must be executing on the same computer.
JDK 1.6
jdk1.6/bin/java
-agentlib:jdwp=transport=dt_shmem,server=y,address=javadebug,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe
test.Test args
JDK 1.5
jdk1.5/bin/java
-agentlib:jdwp=transport=dt_shmem,server=y,address=javadebug,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe
test.Test args
JDK 1.4
j2sdk1.4/bin/java -Xdebug
-Xrunjdwp:transport=dt_shmem,server=y,address=javadebug,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub
test.Test args
JDK 1.3
jdk1.3/bin/java -classic -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_shmem,server=y,address=javadebug,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub
test.Test args
Socket
A network socket can connect the debugger and the target JVM that can be running on the
same computer or different computers.
JDK 1.6
jdk1.6/bin/java
-agentlib:jdwp=transport=dt_socket,server=y,address=8000,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe
test.Test args
JDK 1.5
jdk1.5/bin/java
-agentlib:jdwp=transport=dt_socket,server=y,address=8000,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe
test.Test args
JDK 1.4
jdk1.4/bin/java -Xdebug
-Xrunjdwp:transport=dt_socket,server=y,address=8000,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub
test.Test args
JDK 1.3
jdk1.3/bin/java -classic -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,address=8000,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub
test.Test args
©2001-2010. debugtools.com LLC. All rights reserved.