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] Modifying the AST to insert statements / declarations



Hello,

2012/3/19 Pierre Karpman <Pierre.Karpman at rennes.supelec.fr>:
>
> I'm using your script as a basis for the instrumentation code in my plugin
> but it appears that it's not possible to call any functions of the "File"
> module from inside a dynamic plugin (although there's no problems opening
> the module itself)?!

> I found no reference to such a restriction in the module documentation or in
> the plugin development guide, so is it possible that the issue comes from
> some misconfiguration of mine?

That's quite strange indeed. Dynamic plugins have access to the whole
kernel's API. Do you have some existing file.cmi in your current
directory? That would explain the fact that open File succeeds but you
don't see its functions.

>
> Anyway, I replaced the call to "File.create_project_from_visitor" by one to
> "Project.create_by_copy" and it seems to work all right, but I'm not quite
> sure there's no difference between the two?
>

The end result will be the same, but the mechanisms involved are
pretty different. Project.create_by_copy will copy all internal states
(including results of analysis and paramters that have been set on
command line) treats the AST like any other state: it serializes its
content in a temp file, then reads the file to create a new AST.
File.create_project_from_visitor uses the visitor to perform the copy,
and will mainly copy the AST and the related tables: parameters are
reset to their default value, results of analysis are not lifted.

-- 
E tutto per oggi, a la prossima volta
Virgile