comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent.Guerby@enst-bretagne.fr (Laurent Guerby)
Subject: IO in Pure packages, debugging
Date: 1996/03/26
Date: 1996-03-26T00:00:00+00:00	[thread overview]
Message-ID: <4xivfrimzk.fsf_-_@leibniz.enst-bretagne.fr> (raw)
In-Reply-To: dewar.827846300@schonberg

[subject changed]

Robert A Duff writes
: 
: In article <4xspevde88.fsf@leibniz.enst-bretagne.fr>,
: Laurent Guerby <Laurent.Guerby@enst-bretagne.fr> wrote:
: >   Here is a simple solution to this kind of problem :
: >
: >package Pure_IO is
: >   pragma Pure;
: >
: >   procedure Debug (Msg : in String);
: >   pragma Import (C, Debug);
: >
: >end Pure_IO;
: >
: >   Then do the dirty work  (body) in Ada (convention C)  or C.
: 
: Excellent idea!  Thanks.
: 
: Does it really work?  I mean you're sort of cheating here.  

   That's more that cheating, I play a "pervert" game here ;-)

: You've declared that the thing is Pure, but you've lied.  So the optimizer
: might play nasty tricks, like eliminating calls to Debug, if the only
: effect of Debug is its "side effect".
: I guess it's OK to cheat like that, since it's "merely" debugging code.
: But one has to be careful, in case one's optimizer is smarter that one
: is ;-).

   Just  put  "in  out"  instead   of "in"  to   avoid  this kind   of
optimization (but then you havve  to declare the messages as variables
somewhere, no big deal).

: >   It's true that the current GDB-GNAT has some weakpoints, but if you
: >add to your code (instead of plenty ugly "with Text_IO; Put_Line ...")
: >some "extra" procedures to set up complex data structures and to print
: >them (just like in the GNAT code anyway) it works quite well
: 
: Yes, I do add all kinds of printing routines, and call them from gdb
: when necessary.  My version of gdb, which might not be the latest,
: doesn't even know how to print strings.  It prints a pair of addresses,
: instead of the characters of the string.

   Just update it (20 minutes of compilation  ;-). The current version
is quite efficient,  the only problem is  for tagged types, but if you
have written some dump routines there's  no problem at all (worked for
me for tagged + tasking + multiple partitions).

[deleted]

: Thanks for the help.
: 
: - Bob

-- 
--  Laurent Guerby, student at Telecom Bretagne (France), Team Ada
--  "Use the Source, Luke. The Source will be with you, always (GPL)"
--  http://www-eleves.enst-bretagne.fr/~guerby/ (GATO Project)
--  Try GNAT, the GNU Ada 95 compiler (ftp://cs.nyu.edu/pub/gnat)




  parent reply	other threads:[~1996-03-26  0:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <314701A1.469D@lfwc.lockheed.com>
1996-03-15  0:00 ` Elaboration order Robert I. Eachus
1996-03-15  0:00   ` Robert Dewar
     [not found] ` <1996Mar14.021345.9856@enterprise.rdd.lmsc.lockheed.com>
     [not found]   ` <314829CD.4FA9@lfwc.lockheed.com>
1996-03-15  0:00     ` Tucker Taft
1996-03-15  0:00       ` Ken Garlington
1996-03-16  0:00     ` Ted Dennison
1996-03-16  0:00     ` Joe Wierzbowski
1996-03-26  0:00       ` AdaWorks
1996-03-26  0:00         ` Robert A Duff
1996-03-26  0:00         ` Robert Dewar
1996-03-26  0:00           ` Robert A Duff
1996-03-26  0:00             ` Robert Dewar
1996-03-26  0:00           ` Laurent Guerby [this message]
1996-03-26  0:00     ` Laurent Guerby
1996-03-26  0:00       ` Robert A Duff
1996-03-18  0:00 ` Ted Dennison
1996-03-18  0:00 ` Ken Garlington
1996-03-19  0:00 ` Michel Gauthier
1996-03-20  0:00 ` DenReimer
1996-03-20  0:00   ` Tucker Taft
1996-03-20  0:00   ` Norman H. Cohen
1996-03-20  0:00   ` Robert A Duff
1996-03-20  0:00     ` Norman H. Cohen
1996-03-20  0:00       ` Robert Dewar
     [not found] ` <Do8JDv.A2v@world.std.com>
     [not found]   ` <31494143.3825@lfwc.lockheed.com>
1996-03-15  0:00     ` Robert A Duff
1996-03-18  0:00       ` Norman H. Cohen
     [not found]       ` <EACHUS.96Mar18143219@spectre.mitre.org>
1996-03-18  0:00         ` Robert Dewar
1996-03-19  0:00           ` Ted Dennison
1996-03-18  0:00         ` Robert Dewar
1996-03-20  0:00         ` David Emery
1996-03-15  0:00     ` Mark A Biggar
1996-03-18  0:00       ` Ken Garlington
1996-03-19  0:00         ` Chris McKnight
1996-03-21  0:00           ` Ken Garlington
1996-03-19  0:00         ` Norman H. Cohen
1996-03-20  0:00           ` Cordes MJ
1996-03-19  0:00             ` Robert Dewar
1996-03-21  0:00               ` Ken Garlington
1996-03-21  0:00               ` Cordes MJ
1996-03-20  0:00             ` Robert A Duff
1996-03-20  0:00               ` Cordes MJ
1996-03-20  0:00                 ` Robert A Duff
1996-03-22  0:00                   ` Cordes MJ
1996-03-20  0:00                 ` Robert Dewar
1996-03-21  0:00                   ` Ken Garlington
1996-03-23  0:00                 ` JP Thornley
1996-03-25  0:00                   ` Robert Dewar
1996-03-26  0:00                 ` JP Thornley
1996-03-20  0:00   ` Robert I. Eachus
1996-03-22  0:00   ` Robert I. Eachus
1996-03-22  0:00   ` Robert I. Eachus
replies disabled

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