Hello everyone,
I'm looking for a quick and easy way to figure out which structs and
members of structs are used by simply parsing a C program. For
instance, consider the following code:
void func(struct mystruct * arg)
{
struct myotherstruct local;
arg->member1 = 10;
local.member1 = arg->member2;
}
Here the parser program should detect that members 'member1' and
'member2' of the struct 'mystruct', and member 'member1' of struct
'myotherstruct' are in use. Of course, it has be to region-aware: that
is, the 'arg' variable shouldn't be considered out of its scope.
I'd consider a tool doing this task as a valid answer, provided it is
lightweight and open-source available. Scripting à la sed, or anything
is also valid. I'm attempting to integrate that into a Java program,
so any Java-based solution is preffered.
Thanks! |