C code analysing tool

C code analysing tool

Post by kaza » Sat, 13 May 2006 06:03:45

I am looking for C code analysing tool,

My problem is:
To discover the portion of code that depends on(deals with) a number
of specified structures and variables.

void funct(struct header* h)

memcpy(buff,h,sizeof(struct header));
a kind of other code....

The idea is to detect all the code that depends on or deals with "h"

Do you know the tools that can solve the problem?

Thanks a lot.

C code analysing tool

Post by Davi » Sun, 14 May 2006 01:51:28

Hello Andrey,

<sample snipped>

Code that deals with "h" may be found by your IDE if you load all
the source into your project. Your code repository might also
have some search capabilities.

If all else fails use grep or a similar search utility to find
all of the code that has the "h" in it. Naturally searching for
such a short name would certainly be helped by a search tool that
has a "complete word" search capability.

This is just the first step in the process. Then you have to look
at all those references and find those that are of the value you
are looking for. Then examine all the code in that scope for
relevant references, copies, void pointers, and other ways to
use the value. Keep searching recursively as you find how this
value is used.

Now you most likely have all the code that deals with your
value and you can start to answer your original question of
what code actually deals with the value.

A decent IDE, text processor, and search tool are useful computer
tools for the task. Your brain, memory, and time are the most
useful. Good documentation and notes might have answered the
question for you, but keeping that up-to-date and trusdting that
it is up-to-date can be a problem too.



C code analysing tool

Post by Derek M. J » Sun, 14 May 2006 04:31:14

The phrase you need to search on is "program slicing".

One such tool can be found here:

C code analysing tool

Post by Marc » Tue, 16 May 2006 00:21:59