Debugging programs called by Java native
methods
This topic describes how to debug, with Debug Tool, Java native methods and the programs they call that
are running in Language Environment. By inserting calls to the Language Environment CWI
service CEE3CBTS and callable service CEETEST into your Java native method or program and
compiling your methods or programs with the HOOK suboption
of the TEST compiler option, you can debug your application.
These instructions describe how to insert the calls to CEE3CBTS and
CEETEST directly into your method or program.
These instructions assume you understand the following items:
- You understand Java JNI
interface.
- You have configured a remote debugger (for example, Rational® Developer for System z®) to debug the Java native method and the programs
it calls. You need to know the IP address and port ID of the remote
debugger.
- You can modify the compilation parameters of the Java native method and the programs it calls.
Do the following steps:
- Review the description of the Language Environment CWI service CEE3CBTS in Language Environment Vendor Interfaces. For this situation, specify the following values
for the elements in the structure:
- TCP/IP address, as described in the Language Environment Vendor Interfaces
- Debugger port ID, as described in the Language Environment Vendor Interfaces
- Client Process ID, assign a value of 0
- Client Thread ID, assign a value of 0
- Client IP address, assign a value of 0
- Debug Flow, assign a value of 1
- Choose which programs that the native method calls to debug. Decide
where you want to start and stop debugging.
- In the Java native method,
add a call to CEE3CBTS with the AttachDebug function code
and assign values to the debug context parameters.
- In the Java native method
or the programs it calls, add a call to CEETEST. CEETEST is the way
you start Debug Tool for this situation.
- In the Java native method,
add a call to CEE3CBTS with the StopDebug function code to
stop the debug session.
- Modify the compilation parameters of the Java native method so that they compile with the HOOK suboption
of the TEST compiler option.
- Modify the compilation parameters of the programs you chose in
step 2 so that they compile with the HOOK suboption of
the TEST compiler option.
- Run the JCL for your programs. Your remote debugging session starts.
After you finish debugging your Java native method and the programs called by the Java native method, remove the modifications
done in these steps before moving your application to a production
environment.
Refer to the following topics for more information
related to the material discussed in this topic.