comp.lang.ada
 help / color / mirror / Atom feed
* Source Analysis Tools for Ada95
@ 2003-04-26  0:07 Dr. Anthony Probe
  2003-04-26  2:21 ` Steve
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Dr. Anthony Probe @ 2003-04-26  0:07 UTC (permalink / raw)


I've got a little project to clean up 4M lines of Ada95.  Code has
been in maintenance for years and is a bit weedy.  First task is to
remove all unused source code (not just comp units).  I can probably
do most of this with some scripts and existing compiler tools, but I
wondered if any one here has experience with any other tools (both
commercial and free) that would help automate this tedious task. 
Subsequent tasks are to clean up the code to make it more maintainable
and code review for latent bugs.  So, I'm also seeking info on other
analysis tools that don't get in your way but actually help this labor
intensive IV&V task.

Tony

email: tony@probepak.com
web:   http://www.probepak.com



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

* Re: Source Analysis Tools for Ada95
  2003-04-26  0:07 Source Analysis Tools for Ada95 Dr. Anthony Probe
@ 2003-04-26  2:21 ` Steve
  2003-04-26 22:34   ` Dr. Anthony Probe
  2003-04-27 18:49   ` tmoran
  2003-04-27  2:36 ` Alex Gibson
  2003-04-27 16:43 ` Dr. Michael Paus
  2 siblings, 2 replies; 12+ messages in thread
From: Steve @ 2003-04-26  2:21 UTC (permalink / raw)


Gnat includes "gnatelim" which generates a list of gnat specific pragmas
causing no object code to be built for dead code.  You should be able to use
this as a starting point for deleting unused code.

Steve
(The Duck)


"Dr. Anthony Probe" <tony@probepak.com> wrote in message
news:7fc0d0f7.0304251607.efb4d7b@posting.google.com...
> I've got a little project to clean up 4M lines of Ada95.  Code has
> been in maintenance for years and is a bit weedy.  First task is to
> remove all unused source code (not just comp units).  I can probably
> do most of this with some scripts and existing compiler tools, but I
> wondered if any one here has experience with any other tools (both
> commercial and free) that would help automate this tedious task.
> Subsequent tasks are to clean up the code to make it more maintainable
> and code review for latent bugs.  So, I'm also seeking info on other
> analysis tools that don't get in your way but actually help this labor
> intensive IV&V task.
>
> Tony
>
> email: tony@probepak.com
> web:   http://www.probepak.com





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

* Re: Source Analysis Tools for Ada95
  2003-04-26  2:21 ` Steve
@ 2003-04-26 22:34   ` Dr. Anthony Probe
  2003-04-27  6:26     ` Simon Wright
  2003-04-27 18:49   ` tmoran
  1 sibling, 1 reply; 12+ messages in thread
From: Dr. Anthony Probe @ 2003-04-26 22:34 UTC (permalink / raw)


> Gnat includes "gnatelim" which generates a list of gnat specific pragmas
> causing no object code to be built for dead code.  You should be able to use
> this as a starting point for deleting unused code.

Wouldn't a compiler only detect the obvious dead code (that which
isn't used from just analyzing the comp unit?

