Ah, I somehow missed this documentation. This looks useful for my purposes.
Thanks for the suggestion, Gabriel! :)

To be clearer, the assignments are produced by an SMT solver, or rather, by
a parser that reads the model produced by an SMT solver and produces output
that looks like C lines. Basically, the C lines produced are part of a test
case, which the function has to be run on.

For example, say I have the function

int foo()
{
    int a;
    if (a > 0) { ... }
}

and the parser produces the line

"a = 3;"

I want to be able to patch the two together:

int foo()
{
    int a;
    a = 3;
    if (a > 0) { ... }
}

so as to sensitize the consequent case of the if-branch.


On 7 March 2013 10:09, Gabriel Kerneis <gabr...@kerneis.info> wrote:

> Hi Jonathan,
>
> On Sat, Mar 02, 2013 at 08:44:10AM -0800, Jonathan Kotker wrote:
> > I was looking through the CIL codebase in search of a function that would
> > convert a statement into an element of the CIL representation.
> >
> > The larger context of this problem is as follows: I have a C file, and I
> > also have another file (a non-legal C file) with assignments such as:
>
> It is not clear to me why these statements are not a legal C file.
>
> > The best I could find was the function "cStmt" within "formatCil.ml".
>
> It should help you, indeed.  Did you read the related documentation?
> http://kerneis.github.com/cil/doc/html/cil/attributes.html#toc5
>
> So I would try to open the file, read it line by line, and pass each of
> them to
> Formatcil.cStmt (or all at once, and use Formatcil.cStmts ; you have a
> sample
> use of the latter in the link above).  Then, write a simple visitor taking
> your
> list of statements and patching the AST.
>
> Maybe you could give a concrete minimal example of what you are trying to
> do.
>
> Best,
> --
> Gabriel
>
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to