Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Printing all global variables of a set of C files?

  • Subject: [Frama-c-discuss] Printing all global variables of a set of C files?
  • From: stephane.duprat at (DUPRAT Stephane)
  • Date: Mon, 30 Sep 2013 11:07:23 +0000
  • In-reply-to: <>
  • References: <>

Hello David,

>From my own experience and with efficient support of CEA that I thank, here are some points that can help you.

Cil is cleaning up the objects that are not used in the C functions analysed.
There is a way in writing the plugins to avoid this mechanism by setting a variable :

let () = Rmtmps.keepUnused := true

By this way, you will not lose any var or type definition.

But it is possible that you don't find all the informations in the Cil you need (for example, the extern attribute). And the best way is to make a plugin with a visitor at the Cabs level (example of cabs visitor in src\dummy\untyped_metrics).



St?phane Duprat
Solution Manager
T +33 5 34 36 32 78
F +33 5 34 36 31 00
stephane.duprat at
6 Impasse Alice Guy
B.P. 43045
31024 Toulouse Cedex 03

-----Message d'origine-----
De : frama-c-discuss-bounces at [mailto:frama-c-discuss-bounces at] De la part de David MENTRE
Envoy? : lundi 30 septembre 2013 11:29
? : Frama-C public discussion
Objet : [Frama-c-discuss] Printing all global variables of a set of C files?


Does anybody know how to print all the global variables of a set of C files?

I would like to print basic information:
  * Variable name;

  * Definition location (file / line number);

  * Variable type;

  * (Optionally) Initial value at definition point.

I am pretty sure one could write a plug-in to do that but I don't know how to write plug-ins.

Does anybody know a way to use Frama-C Fluorine or one of its plug-in to get all or part of above information (maybe debug option of a plug-in)? I don't mind doing a few greps or other command line filtering if needed.

I tried to use frama-c-gui for that purpose but there are some pitfalls:
  * This is not very automated, one needs to click on each .c file to see all the variables;

  * There is no distinction between locally (to a file) defined variables and "extern" ones. One need to refer to the C source file to get this info from the GUI;

  * Strangely enough, some variables where missing from the normalized program window or the list of global objects of the C file, even if this variable is defined in the C source code;

  * Only 21 global objects are displayed in the normalized program window.

Best regards,

Frama-c-discuss mailing list
Frama-c-discuss at

Ce message et les pi?ces jointes sont confidentiels et r?serv?s ? l'usage exclusif de ses destinataires. Il peut ?galement ?tre prot?g? par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir imm?diatement l'exp?diteur et de le d?truire. L'int?grit? du message ne pouvant ?tre assur?e sur Internet, la responsabilit? du groupe Atos ne pourra ?tre engag?e quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'exp?diteur ne donne aucune garantie ? cet ?gard et sa responsabilit? ne saurait ?tre engag?e pour tout dommage r?sultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.