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,9e5138de1ea5afeb,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-26 05:37:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!newsfeed.esat.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!news!not-for-mail From: Nige Newsgroups: comp.lang.ada Subject: Using controlled types to trace program execution Date: Tue, 26 Feb 2002 13:39:19 +0000 Organization: Thales Message-ID: <3C7B9007.FB5F257D@uk.thalesgroup.com> NNTP-Posting-Host: sswc014.int.rdel.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: rdel.co.uk 1014730658 7222 172.16.10.25 (26 Feb 2002 13:37:38 GMT) X-Complaints-To: postmaster@uk.thalesgroup.com NNTP-Posting-Date: 26 Feb 2002 13:37:38 GMT X-Mailer: Mozilla 4.77 [en] (X11; U; SunOS 5.6 sun4m) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:20455 Date: 2002-02-26T13:37:38+00:00 List-Id: Hi all, I am trying to come up with a way of tracing program execution using controlled types. Ie, I want to be able to declare an object as a procedure or function is entered, which would add itself to some sort of stack during it's initialization and remove itself once it goes out of scope. The benfit of this is that I would not have to explicitly have some sort of enter and exit calls whenever a subprogram is called. The problem is, that however I try to identify the declaration of the object, the compiler throws it out. The approaches I have tried are: * A controlled object with an access to a string as a discriminant. * A generic package containing a controlled type with a discrete type as a discriminant. * extending the type with a string/string access to identify it. Does anyone have any ideas how I could acomplish this or even if it is possible? I may be trying to do something that is not sensible/possible of course... Ideally I'd simply like to have: procedure Something is Here : Trace.Location ("Something"); begin null; end Something; ... where the package Trace would store the string "Something" until the object Here goes out of scope. Then at any time I can examine the contents of the stack in the package Trace... The nearest I have got is to use new to allocate strings as the objects are declared, but then the strings can't be deallocated explicitly, because the strings are not variables. eg Here : Trace.Location (new String'("Something")); Hope I've made some sense, Nige