marcsosduma / cobgdb

Command-Line Debugger for GnuCOBOL on Linux and Windows
GNU General Public License v3.0
5 stars 1 forks source link
cobol command-line debugger gnucobol linux windows

COBGDB

It is a command-line application, programmed in C, designed to assist in debugging GnuCOBOL code using GDB. The application is based on the extension for Visual Studio Code (VSCode) created by Oleg Kunitsyn, which can be found on GitHub: https://github.com/OlegKunitsyn/gnucobol-debug.

CDBGDB is still under development; however, it can already be used and can help you debug your applications.

Requirements

Getting Started

In the Windows subdirectory, the executable program for this operating system is available.

To compile the code on Windows, you can use MinGW, which is usually included in the GnuCOBOL package. The Makefile is configured to generate the program for both Windows and Linux.

To run the example program:

  1. On Windows, first install MinGW (Minimalist GNU for Windows) or use the gcc/mingw32-make included in the GnuCOBOL package.
  2. Execute the make ('mingw32-make' for Windows) command to compile the code.
  3. Run the example program using the following command:
    cobgdb customer.cob -lpdcurses

In the example above, '-lpdcurses' is an instance of an argument that can be indirectly passed to 'cobc' by 'cobgdb,' even if it is not used by 'cobgdb' itself.

COBGDB takes one or more programs with COB/CBL extension as parameters and runs the GnuCOBOL compiler with the following format:


cobc -g -fsource-location -ftraceall -v -O0 -x prog.cob prog2.cob ...

On Linux, it is recommended to use Xterm to view the application.

In the doc directory of the project, there is a document available that shows the detailed usage of COBGDB, a contribution from Prof. Eugenio Di Lorenzo.

COBGDB running:

Screenshot

Debugging application output:

Screenshot

To debug multiple programs, use COBGDB with the following syntax:

cobgdb prog.cob subprog1.cob subprog2.cob

You can run GDB/GDBSERVER remotely using the A key. COBGDD will prompt you to provide the server and port in the format server:port or the PID of the application.

Example:

COBGDB Debugging a Pre-compiled File

You can also use COBGDB to debug a previously generated executable file. To do this, you must compile the program with these options:


cobc -g -fsource-location -ftraceall -v -O0 -x prog.cob prog2.cob ...

To start debugging, run cobgdb using the --exe directive as follows:

Windows:


cobgdb --exe prog.exe

Linux:


cobgdb --exe prog

Main Commands

Linux

Debugging application on Linux:

Screenshot

Extra Information

The command cobgdb --version will display the application's version.

This program utilizes the GPLv3+ license (GNU General Public License version 3 or later).

COBGDB has been tested with versions 3.1.2 and 3.2 of GnuCOBOL; however, it should also work with older versions.

In terms of Linux, it has been tested on GNOME, XFCE and XTerm terminals.