marcsosduma / cobgdb

Command-Line Debugger for GnuCOBOL on Linux and Windows
GNU General Public License v3.0
5 stars 1 forks source link

Show and Edit data with "non display format" in HEX #41

Open eugeniodilo opened 4 months ago

eugeniodilo commented 4 months ago

In a cobol program we can have numerical data in different formats: comp, binary, float etc etc COBGDB currently displays such data in a very strange format. Apparently, from Simon's indications, it is the "Octal" format. It would be very useful, if not necessary, to be able to view and edit such data in hexadecimal format. The following are screenshots of an example program In some cases I even got an error message "<incomplete sequence ... ?!?!?!

image

image

image

SAMPLE PROGRAM

       >>SOURCE FORMAT IS FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. GCOCTAL.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 random-float   usage   float-long value zero.
01 random-integer pic  99            value zero.
01 random-comp3   pic s99 comp-3     value zero.

PROCEDURE DIVISION.
    perform 3 times
         compute random-float   = FUNCTION random() * 7.0
         display random-float
         compute random-integer = random-float + 1.0
         display random-integer
         compute random-comp3   = random-float - 7
         display random-comp3
    end-perform
    accept omitted
    goback.
marcsosduma commented 1 month ago

Hello, Prof. Eugenio! I think I made some progress with handling numerical values. image

eugeniodilo commented 1 month ago

Hi, this is really good news ! I will do some tests and give you feedback shortly.

eugeniodilo commented 1 month ago

I did some tests of the new function with a program GCOCTAL.COB that I add to this post. I would say that now all the fields in "non DISPLAY" format are displayed in a very readable and easily editable way during debugging. In my opinion the ISSUE can be considered resolved.

IDENTIFICATION DIVISION.
PROGRAM-ID. GCOCTAL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01  wRnd.
    03 rnd-float   usage float-long         value zero.
    03 rnd-display pic   9999V999           value zero.
    03 rnd-comp3   pic   s99999V999 comp-3  value zero.
    03 rnd-comp5   pic   s999V99999 comp-5  value zero.
    03 rnd-binary  usage binary-long signed value zero.
PROCEDURE DIVISION.
    perform 2 times
         compute rnd-float   = FUNCTION random() * 7.456
         display '1. ' rnd-float
         compute rnd-display = rnd-float + 1.0
         display '2. ' rnd-display
         compute rnd-comp3   = rnd-float - 7
         display '3. ' rnd-comp3
         compute rnd-comp5   = rnd-float - 2.3
         display '4. ' rnd-comp5
         compute rnd-binary  = rnd-float * -1.309
         display '5. ' rnd-binary
         display '6. ' wRnd
         display space
         move zero to rnd-float rnd-display rnd-comp3 rnd-comp5 rnd-binary
    end-perform
    accept omitted
    goback.

I also attach a screenshot in which you can see that by clicking with the right mouse button on the highlighted line, a window appears with more variables than the only 2 variables present on the source line.
The 2 variables that are present in the selected source line I see that are aligned one character more to the left than the other variables.

Question 1. Why are the 2 variables present on the line displayed but also others? Question 2. with what criteria does the program also display some other variables? Question 3. Is the order in which the variables are listed in the pop-up window random? Immagine

GitMensch commented 1 month ago

for "all datatypes" you likely want to check with https://raw.githubusercontent.com/OlegKunitsyn/gnucobol-debug/master/test/resources/datatypes.cbl