Code/Object analyzer for fixing

S

Software

Hi,

I'm looking for a tool to analyze a project's code or object files
(lots of .c and .h files) so that I can do a good
redesign/refactoring.

- I need to see how many global variables I have lingering around. Get
rid of as many as possible.
- I need to get a list of all #defined macros, constants
- I need to get a list of all variables (local or global) of a certain
type, defined in my directory tree.

I would appreciate if you can point me to a tool that would save my
time and patience.

Thanks in advance
 
I

Ira Baxter

Software said:
I'm looking for a tool to analyze a project's code or object files
(lots of .c and .h files) so that I can do a good
redesign/refactoring.

- I need to see how many global variables I have lingering around. Get
rid of as many as possible.
- I need to get a list of all #defined macros, constants
- I need to get a list of all variables (local or global) of a certain
type, defined in my directory tree.

I would appreciate if you can point me to a tool that would save my
time and patience.

The DMS Software Reengineering toolkit could be used to do this.
It has a full C front end, can be configured to extract the data
you describe, and more importantly, can carry out custom
transformations based on the analyses.
See http://www.semanticdesigns.com/Products/DMS/DMSToolkit.html.
 
R

Rob Thorpe

Hi,

I'm looking for a tool to analyze a project's code or object files
(lots of .c and .h files) so that I can do a good
redesign/refactoring.

I don't know of any freely available tool that can do this.
There are some ways you can do some of these things without a tool.
Depending on how complex your project is they may be useful.
- I need to see how many global variables I have lingering around. Get
rid of as many as possible.

There are two ways to do this.
Firstly: search for declarations made with "extern" this works but
doesn't spot spurious globals that aren't used elsewhere
Secondly: Compile with debugging symbols, then look at the
global symbols in the executable. In many systems there is
a
tool to list symbols, e.g. "nm" in Unix like systems.
This method is probably more bother.
- I need to get a list of all #defined macros, constants

All defined macros can be found by a text search, by searching for
"#define"
or something similar across all your source files.
Constants are harder.
- I need to get a list of all variables (local or global) of a certain
type, defined in my directory tree.

This might be possible by listing debugging symbols.
I would appreciate if you can point me to a tool that would save my
time and patience.

This probably isn't the group where people are most knowledgable about
this. But I can't think where would be the best place to ask.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top