gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] Preliminary results on gdb support


From: Joseph James Frantz (Aoirthoir)
Subject: Re: [open-cobol-list] Preliminary results on gdb support
Date: Wed, 10 Jun 2009 13:43:17 -0400

Jeff,

Rick in our add1tocobol chat room was talking about this yesterday. The GDB is different from the
debuggers I was used to coming up, so I don't follow a lot of what yall are doing. But I wanted to
let you know that among our crew at least, there is excitement about what you're doing. Hope
to see you again soon in chat.

Kind Regards,
Joseph James Frantz

On Tue, Jun 9, 2009 at 8:23 PM, Jeff Chimene <address@hidden> wrote:
On 06/09/2009 05:10 PM, Jeff Chimene wrote:
> Hi,
>
> I have some preliminary results on adding debugging support to OC.
>
> I'd like to get some feedback from the list as to whether it's worth
> pursuing.
>
> This work is based on OC v 1.0. If it's worth continuing, it can't be
> too difficult to port to 1.1
>
> Consider the following COBOL program:
>        PROGRAM-ID.      prog.
>        DATA             DIVISION.
>        WORKING-STORAGE  SECTION.
>        01 G             VALUE "012345678".
>          02 X           PIC X OCCURS 4.
>          02 Z           PIC X OCCURS 1 TO 4.
>        01 H                PIC 99.
>          88 myriad        value 1, 3, 9 thru 16, 17, 25 thru 50.
>        PROCEDURE        DIVISION.
>            DISPLAY X((3 + 1) / 2) NO ADVANCING.
>            DISPLAY X(2 ** 2) NO ADVANCING.
>            DISPLAY Z(1).
>
>            STOP RUN.
>
> Here is a sample run using a simple gdb user-defined command "view"
> (See below)
>
> $ gdb hello
> Breakpoint 1 at 0x8048b5f: file /home/jchimene/hello.cob, line 11.
> <=== This breakpoint is set in a project-specific .gdbinit: "break
> hello.cob:11"
> (gdb) run
>
> Breakpoint 1, prog_ (entry=0) at /home/jchimene/hello.cob:11
> 11                 DISPLAY X((3 + 1) / 2) NO ADVANCING.
>

Change the following "X" to "G"

> (gdb) view "X" <=== Notice the quotation marks
> $1 = (unsigned char *) 0x8049360 "01234567"
>
> (gdb) view "H"
> $2 = (unsigned char *) 0x8049350 "00"
>
> (gdb) quit
>
> The simple way to view COBOL data items is based on the following:
>
> Modify cobc to take the information from the CB_FIELD structure and
> convert it to the following structure:
>
>    static struct symtab {
>         char const         *cobname;
>         unsigned char    *cname;
>    }
>
> This structure is defined and initialized in the program's .h file
> (e.g. hello.c.h)
>
>    static struct symtab {
>         char const         *cobname;
>         unsigned char    *cname;
>    } st[] = { { "X", b_5 }, {"H", b_8}, {'\0'} }

Change the "X" above to "G"

>
> The scope of the variables defined in the .h file is the
> compiler-generated routine "prog_()". This is rather mysterious;
> there's no good way to /a priori/ set COBOL-specific breakpoints [*].
> For now, it looks like an inspection of the C source combined with a
> project-specific .gdbinit is the solution.
>
> ----------
> [*]
>
>    i.e. a BREAK MAIN produces no useful work as this is the runtime
>    entry point; which is not the same as the start of the procedure
>    division. There doesn't seem to be a good way to always identify the
>    start of the procedure division. I'm probably missing something
> obvious.
>
> The next modification involves a gdb initialization file that searches
> the structure on COBNAME then prints the corresponding CNAME. This
> user-defined command is defined in a project-independent
> $HOME/.gdbinit (or wherever it is for Windows users)
>
>    define view
>         set $r0 = 0
>         set $r1 = st[$r0].cobname
>         while ($r1 > 0)
>             if (0 == strcmp($r1,$arg0))
>                 print st[$r0].cname
>             end
>             set $r0 = $r0 + 1
>             set $r1 = st[$r0].cobname
>         end
>
> The big issue right now is to extend the SYMTAB structure
> initialization to handle the various ways that cobc implements (record
> definition vs. working storage vs. constants) and declares COBOL data
> items (integer, float, &c). The controlling logic is fairly complex,
> and I don't know if duplicating it for the purposes of creating the
> SYMTAB structure will be a useful task.

Another, big(ger) issue is to add support for child fields.


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list



--
Joseph James Frantz
(Aoirthoir)

http://www.add1tocobol.com
Regular add1tocobol meetings:
Where: FREENODE IRC
Channel: #add1tocobol
Access from the web: http://www.add1tocobol.com/chat.php
Date: Sundays
Time: 9:00am Eastern

::::::::NOTE IMPORTANT::::::::::
There has been some confusion as to the time. I believe this is because the United States uses Daylight Savings Time. On top of this the Government recently extended the dates that EDT (eastern daylight time) would run. So to be sure that you make it at 9am Eastern, I have this link:

http://www.timeanddate.com/worldclock/city.html?n=179

That shows the time in New York City at the moment of viewing. It also explains the current UTC offset for the Eastern Zone in the United States. Simply compare the current time that site states, with your current time and you will know how far off we are from you.
::::::::::::::::::::::::::::::::

We're there all of the time, even when we do not have a meeting. Stop on by for Open Cobol Support and chat.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]