Cross-session Debugging - Micro Focus
Cross-session Debugging - Micro Focus
Cross-session Debugging - Micro Focus
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Cross</strong>-<strong>session</strong> <strong>Debugging</strong><br />
<strong>Cross</strong>-<strong>session</strong> debugging allows you to use Animator in a different terminal<br />
window to that in which the program to be debugged is running. With cross<strong>session</strong><br />
debugging, Animator is started first in one <strong>session</strong> and left in a<br />
waiting state. Both <strong>session</strong>s must use the same user ID.<br />
Using the COBANIMSRV Environment Variable<br />
The COBANIMSRV Environment Variable will need to set in both terminal<br />
windows for cross-<strong>session</strong> debugging. The environment variable will need a<br />
unique identifier. Animator will then only debug a program that has a<br />
matching identifier.<br />
For example, in one <strong>session</strong> enter:<br />
export COBANIMSRV=myid<br />
myid is now a unique identifier you can use to match Animator to a program.<br />
Enter the command to start Animator:<br />
cobanimsrv<br />
Animator waits for the COBOL program to start that has the same identifier.<br />
In another <strong>session</strong> enter:<br />
export COBANIMSRV=myid<br />
cobrun program1.int<br />
When program1.int starts, the unique identifier myid matches that of<br />
Animator, so Animator attaches to this process. In the first <strong>session</strong>, the<br />
Animator main screen is displayed and the cursor placed on the first line<br />
program1.int.<br />
Using the Same Directory<br />
If Animator is started in the same directory as that in which you run the<br />
program that is to be debugged, the program will attach to the waiting<br />
Animator process.<br />
Using CBL_DEBUG_START and CBL_DEBUG_STOP<br />
With these routines you can switch debugging on and off as you wish and<br />
debug more than one program without having to stop and restart the<br />
Animator process. You start up Animator in one <strong>session</strong>, using the<br />
cobanimsrv command. In a second <strong>session</strong> you run a program that has a<br />
different COBANIMSRV environment variable value, or if it is not set, is<br />
running in a different directory. This program starts running as normal, not<br />
animated.
When a call to CBL_DEBUG_START is encountered with an identifier<br />
parameter that matches the value of the COBANIMSRV environment variable<br />
for the Animator process, or if the identifier parameter is unset, is running in<br />
the same directory, then Animator attaches to the program.<br />
For example, in one <strong>session</strong> enter:<br />
export COBANIMSRV=myid<br />
myid is now a unique identifier you can use to match Animator to a program.<br />
Enter the command to start Animator:<br />
cobanimsrv<br />
Animator waits for a COBOL program to start that has a matching identifier.<br />
In another <strong>session</strong> enter:<br />
cobrun program1.int<br />
The program1.int program starts running without animation. A call to<br />
CBL_DEBUG_START is encountered:<br />
call CBL_DEBUG_START using by value flags, timeout,<br />
by reference "myid",<br />
returning status-code<br />
The unique identifier myid matches that of Animator, so Animator attaches to<br />
this process. In the first <strong>session</strong>, the Animator main screen is displayed and<br />
the cursor placed on the line of prog1.int containing the CBL_DEBUG_START<br />
call.<br />
You can stop or suspend debugging by issuing a call to CBL_DEBUG_STOP.<br />
CBL_DEBUG_START and CBL_DEBUG_STOP calls can also be used to switch<br />
remote and local animation on and off.<br />
Just-in-time <strong>Debugging</strong><br />
Just-in-time debugging enables you to start Animator and debug a running<br />
program if that program terminates with a run-time error. This will allow you<br />
to see what was happening when the program failed.<br />
To start just-in-time debugging you need to create your run-time<br />
configuration and then add the run-time tunable debug_on_error to the<br />
configuration file.<br />
For example, add the following line:<br />
set debug_on_error=1<br />
Ensure that the configuration file can be read by the run-time system:<br />
export COBCONFIG=cobopt.cfg<br />
Additional Options
There might also be a need to specify which debugger to start. Normally, it<br />
is not necessary to specify this as cobanim is set by default, as it enables<br />
Animator to start in a separate window under X. If you want to specify a<br />
different debugger, such as anim add<br />
set debugger_command="anim"<br />
to the configuration file.<br />
You might also want to add directives to the command;<br />
for example, to add directives to the cobanim command:<br />
set debugger_command="cobanim mixedlangdebug"