Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Madan Teodor-TEMADAN1 <TEMADAN1@freescale.com>
To: Simon Sobisch <simonsobisch@web.de>,
	"gdb@sourceware.org"	<gdb@sourceware.org>
Subject: RE: Question about getting GNU Cobol work with GDB
Date: Thu, 10 Oct 2013 08:03:00 -0000	[thread overview]
Message-ID: <B6CD0A5F6B061F49B5DA45DABDD419230A147C20@039-SN2MPN1-011.039d.mgd.msft.net> (raw)
In-Reply-To: <5255D935.30609@web.de>

To see COBOL sources instead of generated C, you could emit #line pragma in the generated source. That should cover setting breakpoints as well.
See http://gcc.gnu.org/onlinedocs/cpp/Line-Control.html 

Teodor Madan

-----Original Message-----
From: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] On Behalf Of Simon Sobisch
Sent: Thursday, October 10, 2013 01:31
To: gdb@sourceware.org
Subject: Question about getting GNU Cobol work with GDB


[posted before to gdb@gnu.org]

Hi co-hackers,

GNU Cobol (formerly OpenCOBOL) translates COBOL to C (compiling it with GCC later on).
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






  reply	other threads:[~2013-10-10  8:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <525328B4.3020405@web.de>
2013-10-09 22:31 ` Simon Sobisch
2013-10-10  8:03   ` Madan Teodor-TEMADAN1 [this message]
2013-10-10 15:30   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B6CD0A5F6B061F49B5DA45DABDD419230A147C20@039-SN2MPN1-011.039d.mgd.msft.net \
    --to=temadan1@freescale.com \
    --cc=gdb@sourceware.org \
    --cc=simonsobisch@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox