There are several companies that sell tools that do cross-referencing,
including, in alphabetical order, McCabe and Reasoning. In addition,
there will eventually be a version of gnat that does ASIS so you can
program your own cross reference easily. And yes, global variables are
not just bad style, but they are the primary path along which bugs travel
from package to package.

At the same time as you are removing the global variables, make the
small data types all PURE, and make the large data types PREELABORABLE
be used in distributed systems. Even if you do not distribute, the bugs
you will fix in making the types limited private so the packages can be
PURE will amaze you.

That relates to the easiest way to remove the hanging pointers and
memory leakages from C and C++ and Java packages. First, convert them
to Ada limited private pure (or preelaborable for large classes) types.
Second, write a test program for the boundary conditions of each variable
in each path. Finally, after passing thoses tests, convert back to the
target language. This has worked for me many times.

Mike Brenner [log in to unmask]