I had planned on generating a list of subprograms that are actually
used (that is referenced from the main subprogram, or the elaboration
code for with'd library units in a transitive fashion).  I can get
this list from the binaries that are produced from the code.

So, the first task is to remove all subprograms and hopefully any
static data that are not included in any of the executables.

Then, if I eliminate unused withs, this might cut the size down some
more and repeat the elimination of unused subprograms.

The point of this exercise is that a 1M line system is easier to
maintain than a 1M line system with 3M lines of unused code sprinkled
throughout the system.

Then we plan on doing code review/analysis on the remaining used code.

I would gladly pay for a real tool that eliminates unused code (or
makes the process more painless), but I can certainly write my own
scripts to do this job.  After that, I am looking for any tools that
have proven to help do meaningful code cleanup and analysis.

Anyway, I'll certainly be running the code through various compilers
to see what they tell me.

Any other specific recommendations for other tools?

Tony



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

* Re: Source Analysis Tools for Ada95
  2003-04-26  0:07 Source Analysis Tools for Ada95 Dr. Anthony Probe
  2003-04-26  2:21 ` Steve
@ 2003-04-27  2:36 ` Alex Gibson
  2003-04-27 19:56   ` Peter Richtmyer
  2003-04-27 16:43 ` Dr. Michael Paus
  2 siblings, 1 reply; 12+ messages in thread
From: Alex Gibson @ 2003-04-27  2:36 UTC (permalink / raw)



"Dr. Anthony Probe" <tony@probepak.com> wrote in message
news:7fc0d0f7.0304251607.efb4d7b@posting.google.com...
> I've got a little project to clean up 4M lines of Ada95.  Code has
> been in maintenance for years and is a bit weedy.  First task is to
> remove all unused source code (not just comp units).  I can probably
> do most of this with some scripts and existing compiler tools, but I
> wondered if any one here has experience with any other tools (both
> commercial and free) that would help automate this tedious task.
> Subsequent tasks are to clean up the code to make it more maintainable
> and code review for latent bugs.  So, I'm also seeking info on other
> analysis tools that don't get in your way but actually help this labor
> intensive IV&V task.
>
> Tony
>
> email: tony@probepak.com
> web:   http://www.probepak.com

These guys provide tools for quite a few languages.
Used their fortran tool but only for a small project
http://www.scitools.com/
http://www.scitools.com/downloadada.shtml

Pricing for fortran version understand seems to be around UK 500 pounds.
(price from Salford software web page)

Alex





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

* Re: Source Analysis Tools for Ada95
  2003-04-26 22:34   ` Dr. Anthony Probe
@ 2003-04-27  6:26     ` Simon Wright
  2003-04-27 15:15       ` Jano
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Wright @ 2003-04-27  6:26 UTC (permalink / raw)


tony@probepak.com (Dr. Anthony Probe) writes:

> > Gnat includes "gnatelim" which generates a list of gnat specific
> > pragmas causing no object code to be built for dead code.  You
> > should be able to use this as a starting point for deleting unused
> > code.
> 
> Wouldn't a compiler only detect the obvious dead code (that which
> isn't used from just analyzing the comp unit?

I have never used gnatelim, because the one time I tried it took a
long time (this was a few years ago) and I didn't really have a
problem anyway. But its intention is to find and mark those
subprograms (?and other constructs?) that aren't used in the
closure. Sounds like what you're after!

You need to get the binary distribution, because gnatelim isn't built
as part of the compiler (I believe it's an ASIS application).

Quotation from the 3.14p GNAT user's guide:

   When a program shares a set of Ada packages with other programs, it
   may happen that this program uses only a fraction of the
   subprograms defined in these packages. The code created for these
   unused subprograms increases the size of the executable.

   gnatelim tracks unused subprograms in an Ada program and outputs a
   list of GNAT-specific Eliminate pragmas (see next section) marking
   all the subprograms that are declared but never called. By placing
   the list of Eliminate pragmas in the GNAT configuration file
   `gnat.adc' and recompiling your program, you may decrease the size
   of its executable, because the compiler will not generate the code
   for 'eliminated' subprograms.

   The simplified syntax of the Eliminate pragma used by gnatelim is:

   pragma Eliminate (Library_Unit_Name, Subprogram_Name);

   where

   Library_Unit_Name
      full expanded Ada name of a library unit
   
   Subprogram_Name
      a simple or expanded name of a subprogram declared within this
      compilation unit


Also, -gnatwu will warn of unused entities, including withed units. I
think this is GNAT 3.15p or later. (we use -gnatwaL, switch on all
warnings except elaboration ordering).



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

* Re: Source Analysis Tools for Ada95
  2003-04-27  6:26     ` Simon Wright
@ 2003-04-27 15:15       ` Jano
  2003-04-27 21:32         ` Frode Tennebø
  0 siblings, 1 reply; 12+ messages in thread
From: Jano @ 2003-04-27 15:15 UTC (permalink / raw)


Simon Wright dice...
> tony@probepak.com (Dr. Anthony Probe) writes:
> 
> > > Gnat includes "gnatelim" which generates a list of gnat specific
> > > pragmas causing no object code to be built for dead code.  You
> > > should be able to use this as a starting point for deleting unused
> > > code.
> > 
> > Wouldn't a compiler only detect the obvious dead code (that which
> > isn't used from just analyzing the comp unit?
> 
> I have never used gnatelim, because the one time I tried it took a
> long time (this was a few years ago) and I didn't really have a
> problem anyway. But its intention is to find and mark those
> subprograms (?and other constructs?) that aren't used in the
> closure. Sounds like what you're after!

My two experiences with gnatelim were a bit disappointing. I don't know 
if I did something wrong, but in both cases Gnat tried to remove 
subprograms who where actually being called.

-- 
-------------------------
Jano
402450.at.cepsz.unizar.es
-------------------------



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

* Re: Source Analysis Tools for Ada95
  2003-04-26  0:07 Source Analysis Tools for Ada95 Dr. Anthony Probe
  2003-04-26  2:21 ` Steve
  2003-04-27  2:36 ` Alex Gibson
@ 2003-04-27 16:43 ` Dr. Michael Paus
  2 siblings, 0 replies; 12+ messages in thread
From: Dr. Michael Paus @ 2003-04-27 16:43 UTC (permalink / raw)


Dr. Anthony Probe wrote:
> I've got a little project to clean up 4M lines of Ada95.  Code has
> been in maintenance for years and is a bit weedy.  First task is to
> remove all unused source code (not just comp units).  I can probably
> do most of this with some scripts and existing compiler tools, but I
> wondered if any one here has experience with any other tools (both
> commercial and free) that would help automate this tedious task. 
> Subsequent tasks are to clean up the code to make it more maintainable
> and code review for latent bugs.  So, I'm also seeking info on other
> analysis tools that don't get in your way but actually help this labor
> intensive IV&V task.

Have a look here.

http://www.scitools.com/uada.html

This is a quite nice tool and may be exactly what you
need. There is also a free evaluation version available so you can give it
a try with your project.

Michael




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

* Re: Source Analysis Tools for Ada95
  2003-04-26  2:21 ` Steve
  2003-04-26 22:34   ` Dr. Anthony Probe
@ 2003-04-27 18:49   ` tmoran
  1 sibling, 0 replies; 12+ messages in thread
From: tmoran @ 2003-04-27 18:49 UTC (permalink / raw)


>Gnat includes "gnatelim" which generates a list of gnat specific pragmas
>causing no object code to be built for dead code.  You should be able to use
>this as a starting point for deleting unused code.
  The Janus compiler can generate a link time map showing which routines
it is trimming out because they are unused.  A recent improvement includes
trimming unused primitive routines for tagged type.  I don't know if
gnatelim can do that.



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

* Re: Source Analysis Tools for Ada95
  2003-04-27  2:36 ` Alex Gibson
@ 2003-04-27 19:56   ` Peter Richtmyer
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Richtmyer @ 2003-04-27 19:56 UTC (permalink / raw)


"Alex Gibson" <alxx@ihug.com.au> wrote in message news:<b8fg99$jak$1@lust.ihug.co.nz>...
> 
> These guys provide tools for quite a few languages.
> Used their fortran tool but only for a small project
> http://www.scitools.com/
> http://www.scitools.com/downloadada.shtml
> 

We are using Understand for Ada ("U4A"). I love it. Used it to 
analyze some software we were given as a potential baseline. U4A was 
very helpful in tracing through the foreign code and analyzing 
what it did. (Figuring out "why" it did it was harder. Good
comments would have helped.   :-)

Now I am using U4A to "understand" the code I wrote instead
of using the code we were given.  :-)

It helps me find stuff I put in that is no longer needed, etc.

Get a free demo license and give it a ride. Don't forget to 
generate the "Reports" and look at them.

enjoy ...
Peter



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

* Re: Source Analysis Tools for Ada95
  2003-04-27 15:15       ` Jano
@ 2003-04-27 21:32         ` Frode Tennebø
  2003-04-28 18:51           ` Jano
  0 siblings, 1 reply; 12+ messages in thread
From: Frode Tennebø @ 2003-04-27 21:32 UTC (permalink / raw)


On Sunday 27 April 2003 17:15 Jano wrote:

> My two experiences with gnatelim were a bit disappointing. I don't
> know if I did something wrong, but in both cases Gnat tried to remove
> subprograms who where actually being called.

I have seen that too, but the number was very low compared to the number
of subprograms it eliminated and the compiler/linker gave ample warning
that I was trying to elimiate used subprograms. Obviously a bug
somewhere, but not a show-stopper.

 -Frode

-- 
^ Frode Tenneb� | email: frode@tennebo.com | Frode@IRC ^
|  with Standard.Disclaimer; use Standard.Disclaimer;  |



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

* Re: Source Analysis Tools for Ada95
  2003-04-27 21:32         ` Frode Tennebø
@ 2003-04-28 18:51           ` Jano
  0 siblings, 0 replies; 12+ messages in thread
From: Jano @ 2003-04-28 18:51 UTC (permalink / raw)


Frode =?ISO-8859-1?Q?Tenneb=F8?= dice...
> On Sunday 27 April 2003 17:15 Jano wrote:
> 
> > My two experiences with gnatelim were a bit disappointing. I don't
> > know if I did something wrong, but in both cases Gnat tried to remove
> > subprograms who where actually being called.
> 
> I have seen that too, but the number was very low compared to the number
> of subprograms it eliminated and the compiler/linker gave ample warning
> that I was trying to elimiate used subprograms. Obviously a bug
> somewhere, but not a show-stopper.

That's my experience, too.

-- 
-------------------------
Jano
402450.at.cepsz.unizar.es
-------------------------



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

* RE: Source Analysis Tools for Ada95
@ 2003-04-29 17:37 Lionel.DRAGHI
  0 siblings, 0 replies; 12+ messages in thread
From: Lionel.DRAGHI @ 2003-04-29 17:37 UTC (permalink / raw)
  To: comp.lang.ada

| -----Message d'origine-----
| De: Frode Tennebø [mailto:frode@tennebo.com]
...
| I have seen that too, but the number was very low compared to 
| the number
| of subprograms it eliminated and the compiler/linker gave 
| ample warning
| that I was trying to elimiate used subprograms. Obviously a bug
| somewhere, but not a show-stopper.
Not really a bug, as the documentation warn you that this may appen.

Nevertheless, during my try the number of subprogram marked as removable
that where actually not was to high to consider this tool handy.

-- 
Lionel Draghi.



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

end of thread, other threads:[~2003-04-29 17:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-26  0:07 Source Analysis Tools for Ada95 Dr. Anthony Probe
2003-04-26  2:21 ` Steve
2003-04-26 22:34   ` Dr. Anthony Probe
2003-04-27  6:26     ` Simon Wright
2003-04-27 15:15       ` Jano
2003-04-27 21:32         ` Frode Tennebø
2003-04-28 18:51           ` Jano
2003-04-27 18:49   ` tmoran
2003-04-27  2:36 ` Alex Gibson
2003-04-27 19:56   ` Peter Richtmyer
2003-04-27 16:43 ` Dr. Michael Paus
  -- strict thread matches above, loose matches on Subject: below --
2003-04-29 17:37 Lionel.DRAGHI

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