Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Simon Sobisch <simonsobisch@web.de>
Cc: gdb@sourceware.org
Subject: Re: Question about getting GNU Cobol work with GDB
Date: Thu, 10 Oct 2013 15:30:00 -0000	[thread overview]
Message-ID: <87k3hl87oq.fsf@fleche.redhat.com> (raw)
In-Reply-To: <5255D935.30609@web.de> (Simon Sobisch's message of "Thu, 10 Oct	2013 00:31:17 +0200")

>>>>> "Simon" == Simon Sobisch <simonsobisch@web.de> writes:

Simon> GNU Cobol (formerly OpenCOBOL) translates COBOL to C (compiling
Simon> it with GCC later on).  We try to use GDB as debugging frontend
Simon> but are unsure how some points can be reached without actually
Simon> patching the GDB (if it's possible at all).

Simon> - let the programmer see only the COBOL source, not the C source,
Simon> while stepping

I agree with the other poster who suggested #line.

Simon> - let the programmer view/change/... COBOL variables (there is a
Simon> mapping like you can see above)

I don't think this is doable with your current translation approach.

The simplest way to get this information into gdb is to write out DWARF
from your compiler.  DWARF lets you specify the names of variables and
where they live.

However, I think there's no good way to write out DWARF in the C code
your front end generates.  *Maybe* it can be done in a gross way by
emitting lots of 'asm' statements, but I am not sure whether this can be
made to work without a lot of exertion.

This sort of thing is one reason that it is generally better to write a
GCC front end than to write a translator.  This is easier than it
sounds, but of course you probably have reasons for wanting to do C
translation.

At that point you'll want to write the gdb language support...

Simon> - set breakpoints within the COBOL source

I think #line may help here as well, at least for "file:line"
breakpoints.

I don't remember enough COBOL to know whether there are named
procedures.  If there are then those will face the same conceptual
problem as variables: if the COBOL->C name mapping requires some
transformation, then users won't have a way to use to the name from
their COBOL source.

Tom


      parent reply	other threads:[~2013-10-10 15:30 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
2013-10-10 15:30   ` Tom Tromey [this message]

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=87k3hl87oq.fsf@fleche.redhat.com \
    --to=tromey@redhat.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