Menu

Need help with COBOL debugger extension for VS Code

2020-09-22
2020-09-27
  • Rich Di Iulio

    Rich Di Iulio - 2020-09-22

    Hi All!

    I am running into a problem with my application and I decided to install the debugger for VS Code. I updated the launch.jsonto have the build arguments. However, I am using variables to point to the directories were the copybooks are located. When I run the debug session, it cannot find my copybooks.

    Are there more detailed instructions I should follow?

    Trolley78

     
  • Simon Sobisch

    Simon Sobisch - 2020-09-22

    It totally depends on which extension you use. The only one found in the market place so far does always a complete recompile (which I personally don't like much) and you therefore need to specify all your programs (that you may want to debug) and always all command line options.

    See https://github.com/OlegKunitsyn/gnucobol-debug/issues/63 for a discussion about this (and possibly leave a comment there, too). https://github.com/OlegKunitsyn/gnucobol-debug/issues is also the right place for general questions on this (but I think the readme is quite good already [likely when leaving the docker part away, at least I think from previous discussions that you want a local environment]).

    For the other extension see https://cobolworx.com/pages/downloads.html (mainly for the additional tools needed) but be sure to use the vsix that is not included there (still version 2.1.1 but the latest found at https://gitlab.cobolworx.com/COBOLworx/cbl-gdb-vsextension/-/tree/master/vsdistrib (3.2.1). The readme of this extension... is improvable.
    It is expected to find this extension with an improved README in the open vsx registry (and possibly the ms market place) after GC 3.1 RC2 is out as the imrpoved version not-yet-released uses functions currently not available.

    In any case you'll need to setup the environment either before starting vscode or use wrappers (on win32 something like a cobc.cmd calling set_env.cmd and then cobc.exe).

     
  • Robert Dubner

    Robert Dubner - 2020-09-22

    I'm the person who authored the COBOLworx .vsix file. I just updated https://cobolworx.com/pages/downloads.html to point to the 3.2.1 version.

    As Simon has pointed out, there are a number of developments to the debugger that will become available shortly after the release of 3.1-rc2

     
  • Rich Di Iulio

    Rich Di Iulio - 2020-09-24

    Hi Simon/Robert,

    Thank you for your responses. I installed the COBOLworx extension as decscribe. However, I could not find cobcd. I am using GnuCOBOL v3.1 rc1. Will I have to wait for rc2.?

    I also tried the other extension before COBOLworx. I could not get it to work and was troubled by trying to re-compile my source program.

     
    • Simon Sobisch

      Simon Sobisch - 2020-09-24

      cobcd is (mainly) a python package, which won't be part of GnuCOBOL (has different Copyrights and a different free license).

      You can get binay packages that include RC1 and cobcd from https://cobolworx.com/pages/downloads.html or use the source-code of cobcd to build it on your own (which I've not tested on win32 so far) from https://gitlab.cobolworx.com/COBOLworx/cbl-gdb/-/tags .

       

      Last edit: Simon Sobisch 2020-09-25
  • Rich Di Iulio

    Rich Di Iulio - 2020-09-25

    Okay, I was able to find the executable for Windows with the debugger part of it. I ran the executeable and then tried to compile Cobjapi and was successful. However I was not able to compile my programs. In Linux, Cobjapi works just fine.

    I was not able to find the sources for the debugger. I tried to go to the gitlab, but not able to get setup.

    Trolley78

     
    • Simon Sobisch

      Simon Sobisch - 2020-09-25

      I was not able to find the sources for the debugger. I tried to go to the gitlab, but not able to get setup.

      Please try again:

      https://gitlab.cobolworx.com/COBOLworx/cbl-gdb/-/tags

      where you see a donwload, then unpack, cd into the folder and install according to the README (make && sudo make install, possibly with setting DESTDIR, then tell gdb to allow loading the extension as make install will tell you).

       
      • Rich Di Iulio

        Rich Di Iulio - 2020-09-25

        Thank you Simon, I was able to download the source. I am working on this and will report my findings.

        Trolley78

         
    • Simon Sobisch

      Simon Sobisch - 2020-09-25

      I ran the executeable and then tried to compile Cobjapi and was successful. However I was not able to compile my programs.

      We'd need more data to be able to help, "A works but B not" may be everything ;-)

       
      • Rich Di Iulio

        Rich Di Iulio - 2020-09-25

        Simon,

        Attached is the result of cobc -info and the compiler output of the main program.

        Trolley78

         
        • Simon Sobisch

          Simon Sobisch - 2020-09-25

          The main issue seems to be that you say -Lws2_32.lib instead of the possibly correct -lws2_32 which are used in all the Makefiles in the cobcjapi folder.

           
  • lukecow

    lukecow - 2020-09-27

    Don't use extensions, they usually tend to fail most of the time or can't point at the exact error. Just use the normal debugger from the compiler.

    cobc -d <your-program-id>.cob
    
     
    • Simon Sobisch

      Simon Sobisch - 2020-09-27

      That's not a debugger (which shows you execution and variable content at any requested time and possibly also adjustment of both at any time) but the activation of all runtime checks. Historically some programs won't work that way (I still suggest to at least trying to use those), and with GC 3.1RC1 we now finally also have the option to only enable/disable part of those.

      Debugging rocks (and with a full GDB variant also allows stuff like "continue to point A if variable X is 42 as this is a known good point, then record execution and go on until variable Z becomes 42, too (which is considered bad), and then step backwards to allow recognizing the actual point in error), as do runtime checks (better break hard [optionally with a memory dump and with RC2 aways with a stack trace] then continuing after a tried devide by zero or access to a negative index).

       

Anonymous
Anonymous

Add attachments
Cancel