From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cd24ffa36ebe3ef6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-05 07:42:29 PST Path: nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!news.mathworks.com!panix!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: debugging GNAT programs Date: 5 Mar 1995 10:42:29 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3jcm55$sjb@gnat.cs.nyu.edu> References: <1995Mar2.095243.14051@sei.cmu.edu> <3j85fv$31s@newssvr.cacd.rockwell.com> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1995-03-05T10:42:29-05:00 List-Id: 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