OlegKunitsyn / gnucobol-debug

GnuCOBOL debugger
GNU General Public License v3.0
22 stars 10 forks source link

Dear Oleg #96

Closed 123pips closed 3 years ago

123pips commented 3 years ago

Used vscode for a while, debuggin in c, c++, python etc. But with Cobol, no luck with your extension. I run the debug and it never gives me an option to go to step, F11. Just sits there, I have been trying now for 2 days to get it working no luck. Below is my jason, which i get from you during install.

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [

{
    "type": "COBOL",
    "request": "launch",
    "name": "COBOL Debugger",
    "commandLine": "${command:commandLineBuild}",
    "stopOnEntry": true
},
    {
        "name": "COBOL debugger",
        "type": "gdb",
        "request": "launch",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "coverage": true

    },
    {
        "name": "COBOL debugger attach local",
        "type": "gdb",
        "request": "attach",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "pid": "${input:pid}"
    },
    {
        "name": "COBOL debugger attach remote",
        "type": "gdb",
        "request": "attach",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "remoteDebugger": "${input:remoteDebugger}"
    }
]

} im VSC0DE using a windows 10 pc, without WSL enabled in extensions though i do have WSL 2 on pc i have the following extensions. Cobol - bitlang Cobol Control Flow - broadcom Cobol debugger - you Cobol Language support - Broadcom Cobol themes - Broadcom Rech COBOL - rechinformatica

when i click on Run, i pick COBOL debuuger and nothing happens, except for cursor going from left to right Step Into (F11) does not work

and here is a simple cobol program im using to test.

IDENTIFICATION DIVISION. PROGRAM-ID. "OBTAININPUT". AUTHOR. Cob. *This is a comment in COBOL ENVIRONMENT DIVISION.

   DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 NAME PIC A(20).

   PROCEDURE DIVISION. 
   0100-START-HERE.
           DISPLAY "Please enter your name: ".
           ACCEPT NAME.
           DISPLAY "It is nice to meet you, ", NAME.
       STOP RUN.
   END PROGRAM OBTAININPUT.

all help appreciated

GitMensch commented 3 years ago

Run directly starts the program and only stops when it reaches a breakpoint. Do you have a breakpoint set?

In general: this plugin still does not use a pre-task for compilation but always compiles itself (and does not default to showing you the output, your have to set the verbose attribute to see this) so you have to provide valid code. I'd guess your comment line is invalid.

123pips commented 3 years ago

yes i have now tried this so many times. as i said, i have used many other programs with breakpoints in vscode, such a python, c programs c sharp etc never without a problem, only with Olegs extension it never worked, if you could help or anyone, otherwise i fear i might be here a week, before i figure it out, i would be very very happy if anyone could help, since im now spending just on this 2 days. I have tried, other extensions adding other things, reinstalling, different combinations and nada works. I will take out the comment and try verbose, will let you know.

123pips commented 3 years ago

did what you suggested as you can see below, it didnt change a thing, the run just runs and runs Here is my new program notice no comment. IDENTIFICATION DIVISION. PROGRAM-ID. "OBTAININPUT". AUTHOR. Cob.

   ENVIRONMENT DIVISION.

   DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 NAME PIC A(20).

   PROCEDURE DIVISION. 
   0100-START-HERE.
           DISPLAY "Please enter your name: ".
           ACCEPT NAME.
           DISPLAY "It is nice to meet you, ", NAME.
       STOP RUN.
   END PROGRAM OBTAININPUT.

and below the updated json with verbose

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [

{
    "type": "COBOL",
    "request": "launch",
    "name": "COBOL Debugger",
    "commandLine": "${command:commandLineBuild}",
    "stopOnEntry": true
},
    {
        "name": "COBOL debugger",
        "type": "gdb",
        "request": "launch",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "coverage": true,
        "verbose" : true
    },
    {
        "name": "COBOL debugger attach local",
        "type": "gdb",
        "request": "attach",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "pid": "${input:pid}"
    },
    {
        "name": "COBOL debugger attach remote",
        "type": "gdb",
        "request": "attach",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "remoteDebugger": "${input:remoteDebugger}"
    }
]

} notice i have no errors in my json i added one more extension Rech COBOL Debugger which i had taken out earlier for a test so i have the following extensions in this vscode. this vscode is only for cobol, i have another machine where vscode is installed that has c#, c, etc, python, java, scirpt etc and over there i use the vscode debugger with no issues, only on this install of vscode same install as other pc, but dedicated to cobol i have these seven extension, and im not running wsl or unbunto or dabian here.

Rech Cobol. Rech Cobol Debugger Cobol bitlang Cobol control flow Cobol debugger by Oleg Cobol lang support Broadcom Cobol Themes bitlang

123pips commented 3 years ago

I really need help, since i dont like to write code without a debugger working, and im almost thinking of giving up on Cobol, only b because i cant get a simple debugger to work even after at least 20 hours of trying, with all kinds of combinations, extensions, reinstalls, etc, i usually never give up, so i know there is a simple solution to this, all help is really appreciated...

123pips commented 3 years ago

right now the only way i compile in vscode, but not in this install, is by using cobc -x pgmname.cbl, and then running the bin, i get the output, and on that install i have wsl and debian, and my cobol program compiles fine with or without the comments, you asked me to remove,. however, there is no debug there, this is why im trying olegs extension here, with no wsl, no distros, on a new vscode install, and no luck, well actually it wont even run, with or without breaks, its just runs and runs but no results, no output. with any other language in vscode, so c, c++, phython, java, c#, javascript etc, all debuggin worked no problem and in the debug console, or in the watch or variables window i could see output, but not here with this cobol debugger extension, i have tried to add all cobol extentions too, that had to do with ibms extensions, mainframes etc, i still could not get this extension to work once, i do know i could connect to an ibm mainfrome with z and all that, but trying not to do that right now. when i get to jcl i will give that a try, but not just with simple cobol code

GitMensch commented 3 years ago

If you use the vscode integrated terminal and run

cobc -x -g -free your.cob

Do you get an executable? If not then setup GnuCOBOL before. If it works then run the executable, do you get any output?

GitMensch commented 3 years ago

... And of course if you really don't get it working you can try cobcd by COBOLworx and if you like also the vscode extension from them ...

123pips commented 3 years ago

hi Mensch, so i added GnuCobol by bitlang so now my extensions are: Cobol bitlang Cobol control flow broadcom cobol debugger oleg Cobol language support broadcom cobol themes bitlang gnucobol bitlang rech cobol rechin rech cobol debugger rechinfor and Terminal

when i go into the directory where the cobol program is and i run, cobc -x -g -free obtaininput_end.cbl i get cobc : The term 'cobc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

123pips commented 3 years ago

ill take any help in this matter that i can. Like i said, if i use wsl, with dabian, with gnucobol installed on the wsl linux, all programs easily compile and run. On this pic, i dont have wsl, im just using vscode, with any extensions necessary, and i want the oleg debuger to work with the code, so far 2 days later no luck at all. Let me know what im doing wrong.

123pips commented 3 years ago

unfortunately i tried everything myself, since i find vscode very friendly, i looked all over the net for answers, and when i tried every imaginable combo and nothing worked, i came here, so this is my last option, so far im still where i was 2 days ago, no improvements. I doubt this should be this complicated to set up, but alas, 2 days later and im still at the mount.

123pips commented 3 years ago

its possible it may never work, or that im doing something so wrong, but not sure what it is, so as you see Oleg, i cant even compile a cobol program here, so maybe we should first try and fix that, then move on to your debugger...

123pips commented 3 years ago

at this point, since all suggestions have failed, i will try and install wsl and debian on this pc, get it to compile from the terminal, and then see how it goes, but i dint not think i needed wsl on this windows machine for the debugger to run, let me know...

123pips commented 3 years ago

ok so after a couple of more hours, here is what i did, i installed wsl (windows subsystem for linux with dabian, installed all the extensions in dabian with vscode). so now i can easily run a cobol program like this, they way you asked me earlier. cobc -x helloworld.cbl and i get the bin which i can then execute however... in your jason now i get an error on the commandline

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [

{
    "type": "COBOL",
    "request": "launch",
    "name": "COBOL Debugger",
    "commandLine": "${command:commandLineBuild}",
    "stopOnEntry": true
},
    {
        "name": "COBOL debugger",
        "type": "gdb",
        "request": "launch",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "coverage": true,
        "verbose" : true
    },
    {
        "name": "COBOL debugger attach local",
        "type": "gdb",
        "request": "attach",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "pid": "${input:pid}"
    },
    {
        "name": "COBOL debugger attach remote",
        "type": "gdb",
        "request": "attach",
        "cobcargs": [
            "-free",
            "-x"
        ],
        "remoteDebugger": "${input:remoteDebugger}"
    }
]

}

and when i do run it it says in a popup box configured debug type "Cobol" is not supported. I think we are really close now, i guess all i need is the value for the commandLine Key in the Json.

123pips commented 3 years ago

actually now it wont let you put in the commanline its underlined as you can see and when you click on it it says, Property commandline not allowed, will try and delete it. Yes even if delete the commandline property , it still says Cobol type not supported

GitMensch commented 3 years ago

As the very next step I suggest to deinstall all pugins but the two from bitlang and this debugger, providing a cleaner environment...

123pips commented 3 years ago

