Debugging C

Top  Previous  Next

C language programs may be debbuged using every symbolic debugger, which is able to remotely attach a process.

In any case XCICS process to attach must be created with this procedure:

connect XCICS using X4J
enter CEDB ON
wait for debug to be activated
use the PID displayed to connect with your debugger

Using GDB

To debug interactively C programs with GDB (GNU Debugger), this procedure should be followed

1.compile programs with debug symbols (-g option)
2.2. define an empty entry point (function) to be compiled & linked into a shared library to preload with "load library" command in xcics.conf. I.e.

int gdb_entry_point() {
       return 0;
}

3.put a call to this function in the module to debug
4.startup XCICS
5.connect XCICS and issue CEDB ON and wait for its messages
6.At this point we have a dedicated process for debug: PID is shown in X4J status bar (or using XADM PID)
7.from command-line, change PWD to source directory and issue:

gdb $XFRAMEHOME/bin/xcicsd <PID>

8.set a breakpoint on the dummy entry point and continue execution. I.e

gdb> break gdb_entry_point
gdb> continue

9.continue using the transaction
10.when the program execution reaches the dummy entry point, debugger will stop
11.at this point GDB have to reload symbols from user library using the sharedlibrary command. I.e.

gdb> sharedlibrary

12.GDB is now ready to debug the application

Remember that user programs is always reloaded from the shared library every time the transaction restart.

Please refer to GDB documentation for further information about it.

Using DBX on AIX

To debug interactively C programs with DBX, this procedure should be followed

1.compile programs with debug symbols (-g option)
2.startup XCICS
3.connect XCICS and issue CEDB ON
4.for the CEDB messages on terminal.
5.At this point we have a dedicated process for debug: PID is shown in X4J status bar (or using XADM PID)
6.from command-line, change PWD to source directory and issue:

dbx -a <PID>

7.set a breakpoint on the module or function to debug and continue execution. I.e

(dbx) stop in MYPROG
(dbx) c

8.continue using the transaction
9.when the program execution reaches the dummy entry point, debugger will stop.
10.now it is possible to use dbx commands to debug the program

Remember that user programs is alwats reloaded from the shared library every time the transaction restart.

Please refer to DBX documentation for further information about it.