comp.lang.ada
 help / color / mirror / Atom feed
* Re: Debug Code
@ 1996-03-25  0:00 Sundog Software
  1996-03-25  0:00 ` Robert Dewar
  0 siblings, 1 reply; 8+ messages in thread
From: Sundog Software @ 1996-03-25  0:00 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 8+ messages in thread
* Debug Code
@ 1996-02-27  0:00 Jerry Blasdel
  0 siblings, 0 replies; 8+ messages in thread
From: Jerry Blasdel @ 1996-02-27  0:00 UTC (permalink / raw)


I am tasked to add in debugging/diagnostic code
into an existing ada application.  I would like 
to do somthing similar to a #ifdef DEBUG ... #endif
like I would do in C but I did not think that Ada 
would let  me do anything like that.  

Does anyone have any good ways to incorporate 
debug/diagnostic code that can remain in the 
source code.


Thanks,

JB.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1996-03-25  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
1996-03-25  0:00 Debug Code Sundog Software
1996-03-25  0:00 ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1996-02-27  0:00 Jerry Blasdel

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