gdb
[Top][All Lists]
Advanced

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

Question for getting GNU Cobol work with GDB


From: Simon Sobisch
Subject: Question for getting GNU Cobol work with GDB
Date: Mon, 07 Oct 2013 23:33:40 +0200
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

Hi co-hackers,

GNU Cobol (formerly OpenCOBOL) translates COBOL to C (compiling it with GCC).
We try to use GDB as debugging frontend but are unsure how some points can be 
reached without actually patching the GDB (if it's possible at all).
As one of the maintainers of GNU Cobol I write to you with the hope that we can 
get as far as possible.

A sample is attached, snippets:

HELLO.cob:

              INSPECT user-input REPLACING TRAILING SPACES BY LOW-VALUE
              MOVE SPACES TO output-msg
              STRING 'Hello "'  DELIMITED BY SIZE
                     user-input DELIMITED BY LOW-VALUE
                     '"!'       DELIMITED BY SIZE
                     INTO output-msg
              END-STRING

HELLO.c[h,l.h]

static cob_field f_6    = {80, b_6, &a_1};  /* output-msg */
static cob_field f_7    = {50, NULL, &a_1}; /* user-input */

static int
HELLO_ (const int entry)


        // [...]

        unsigned char   *b_7 = NULL;    /* user-input */

        // [...]

        /* HELLO.cob:23: INSPECT */

        cob_set_location ("HELLO", "HELLO.cob", 23, "MAIN SECTION", "MAIN PARAGRAPH", 
"INSPECT");
        {
          cob_inspect_init ((f_7.data = b_7, &f_7), 1);
          cob_inspect_start ();
          cob_inspect_trailing (&cob_low, &cob_space);
          cob_inspect_finish ();
        }
        /* HELLO.cob:24: MOVE */
        cob_set_location ("HELLO", "HELLO.cob", 24, "MAIN SECTION", "MAIN PARAGRAPH", 
"MOVE");
        {
          memset (b_6, 32, 80);
        }
        /* HELLO.cob:25: STRING */
        cob_set_location ("HELLO", "HELLO.cob", 25, "MAIN SECTION", "MAIN PARAGRAPH", 
"STRING");
        {
          cob_string_init (&f_6, 0);
          cob_string_delimited (0);
          cob_string_append (&c_3);
          cob_string_delimited (&cob_low);
          cob_string_append ((f_7.data = b_7, &f_7));
          cob_string_delimited (0);
          cob_string_append (&c_4);
          cob_string_finish ();
        }

        // [...]
}

Not clear is how to
- let the programmer see only the COBOL source, not the C source, while stepping
- let the programmer view/change/... COBOL variables (there is a mapping like 
you can see above)
- set breakpoints within the COBOL source

We're free to add directives and other necessary stuff into the generated C files, even 
performing "stuff" at runtime, if this helps.

Thank you for your answers,
Simon Sobisch

Attachment: HELLO.c.h
Description: Text document

Attachment: HELLO.c.l.h
Description: Text document

Attachment: HELLO.cob
Description: Text document

Attachment: HELLO.c
Description: Text document


reply via email to

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