Previous Topic Next topic Print topic


Debug Using CodeWatch

CodeWatch provides debugging facilities, such as stepping, setting breakpoints or tracing. You can examine the source program, find specified text strings, move to specified line numbers, and examine included source files.

When debugging on UNIX, you are required to attach the debugger to a batch initiatior and then let it run until a setting in PLIDEBUG.DAT indicates that a SIGTRAP should be generated to interrupt the debug session. At the interrupt you can then load the symbols, set appropriate breakpoints and continue execution into your code stepping as appropriate. The first step is to determine the process ID of the batch initiator. You can do this in one of the following ways:

Before starting CodeWatch you need to ensure that LD_LIBRARY_PATH points to the location of our shared objects as it is what CodeWatch will use when attempting to find the shared object to load its symbols. This is an example command:
export LD_LIBRARY_PATH=/home/hub/nxopdemo/debug:$LD_LIBRARY_PATH 
Note: The command above may differ depending on your operating system. For example, LIBPATH is used on AIX.

You now need to attach to your process ID which you determined in one of the two ways listed above. If, for example, your process ID is 430, you can attach to it by typing the following command in the cwcmd command prompt:

cwcmd -pid 430 $COBDIR/bin/cassi32


If you type c to continue, the batch initiator will run until SIGTRAP is triggered as a result of the setting in PLIDEBUG.DAT

You now can submit the JCL via the ESMAC interface or via a cassub command. For the purposes ot this tutorial, use the cassub command from a second Telenet session.



If you switch back to your CodeWatch session, you can see that the SIGTRAP has occurred for OPDEMO.so. You can now issue commands to load the symbols, and set appropriate breakpoints. (eg. shlib OPDEMO.so; env OPDEMO; br %ENTRY; br %EXIT [det;q] )

If you type c to continue, you can see that you are at the entry in OPDEMO.



To see some of the CodeWatch debugging facilities:
  1. Click Step or type S in the edit-line. This executes the first statement.
  2. Type S 4 and this will execute the next 4 statements.
  3. Type P 10 in the edit-line. It will print the next 10 lines in the output window.
  4. Type BR 106 and this will set a breakpoint on line 106.
  5. Type C and the statements until the breakpoint will be executed.
  6. If you want to run to the completion of OPDEMO, you can type DET or CONTINUE. The debug session will end when you hit the end of the OPDEMO program and the second job step will complete automatically as there is no debugger present. If you have used the [det;q] commands on the breakpoint for %EXIT, you won't be able to start debugging OPDEMO2. If you haven't used them, you will be prompted with another SIGTRAP when OPDEMO2 was scheduled for execution by the JCL engine.
  7. Type S 7 and this will execute the next 7 statements.
  8. Type EVALUATE SYSPRINT_BUFF to evaluate the SYSPRINT_BUFF variable.
  9. You can continue stepping or if you want to stop debugging, type DETACH.

See the CodeWatch User's Guide for more information on debugging with CodeWatch.

Note: To stop the enterprise server, type casstop -rPLIDEMO
Previous Topic Next topic Print topic