comp.lang.ada
 help / color / mirror / Atom feed
From: Sundog Software <sundog@MSN.FULLFEED.COM>
Subject: Re: Debug Code
Date: 1996/03/25
Date: 1996-03-25T00:00:00+00:00	[thread overview]
Message-ID: <Pine.3.89.9603251018.A23471-0100000@shell1.msn.fullfeed.com> (raw)

BD>will become a de-facto standard.  I hope.  Any other compiler vendors
BD>care to comment?

DW>While this introduces an element of non-portability, it has several
DW>benefits:
Seems like this Pragma Assert does not allow having type's and other
declarations for use only by the debug code (not present in the
release code/data).  We tend to utilize a command line switch that set's
the '@' to be treated as a space or as "--" to allow arbitrary insertions.
For example :
    Type Forward_Type_Reference Is Record
@       Old_Forward, Old_Type_Index : Type_Ptr; -- only for debuging !!
        Full_Def : Boolean;
        New_Type_Index : Type_Ptr;
        Next : Forward_Type_Ptr;
    End Record;
    ...
    Procedure Save_Forward_Type_Reference(  Full_Def : In Boolean;
                                          @ Old_Forward,
                                          @ Old_Type_Index,
                                            New_Type_Index : In Type_Ptr) Is
    ...
                Save_Forward_Type_Reference(@ Old_Forward => From.Class_Type,
                                            @ Old_Type_Index => From_Index,
                                              Full_Def => FALSE,
                                              New_Type_Index => To_Index);

>Another GNAT pragma is pragma Debug.
>        pragma Debug (procedure call);
RD>This can occur either in a declarative part or a statement part, and like
RD>pragma Assert is controlled by the -gnata switch of GNAT. If -gnata is

Declarative part for a procedure call ?

Typically my compiler debug code looks like :

@           If J2Trace.Symbol_Trace(J2Trace.J2INST) Then
@               J2Trace.Put_Line("make entry result is");
@               J2Dump_Symbols.Dump_Sym_Info(Symbol, TRUE, FALSE);
@           --Else no trace
@           End If;

or in very painfull spots nested if's (and then could be used) :
@           If J2Trace.Symbol_Trace(J2Trace.J2SYMLOA) Then
@               If J2Trace.Drastic("With_Code bottom " &
@                  Pas1Info.Get_Id(With_Info.Unit_At.Identifier)) Then
@                   J2Dump_Symbols.Dump_Symboltable(FALSE);
@               --Else skip
@               End If;
@           --Else no trace
@           End If;
Which seems like a pain to convert each of these into procedure's and rely
on code-trimming to remove the unused debug code. (On my non-RR projects the
conditional is normally not a function call so I can RELY ON CODE-TRIMMING
along with a per module trace variable that requires editing to change).
I would think that Pragma Debug would be painfull for GNAT since I am
not aware of a code trimming option or unused data optimization.


Sundog.Software@Msn.FullFeed.Com




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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-25  0:00 Sundog Software [this message]
1996-03-25  0:00 ` Debug Code Robert Dewar
     [not found] <1996Mar14.223326.13730@nosc.mil>
1996-03-15  0:00 ` Debug code David Weller
1996-03-18  0:00   ` Robert Dewar
1996-03-18  0:00     ` Robert A Duff
     [not found]       ` <dewar.827166947@schonberg>
1996-03-19  0:00         ` Norman H. Cohen
1996-03-15  0:00 ` Bob Kitzberger
  -- strict thread matches above, loose matches on Subject: below --
1996-02-27  0:00 Debug Code Jerry Blasdel
replies disabled

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