136 lines
8.7 KiB
HTML
136 lines
8.7 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Java Platform Debugger Architecture" />
|
||
|
<meta name="abstract" content="The Java Platform Debugger Architecture (JPDA) consists of the JVM Debug Interface/JVM Tool Interface, the Java Debug Wire Protocol, and the Java Debug Interface. All these parts of the JPDA enable any front end of a debugger that uses the JDWP to perform debugging operations. The debugger front end can either run remotely or run as an iSeries application." />
|
||
|
<meta name="description" content="The Java Platform Debugger Architecture (JPDA) consists of the JVM Debug Interface/JVM Tool Interface, the Java Debug Wire Protocol, and the Java Debug Interface. All these parts of the JPDA enable any front end of a debugger that uses the JDWP to perform debugging operations. The debugger front end can either run remotely or run as an iSeries application." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="debug.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzahafsdebug.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="jpdebuga" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Java Platform Debugger Architecture</title>
|
||
|
</head>
|
||
|
<body id="jpdebuga"><a name="jpdebuga"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Java Platform Debugger Architecture</h1>
|
||
|
<div><p>The Java™ Platform Debugger Architecture (JPDA) consists
|
||
|
of the JVM Debug Interface/JVM Tool Interface, the Java Debug Wire Protocol, and the Java Debug
|
||
|
Interface. All these parts of the JPDA enable any front end of a debugger
|
||
|
that uses the JDWP to perform debugging operations. The debugger front end
|
||
|
can either run remotely or run as an iSeries™ application.</p>
|
||
|
<div class="section"><img src="./delta.gif" alt="Start of change" /><h4 class="sectiontitle">Java Virtual Machine Tool Interface (JVMTI)</h4><p>JVMTI
|
||
|
is the superceder of JVMDI and the Java Virtual Machine Profiler Interface
|
||
|
(JVMPI). JVMTI contains all the functionality of both JVMDI and JVMPI, plus
|
||
|
new functions. JVMTI was added as part of J2SE 5.0. In future releases, the
|
||
|
JVMDI and JVMPI interfaces will no longer be offered, and JVMTI will be the
|
||
|
only option available.</p>
|
||
|
<p>A service program, called QJVAJVMTI, which resides
|
||
|
in the QSYS library, supports the JVMTI functions.</p>
|
||
|
<p>For more information
|
||
|
about implementing JVMTI, see the <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/index.html" target="_blank">JVMTI Reference page</a> at the Sun Microsystems, Inc.
|
||
|
Web site.</p>
|
||
|
<img src="./deltaend.gif" alt="End of change" /></div>
|
||
|
<div class="section"><h4 class="sectiontitle">Java Virtual Machine Debug Interface</h4><p>In Java 2
|
||
|
SDK (J2SDK), Standard Edition, version 1.2 or higher, the Java Virtual
|
||
|
Machine Debug Interface (JVMDI) is part of Sun Microsystems, Inc. platform
|
||
|
application program interfaces (APIs). JVMDI allows anyone to write a Java debugger
|
||
|
for an iSeries server
|
||
|
in iSeries C
|
||
|
code. The debugger does not need to know the internal structure of the Java virtual
|
||
|
machine since it uses JVMDI interfaces. JVMDI is the lowest-level interface
|
||
|
in JPDA that is closest to the Java virtual machine.</p>
|
||
|
<p>The debugger
|
||
|
runs in the same multi-thread capable job as the Java virtual machine. The debugger uses Java Native
|
||
|
Interface (JNI) Invocation APIs to create a Java virtual machine. It then places a hook
|
||
|
at the beginning of a user class main method and calls the main method. When
|
||
|
the main method begins, the hook is hit and debugging begins. Typical debug
|
||
|
facilities are available, such as setting breakpoints, stepping, displaying
|
||
|
variables, and changing variables.</p>
|
||
|
<p>The debugger handles communication
|
||
|
between the job where the Java virtual machine is running and a job
|
||
|
handling the user interface. This user interface is either on your iSeries server
|
||
|
or another system.</p>
|
||
|
<p>A service program, called QJVAJVMDI that resides
|
||
|
in the QSYS library, supports the JVMDI functions.</p>
|
||
|
</div>
|
||
|
<div class="section"><h4 class="sectiontitle">Java Debug Wire Protocol</h4><p>The Java Debug
|
||
|
Wire Protocol (JDWP) is a defined communication protocol between a debugger
|
||
|
process and the JVMDI/JVMTI. JDWP can be used from either a remote system
|
||
|
or over a local socket. It is one layer removed from the JVMDI/JVMTI, but
|
||
|
is a more complex interface.</p>
|
||
|
</div>
|
||
|
<div class="section"><h4 class="sectiontitle">Start JDWP in QShell</h4><p><img src="./delta.gif" alt="Start of change" />To start JDWP and
|
||
|
run the Java class SomeClass, enter the following command in
|
||
|
QShell:<img src="./deltaend.gif" alt="End of change" /></p>
|
||
|
<pre>java -interpret -agentlib:jdwp=transport=dt_socket,
|
||
|
address=8000,server=y,suspend=n SomeClass</pre>
|
||
|
<p>In this example, JDWP
|
||
|
listens for connections from remote debuggers on TCP/IP port 8000, but you
|
||
|
can use any port number you want; dt_socket is the name of the SRVPGM that
|
||
|
handles the JDWP transport and does not change.</p>
|
||
|
<p><img src="./delta.gif" alt="Start of change" />For additional
|
||
|
options that you can use with -Xrunjdwp, see <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html" target="_blank">Sun VM Invocation Options</a> by Sun Microsystems, Inc.
|
||
|
These options are available for both JDK 1.4 and 1.5 on i5/OS.<img src="./deltaend.gif" alt="End of change" /></p>
|
||
|
</div>
|
||
|
<div class="section"><img src="./delta.gif" alt="Start of change" /><h4 class="sectiontitle">Start JDWP from a CL command line</h4><p>To
|
||
|
start JDWP with the CL command, two new options have been added: AGTPGM and
|
||
|
AGTOPTIONS.</p>
|
||
|
<p>The value of AGTPGM is JDWP and the value of AGTOPTIONS
|
||
|
can be defined to be the same string that you would have used on the QShell
|
||
|
command line. </p>
|
||
|
<div class="p">To start JDWP and run the Java class SomeClass, enter
|
||
|
the following command: <pre>JAVA CLASS(SomeClass) INTERPRET(*YES) AGTPGM(JDWP)
|
||
|
AGTOPTIONS('transport=dt_socket,address=8000,server=y,suspend=n') </pre>
|
||
|
</div>
|
||
|
<p>Using
|
||
|
JVMDI/JVMTI is not recommended for Direct Execution code. You should run your
|
||
|
application with the interpreter, or use the Just-In_Time (JIT) Compiler with
|
||
|
full-speed debugging.</p>
|
||
|
<img src="./deltaend.gif" alt="End of change" /></div>
|
||
|
<div class="section"><h4 class="sectiontitle">Java Debug Interface</h4><p>Java Debug
|
||
|
Interface (JDI) is a high-level Java language interface provided for tool
|
||
|
development. JDI hides the complexity of JVMDI/JVMTI and JDWP behind some Java class
|
||
|
definitions. JDI is included in the rt.jar file, so the front end of the debugger
|
||
|
exists on any platform that has Java installed.</p>
|
||
|
<p>If you want to write
|
||
|
debuggers for Java, you should use JDI because it is the simplest
|
||
|
interface and your code is platform-independent.</p>
|
||
|
<p>For more information
|
||
|
on JDPA, see <a href="http://java.sun.com/j2se/1.3/docs/guide/jpda/architecture.html" target="_blank">Java Platform Debugger Architecture Overview</a> by
|
||
|
Sun Microsystems, Inc.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rzahafsdebug.htm">Full-Speed Debug</a></strong><br />
|
||
|
The iSeries Java Virtual
|
||
|
Machine (JVM) now supports "full-speed debugging". Prior to V5R3, enabling
|
||
|
debugging meant disabling the Just-In-Time (JIT) compiler. Application performance
|
||
|
suffered because many methods had to be run with the slow interpreter. This
|
||
|
significant performance degradation was especially difficult for applications
|
||
|
that could run for days before getting to the point where you wished to begin
|
||
|
debugging.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="debug.htm" title="To debug Java programs from the i5/OS command line, select one of the options listed here.">Debug Java programs from an i5/OS command line</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|