comp.lang.ada
 help / color / mirror / Atom feed
From: wrostek <wolfgang.rostek@gmx.de>
Subject: Re: Injecting trace code under GNAT
Date: Mon, 22 Jul 2013 23:59:57 -0700 (PDT)
Date: 2013-07-22T23:59:57-07:00	[thread overview]
Message-ID: <38da123d-4b6d-4f93-a013-11bb5b1e2727@googlegroups.com> (raw)
In-Reply-To: <07cb9baf-902c-4870-bfd1-aa8018e9d5c5@googlegroups.com>

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.

  parent reply	other threads:[~2013-07-23  6:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-17  7:33 Injecting trace code under GNAT wrostek
2013-07-17  8:00 ` Georg Bauhaus
2013-07-17  8:40   ` wrostek
2013-07-17  8:15 ` Niklas Holsti
2013-07-17 23:38 ` Randy Brukardt
2013-07-18  6:03 ` J-P. Rosen
2013-07-23  6:59 ` wrostek [this message]
2013-07-23 13:43   ` Marc C
2013-07-23 15:44     ` wrostek
2013-07-24  9:10       ` wrostek
replies disabled

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