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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,949c9834a004313a,start X-Google-Attributes: gid103376,public From: Sundog Software Subject: Re: Debug Code Date: 1996/03/25 Message-ID: #1/1 X-Deja-AN: 144186796 sender: Ada programming language comments: Gated by NETNEWS@AUVM.AMERICAN.EDU content-type: TEXT/PLAIN; charset=US-ASCII mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-03-25T00:00:00+00:00 List-Id: 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