NOTICE: Our Community is moving. Get more information.
How to attach to a remote unix process and debug, using Visual COBOL for eclipse based on a PC.
VISUAL COBOL for eclipse installed on PC.
<See Installing Visual COBOL on Windows>
Visual COBOL development hub installed on the Unix machine.
<See Installing Micro Focus Visual COBOL Development Hub>
RDO daemon process must be running.
<See Configuring the Remote System Explorer Support>
Two remote projects are created in the same workspace using Visual COBOL for eclipse on a PC
quickdebug is the actual development project.
APquickdebug is the glue for attaching to the deployed running process to debug and test.
APquickdebug references the quickdebug project
APquickdebug has a debug configuration, which has quickdebug referenced for source code and the debug symbols.
tesbin is a soft symbolic link created on the unix machine in the APquickdebug unix project area. NB. this is not created using the IDE, see detailed section below.
On the unix side
/Quickdebug and /APquickdebug are created by the PC eclipse IDE.
/testbin needs to be created as this is where the quickdebug executable will be deployed to.
A symbolic link to testbin needs to be created inside /APquickdebug project area using the Unix command line not the eclipse IDE.
1 Create a remote COBOL project quickdebug.
2 Create a test environment.
3 Create deployment script.
4 Create a remote COBOL project APquickdebug.
5 Create a symbolic soft link.
6 Setup for debug.
7 Setup the debug configuration.
8 Start the debugger.
9 Use the debugger.
Insert the code from Program1.cbl below
program-id. Program1 as "Program1".
01 ans pic x.
display "started program 1"
move space to ans
perform until ans ="Q"
display "press Q enter to exit..."
end program Program1.
This program will just sit there accepting input until “Q” is pressed.
This emulates a standalone process which we can attach to and debug.
Make a directory testbin in the user home directory on the Unix machine.
This is to emulate deployment of the executable quickdebug to a test environment.
Automatically deploy the executable quickdebug to the test environment, by using the post build event of the quickdebug project.
echo "deploying quickdebug to testbin"
cp -p New_Configuration.bin/quickdebug ../APquickdebug/testbin
ls -l ../APquickdebug/testbin/
ls -l New_Configuration.bin
echo "done it"
/APquickdebug holds all the required information to glue the source code and debugging symbols in /quickdebug with the executable in /testbin.
In order not to interfere with the test area, create a remote project on the same machine as /testbin, but in a different /APquickdebug location.
APquickdebug needs to know how \ where to find the quickdebug executable in the test environment testbin.
On the unix machine using the command prompt, not the eclipse IDE, create a symbolic link to the test environment testbin directory using a command like this.
ln -s /home/support/support/tonyt/testbin /home/support/support/tonyt/testit/APquickdebug/testbin
The scripts to setup the test environment and run the test application have been put into the APquickdebug remote project, they can be put anywhere on the UNIX machine.
Examples of setup.sh and runit.sh are given below
# trace myprogram
#truss -e -rall -f -o junk.truss ./Program1
Put a project reference in APquickdebug to quickdebug.
Clean compile both projects, and make sure the executable is copied to the test environment ~/testbin
On the unix machine in the APquickdebug project, run the setup.sh and the runit.sh to start the executable quickdebug in the test environment testbin directory.
/home1/support/support/tonyt/testit/APquickdebug >. ./setup.sh
java version "1.6.0"
Java(TM) SE Runtime Environment (build pap3260sr6-20090925_01(SR6))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr6-20090923_42924 (JIT enabled, AOT enabled)
J9VM - 20090923_042924
JIT - r9_20090902_1330ifx1
GC - 20090817_AA)
JCL - 20090924_01
COBDIR set to /home/products/vcdevhub22
version @(#)cob.c 188.8.131.52
PTI=Micro Focus Visual COBOL Development Hub 2.2
I see no work
/home1/support/support/tonyt/testit/APquickdebug >. ./runit.sh
started program 1
press Q enter to exit...
The application will be asking for input.
We need to attach to this process and debug it using the eclipse IDE, and the glue which is the APquickdebug project.
Create a debug configuration for the APquickdebug project.
In General settings - remove X Server (DISPLAY)
In Source settings - add quickdebug project
In Common settings - remove allocate console
In Debug symbols - add quickdebug project
Apply these settings and press debug, and a select process menu will appear.
Enter quickdebug and press OK.
In the debug perspective you should see something like this
Now set a breakpoint on line 18
Double click in left margin.
Now press zoom to allow the program to continue
Go to the application and enter a value “x” and press enter; now the code should break at line 18 allowing for debugging of the test environment application.
The debugger is attached to the program in testbin and using the source and debug symbols in the quickdebug project via a glue project APquickdebug.
Just clean compiling both projects seems to reset everything in case of any trouble.