Hello,

I have been trying to find a tool that would allow to perform queries on C code such as "what are the values, in all the codebase, that are passed as second argument of 'func' ?".
Given the following code:
func(0, ENUM_VAL_2);
func(0, ENUM_VAL_1);
func(0, ENUM_VAL_1 | ENUM_VAL_3);
That paricular query would return (ENUM_VAL_1, ENUM_VAL_2, ENUM_VAL_1 | ENUM_VAL_3).
Or queries like "give me a call graph for 'func'".

After some research, I remembered Coccinelle as it appeared on the result of a search with some keywords... Does that fall under Cocinelle's matching capabilities ? And if yes, what effort would it require to be able to do such things ?

I don't know OCaml yet (I can try and learn it if it helps) and only have had an introduction on formal methods and model checking some time ago ... Perhaps there is a better suited tool ? I used CScope for simpler queries and still have some CScope-based tools to explore. I also read about some tools around GXL (Graph eXchange Language) but couldn't find anything up-to-date (except maybe GreQL, but it isn't opensource).

I also imagined it could be possible to parse the code and build an SQL database from it but I'm not sure that it is fit and I can only begin to imagine all the problems I would run into.


Any pointer would be greatly welcome.
Regards,
David Wagner.
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to