ok so i got very far now. GitMesch, you are a real Mensch. So i have uninstalled back and forth many many times way before i came here. Now so after i installed the win linus subsyste ver 2 or debian. installed all the plugins in debians vscode

so now in vscode under WSL-DEBIAN INSTALLED COBOL - bitlang COBOL Control flow - Broadcom COBOL DEBUGGER - Oleg COBOL LANG Suppport - Broadcom GNUCOBOL - bitlang Rech Cobol - rech Rech Cobol debugger - rech

i also installed gnucobol in debian, so that vscode uses that gnucobol to compile which i can do from the vcode terminals as cobc -x etc

But when i run this debugger again now i get ..please specify the cobol file to start debugging (press.... now the cobol file is open when i run the debugger, what do i enter in this box if i enter the filename.cbl, i get an error in the debug console that says could not start external cobol debugger.

ok so im much farther than i was 2 days, ago. but if someone can help me with this last error this would help thanks Mesch, you are a real Mensch, please see if you could help me with this.. were almost there i think

123pips commented 3 years ago

when it asks for the file to debug i enter... /mnt/c/cobolprograms/hello.cbl but it says could not start external COBOL debugger

123pips commented 3 years ago

Well i got rid of debian, and tried unbuntu, well the debugger just runs and runs. i can compile it manually in the terminal by using cobc -x and then running the compiled program, but debuggin just runs and runs.

all i have now vscode for ubuntu got rid of olegs debug extension and just using now rech cobol rech debugger gnucobol cobol themes but rech is now looking for a config file saying something with could not start the cobol external debugger i need some json file that will "rech.cobol.debug.commandline": "C:\debugger\isdbg.exe $1", or

"rech.cobol.debug.commandline": "isdbg.exe $1 $2", "rech.cobol.debug.params": [ "Program name", "Sample question for second parameter", ] if someone can help me run this rech cobol debugger and let me know the json file to use, please help, im dying here literrally

123pips commented 3 years ago

Well first time i ever came to this site to ask a question. I guess im surprised noone has an inkling of a clue how to use the cobol debugger in vscode. So no problem, i guess i cant wait for another month, until i get a suggestion to uninstall and reinstall again, i already did that many times before i got here, with many different combos of distros, and extensions, but nada worked. Solution, i used vs studio and poof worked first time, took a minute, nothing to configure or go crazy with, and no need to ask on this forum, and get simplistic answers. So thanks for help, but i guess i realize, that few if any acutally use vscode with cobol debugger. Since if someone asked me today, how do you debug cobol i would tell them the easy way, but it took me 2 days, to figure out the hard way, what works and what doesnt. A simple solution, which i will work on, will be to get a real copy of ubuntu without using windows, and then trying it again, i have a feeling, windows with wsl and unbunto with gnucobol has some conflicts and these extensions, are really made for native linux shops, not to be run a a fake linux host. Just my take. Anyways thanks for all your insights, into this matter, for now i will leave it as not answered.

OlegKunitsyn commented 3 years ago

I didn't understand the root cause by reading these comments, thanks for for trying @GitMensch

Cobol type not supported

may refer to the conflicts between plugins. The first one is enough for recognition.

The term 'cobc' is not recognized

may refer to missing GNUCobol installation. Bear in mind that installed gdb is required for debugging.

The extension has an in-progress Issue #29 accessing native Windows and mixed Docker-Windows paths. I've updated README for better visibility.

As an alternative, you may try commercial COBOL dialects for Windows bundled with development tools, such as

123pips commented 3 years ago

hI Oleg as you know vscode is less overhead than visual studio, so i wanted to try it vscode. Now i guess people didnt understand my setup. Im not using a linux machine. this is important. Im using a windows 10 machine, with wsl, distro of Ubuntu i first tried Dabian. So all the extensions are in the WSL partition, on the windows machine. All the extensions are installed locally and on WSL remote. GNUCOBOL downloaded from Ubuntu into the WSL. So now when i used Olegs your extension, it said something about couldnt start the external debugger in the debug console. same if i took yours out, and used rech debugger, this is where i was stuck. by people telling me to unistall and reinstall which i did many many times before coming here, that advice was not gonna help. And yes so far it still is not working on vscode, i get couldnt start the external debugger. I did also use the gdb extension, nothing. So since noone was able to give any valuable advice, i thought that maybe if i installed ubuntu from sratch on a pc, by itself then it might work. The fact that i was using linux as some windows subsystem of linux, may have been the cause. Certainly from the answers here, it was very clear to me, that noone was actually running Cobol on Linux, but the answers where comming from people who where using the vscode debugger in c, or java, or javascript, phython etc. of course i know to use the debugger in all those cases, only in the case of Cobol is where i got stuck. Yes and you are right, with mfocus cobol which i tried, it worked right away, not one error or complaint. Now you mention veryant iscobol,i understand is normally developed with eclipse since it uses lots of java tools. Now Raincode is kind of the same as veryant but instead of jave its use C#. Im not looking to change people code to other technologies, i want to use cobol the way it is, old style, but with any kind of debugger line by line. I thouhgt your cobol debugger could do it, but so far at a loss how, noone was able to shed any light, in the dimmest, maybe you can Oleg, i would love to get the cobol debugger working in vscode, though as plan b, after i got no real help, i simply went to microfocus with V Studio. But i do know cobol debuggers exist for vscode yourselfs, and rech, how to use them without errors, eludes me.

GitMensch commented 3 years ago

Rech COBOL is a completely different product and the vscode extenions is only for accessing that. if you don't have that software, then it makes no sense to install their plugins at all. Most other plugins are only specifiy to access IBM or other Mainframes, then it doesn't make any sense to install those - leaving effectively only the two from bitlang with this debug extension.

As I've noted you can also use GnuCOBOL debugging on "native windows" (leaving WSL and Docker completely out) - likely soon, depending on #29. You can also get a complete COBOL on Windows package from https://cobolworx.com/pages/windows.html with its supporting vscode extension from https://cobolworx.com/pages/vsix.html (if you use that then you should deactivate this extension).

... everything is better than the commercial options ...

123pips commented 3 years ago

GitMensh, you see i didnt want to use Rech, but when i ran Olegs debugger i got all kinds or errors, and by adding Rech at least it quieted down. I was trying all kinds of things, and still i doesnt work. So GM, do you run vscode with cobol, if so just tell me your setup. and which debugger you use, and if it works for you. Ill simply copy what you have, eos. But from what i see, maybe noone is really running cobol with the debugger, in vscode in my environment. Again i use WSL so its another layer on top of the distro. And i think that is where im alone. I can run cobol compile easy in vscode from the terminal using WSL remote, no problem takes time to set up, and install, but works every time. When i tried to add olegs stuff, is when i couldnt run the debbugger. So my thought is that indeed olegs extension does work, but its been tested on a pure distro, ubuntu dabian, fedore, but not on WSL, windows subsytem for linux ver 1 or ver 2, i have used both, and different distros and couldn never the olegs debbuger to work. So does someone have my setup? My guess is not, not my setup with trying to run olegs debugger. I may be wrong, but if there is such a person, please stand up, we need to chat. By the way GM, are you saying that link you gave me, cobolworx is up and running now? I love vscode, less overhead, and would love to get the debugger working in vscode, right now it works fine in Visual Studio, with MF cobol.

123pips commented 3 years ago

sorry didnt mean to close this , im new here in github

GitMensch commented 3 years ago

The COBOLworx windows binaries work as fine as Arnold Trembley's, but they include a debugging extension (you call its cobcd wrapper instead of cobc when you want to use that) for GDB. And their vscode extension (that only works with cobcd) worked fine on plain windows when I've checked some months ago (looks a bit different than this one and works a bit different, too). I've just rechecked with Arnold's current build of 3.1.1 and this extension with its just updated version: "works" (as "expected" the prorgram is recompiled every time one wants to debug it, even if it was compiled 10 seconds before; it runs until exit [one has to set a breakpoint somewhere] and all variables can be seen and adjusted). Stepping does not work as expected, but this may be related to using 3.1.1 - you may want to use the 3.1-rc1 package instead.

The setup was done in 3 minutes (but only because I knew of some culprits):

So I'd say NOW with the very last version of this plugin it also works fine in native windows. This extension may need some adjustments to work with 3.1.1, but that's a completely different issue.

BartVertongen commented 2 years ago

Hi ,

Can somebody help me. I can not get the debugger to work. I get following error

configuration error: /mingw/share/gnu-cobol/config\default.conf: No such file or directory

This is the simple program. IDENTIFICATION DIVISION. PROGRAM-ID. TESTPROGRAM01.

   ENVIRONMENT DIVISION.
   CONFIGURATION SECTION.
       SOURCE-COMPUTER. Windows10 WITH DEBUGGING MODE.
       OBJECT-COMPUTER. Windows10.

   DATA DIVISION.
   FILE SECTION.
   WORKING-STORAGE SECTION.

   PROCEDURE DIVISION.
   MAIN-PROCEDURE.
  D    DISPLAY "This is a debugging line before the real logic!!"
       DISPLAY "This is what is expected a text!"
  D    DISPLAY "This is a debugging line AFTER the real logic!!"
       STOP RUN.
   END PROGRAM TESTPROGRAM01.

I get cobc.exe from the installation of OpenCobol IDE on Windows 10