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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.255.66 with SMTP id ao2mr6786254pad.30.1374562797827; Mon, 22 Jul 2013 23:59:57 -0700 (PDT) X-Received: by 10.49.40.167 with SMTP id y7mr1218399qek.36.1374562797583; Mon, 22 Jul 2013 23:59:57 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!ko2no93595013pbb.0!news-out.google.com!b2ni84830pby.1!nntp.google.com!cb17no60355qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 22 Jul 2013 23:59:57 -0700 (PDT) In-Reply-To: <07cb9baf-902c-4870-bfd1-aa8018e9d5c5@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.15.135.12; posting-account=GxWvNgoAAAAH4SakIxF38Jkeu4kDHb6i NNTP-Posting-Host: 194.15.135.12 References: <07cb9baf-902c-4870-bfd1-aa8018e9d5c5@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <38da123d-4b6d-4f93-a013-11bb5b1e2727@googlegroups.com> Subject: Re: Injecting trace code under GNAT From: wrostek Injection-Date: Tue, 23 Jul 2013 06:59:57 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:16492 Date: 2013-07-22T23:59:57-07:00 List-Id: Sorry all. I thought I was under email notification and didn't see the latest comments. Thanks for these links. Thinking about the features I need it should have been quite simple to write a quick and dirty parsing by hand. This would give me more flexibility in instrumenting the code in different sections. Mixing between generated and hand written trace statements could be easier this way as well. I decided to go with python and learn a bit more this language along the script. It took me 2 days and works quite well for me. Here my experiences. Looking at the subroutine structure I thought it must be quite easy to extract begin, end and return tokens. Almost through the implementation I encountered a wrong assumption of mine that the subroutine designatore must be repeated in the end-clause. A shame that this is optional (had in mind that this is one of the nice things Ada forces to have readable printouts) ;) But fortunately only 5 places had to be fixed to have it all over the place now. Half a day it took me to enhance parsing for more sophisticated structures. (it covers only things seen in my code base) In the end there were 3 locations remaining where the effort isn't justified to enhance the parsing further. One is a task body and two places where keywords are part of a variable/attribute. Here I use an IGNORE_ON/ IGNORE_OFF comment to skip them. I'll need the ignore anyway in the future. The script comes to some 800 lines. It is filtering 200 package bodies and 300 kloc. For now it is injecting a null statement but passes the compiler. Wolfgang R.