comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: debugging GNAT programs
Date: 5 Mar 1995 10:42:29 -0500
Date: 1995-03-05T10:42:29-05:00	[thread overview]
Message-ID: <3jcm55$sjb@gnat.cs.nyu.edu> (raw)
In-Reply-To: 3j85fv$31s@newssvr.cacd.rockwell.com

The GNAT compiler does NOT generate intermediate C code in either external
source form, or in internal intermediate form. Instead it transforms the
Ada structures to RTL using the GCC Tree, which is capable of representing
semantic structures not representable into C. Translating Ada into C is
a hard task, which involves some fundamental inefficiencies, and it is not
a task that GNAT attempts or has ever attempted. I know a lot of people
get confused on this issue, partly because of the historical meaning of
GCC (GNU C Compiler), partly because of the name GNAT (... Translator),
and partly because, we see now! of the main program.

The main program that is generated by the binder is indeed in C currently,
and it is compiled using the C compiler. It contains nothing more than a series
of elaboration calls and the call to the main program.

On our list of things to do is to have an option saying whether the main
program is to be generated in Ada or C, but that's not done yet!

Anyway, the idea that GDB debugs the generated C code is completely wrong
(unless of course you are debugging the generated main elabroation program).

What *is* true is that gdb thinks it is debugging C code and does not know
anything about Ada. Since the generated Ada code is pretty similar to C code,
this works pretty well (but you have to use && instead of and then when you
type an expression!), and the data structures correspond *pretty* well so
you can definitely do a lot debugging with gdb. THe source positions *do*
properly correspond to the original Ada source code, so the source debugging
works fine.

You do have to know the naming convention (fully qualified names, forced
to lower case, with periods replaced by double underscores). See the
documentation that comes with GNAT for more details.

Obviously it would be nice if gdb knew more about Ada, and Paul Hilfinger
is currently working on a project with gdb to teach it to be more polite
in an Ada environment, but meanwhile, it is definitely a useful tool for
debugging GNAT, the GNAT development team has been using it for this purpose
for nearly two years.

Robert




  reply	other threads:[~1995-03-05 15:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-02 14:52 debugging GNAT programs Marc Graham
1995-03-02 16:52 ` Robert A Duff
1995-03-03  2:47   ` Pug 156
1995-03-04  4:26     ` Tom Griest
1995-03-05 19:20       ` Bernard Banner
1995-03-06 19:34         ` Tom Griest
1995-03-02 22:23 ` Keith Thompson
1995-03-03 22:33   ` Robert S. White
1995-03-05 15:42     ` Robert Dewar [this message]
1995-03-05 15:52     ` Robert Dewar
1995-03-06  0:38       ` kkrieser
1995-03-06 15:14       ` Robert S. White
1995-03-03  4:57 ` Vladimir Vukicevic
1995-03-04 14:07   ` Cyrille Comar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox