Several mechanisms are available for using the results of the Frama-C plugin programmatically:
- through the
Db module, which contains functions for accessing the results of many "basic" plugins - through calls to the "dynamic" API (
Dynamic module) - via the plugin interface (e.g.
Value.mli in your case)
The first two approaches are outdated and will eventually disappear. In addition, approach 1. is not available for custom plugins. This is why the development guide emphasizes approach 3.
However, Value results are currently available using Approach 1 (only). Inside your plugin, you can simply write !Db.Value.eval_expr or !Db.Value.eval_lval to evaluate the expression and the left value, respectively. This will work automatically. You must declare the value as a dependency of your plugin ( PLUGIN_DEPENDENCIES:=Value , as you learned), as this will be required in the next version of Frama-C. All internal Value modules, such as Eval_exprs , are not intentionally exported. Most applications of Value results can be written using the functions available in Db.Value .
Finally, lval_to_precise_loc is a pretty advanced feature, since the returned locations are of a type that is difficult to use. Db.Value.lval_to_loc is almost always the best choice.
byako source share