Menu

Visual Studio Code & GnuCobol - Help

2020-03-12
2020-07-01
  • Jose Manuel

    Jose Manuel - 2020-03-12

    Can someone help me set up Visual Studio Code to compile and debug? Is it possible to debug with Visual Studio Code step by step?
    I already tried the following configuration, but without success (Gnucobol 3.1).

    { //
    "version": "3.1.0",
    "label": "GnuCOBOL - Compile (single file)",
    "type": "shell",
    "options": {
    "env": {
    "PATH=d:\gnucobol\bin"
    "COB_CONFIG_DIR=d:\gnucobol\config"
    "COB_COPY_DIR=d:\gnucobol\copy"
    "COB_INCLUDE_PATH=d:\gnucobol\include"
    "COB_LIB_PATH=d:\gnucobol\lib"
    },
    "command": "cobc",
    "args":
    "-x",
    "-std=mf",
    "-tPROG.LST",
    "BBCB.CBL"

    },}
    Thanks
    José

     
    • Simon Sobisch

      Simon Sobisch - 2020-03-15

      Die now this setup can only work if you have GDB available. Then duplicate the current target to have a "compile with debug info", adding "-g" and " -fgen-c-source" to your args.

      Then to run this with debugging start the executable with gdb putting your program name into args.

       
      👍
      1
      • Brian Tiffin

        Brian Tiffin - 2020-03-16

        Off topic trivia: Just did a duckduck search for vscodium gdb. Simon, your profile on SourceForge was the fifth item on the first page. Well done. ;-)

         
  • Rich Di Iulio

    Rich Di Iulio - 2020-03-16

    Jose,

    I have been able to compile under VS Code in both Linux and Windows. I use a shell script to perform the compile. However, it is specific to what I am doing, but it could be modified to work for anyone else. I have a task within VS Code that calls the compile shell script.

    I too would like to be able to debug my code, but have not had much like.

    Trolley78

     
  • Simon Sobisch

    Simon Sobisch - 2020-07-01

    Just a note to anyone coming along here: to have vscode to correctly recognized messages from cobc you have to ensure that the so called problemMatcher definition is correct. For notes about how to confgure it see [9071c9dfe1].

    Warrnin: For an environment that uses translated messages the recognition may be broken:

    the problemMatcher don't work correctly when using a foreign language for the messages, https://github.com/microsoft/vscode/issues/97256 is about fixing this - just in case someone wants to vote for it, still 19 votes missing...

    Doesn't look like it will receive enough votes to be handled, so you may want to either disable message translation when building GnuCOBOL or disable it by setting LANG=en before calling cobc.

     

    Related

    Discussion: 9071c9dfe1

    • Eugenio Di Lorenzo

      Hi Simon ,
      it's unclear how I can add my vote. how can I do that ?

       
      • Simon Sobisch

        Simon Sobisch - 2020-07-01

        That would need a login at that site and actually be logged-in. Then visit the issue and either click on an existing thumb up/down (it will be raised by one) or, if your yes/no is not there yet, click on the smiley in the upper right corner "choose your reaction" and choose one of the first two.

        It somehow evolved @ github to count the reactions thumbs up/down to the first message in an issue as the community vote for it. Some larger repositories that get lots of issues use it as a way to decide what to do at all and what to do next.

         

Anonymous
Anonymous

Add attachments
Cancel