COBOL source code is compiled with the GnuCOBOL compiler. Debugging information and a gdb extension are added to the executable by the COBOLworx cbl-gdb routines. The resulting executable can be debugged directly by the Gnu gdb debugger. That executable can also be debugged on the source-code level with this extension, which provides a VSC Debug Adapter that is aware of the COBOLworx extensions to gdb that makes source-level debugging possible.
COBOL source code is compiled with the GnuCOBOL compiler. Debugging information and a gdb extension are added to the executable by the COBOLworx cbl-gdb routines. The resulting executable can be debugged directly by the [GNU Project Debugger `gdb`](https://www.gnu.org/software/gdb/).
That executable can also be debugged on the source-code level with this extension, which provides a VSC Debug Adapter that is aware of the COBOLworx extensions to gdb that makes source-level debugging possible.
## Prerequisites - GnuCOBOL
In order to debug a COBOL program, it must first be compiled with an appropriate version of the GnuCOBOL compiler. The compiler must be the 3.1 version or later.
In order to debug a COBOL program, it must first be compiled with an appropriate version of the GnuCOBOL compiler. The compiler must be the 3.1 version or later and build with [GCC](https://www.gnu.org/software/gcc/).
GnuCOBOL installation packages for Ubuntu, RedHat, and Windows can be found at [COBOLworx downloads](https://cobolworx.com/pages/downloads.html).
Those who prefer to build from developer source can find GnuCOBOL source code at the SVN repository https://svn.code.sf.net/p/open-cobol/code/branches/gnucobol-3.x The build sequence starts with `./autogen.sh`
Those who prefer to build from source can downloaded the latest version from [here](https://alpha.gnu.org/gnu/gnucobol/). The build sequence starts with `./configure`.
As an alternative you may build from developer source code, which is available in the [GnuCOBOL SVN repository](https://svn.code.sf.net/p/gnucobol/code/branches/gnucobol-3.x). The build sequence starts with `./autogen.sh`, for details see its `HACKING` file.
A more build-ready tarball, with certain system-independent elements pre-built with known-good tools, can be downloaded from [here](https://sourceforge.net/projects/open-cobol/files/gnucobol/3.1/gnucobol-3.1-rc1.tar.gz/download). The build sequence starts with `./configure`.
More information can be found at https://sourceforge.net/projects/open-cobol/
More information can be found at the [GnuCOBOL project site](https://www.gnu.org/software/gnucobol/).
As part of the compilation process, the cbl-gdb extensions need to be applied before the executable can be debugged using gdb and VSC.
Download and install the appropriate `COBOLworx GnuCOBOL Debugging Extensions package` from [COBOLworx downloads](https://cobolworx.com/pages/downloads.html).
Download and install the appropriate `COBOLworx GnuCOBOL Debugging Extensions package` from [COBOLworx downloads](https://cobolworx.com/pages/downloads.html) or from the [COBOLworx source repository](https://gitlab.cobolworx.com/COBOLworx/cbl-gdb).
## Installation
If you didn't install this extension from Microsoft's repositories, then you probably downloaded a file named cbl-gdb-3.1.1.vsix, which is a Visual Studio Code extension package. You have a couple of options for loading the extension into VS code:
If you didn't install this extension from [Open VSX Registry](https://open-vsx.org/?search=COBOLworx) or the Microsoft market place, then you probably downloaded a file named cbl-gdb-3.1.1.vsix, which is a Visual Studio Code extension package. You have a couple of options for loading the extension into VS code:
- From inside Visual Studio Code, use the Command Palette `(Ctrl+Shift+P)` to find "Extensions: Load extension from VSIX..." Select that, and point it at the .VSIX file.
...
...
@@ -38,7 +39,7 @@ If you didn't install this extension from Microsoft's repositories, then you pro
## Additional extensions
There are a number of COBOL formatting extensions available at Microsoft's Extension Marketplace. We've found that `Enterprise COBOL for z/OS` seems to coexist with our Debugging Adapter, and does a reasonable job of formatting the COBOL source code.
There are a number of COBOL formatting extensions available at the [Open VSX Registry](https://open-vsx.org/?search=cobol) and Microsoft's marketplace. We've found that `Enterprise COBOL for z/OS` seems to coexist with our Debugging Adapter, and does a reasonable job of formatting the COBOL source code.
## Additional configuration of Visual Studio Code.
...
...
@@ -54,7 +55,7 @@ Create an empty directory; I'm naming it `ctest`.
Create a text file CTEST.CBL
```
```cobol
000001IDENTIFICATIONDIVISION.
000002PROGRAM-ID.CTEST.
000003DATADIVISION.
...
...
@@ -238,12 +239,12 @@ If you are in the business of attaching to existing processes, you'll need a dif