is there an easy way to add a new local variable ? e.g.,
sprintf(dest,src) will become
int temp;
temp = 5;
snprintf(dest,sizeof(dest),src)
I realize that this has several instructions instead of just one instruction
like before -- that's fine however
the function mkLocalVar requiring a funde
On Tue, Dec 22, 2009 at 08:32:23AM -0700, ThanhVu (Vu) Nguyen wrote:
> Did you mean "SizeOfE"?
I meant the CIL constructor SizeOf, which you can build manually or
using SizeOfE (which won't make any difference in the end).
Regards,
--
Gabriel Kerneis
VN -
On Tue, Dec 22, 2009 at 1:45 AM, Gabriel Kerneis wrote:
> On Mon, Dec 21, 2009 at 11:54:51PM -0700, ThanhVu (Vu) Nguyen wrote:
> > if the program is
> > char dest [100] = "";
> > char *src = "hello world";
> > sprintf(dest,src);
> > so if I want to change it to
> > snprintf(dest,src,sizeof(
On Tue, Dec 22, 2009 at 01:02:00AM -0700, ThanhVu (Vu) Nguyen wrote:
> > What is CIL check ?
> src/check.ml
> Hi Gabriel, I want to use the checkFile flag fl function in check.ml
> however
> not sure that "flag" to use.
[] is just fine (see src/check.mli for documentation). But y
On Mon, Dec 21, 2009 at 11:54:51PM -0700, ThanhVu (Vu) Nguyen wrote:
> if the program is
> char dest [100] = "";
> char *src = "hello world";
> sprintf(dest,src);
> so if I want to change it to
> snprintf(dest,src,sizeof(dest));
> then I am not sure which SizeOf to use ? should I use AddressOf
> > What is CIL check ?
>
> src/check.ml
>
Hi Gabriel, I want to use the checkFile flag fl function in check.ml
however not sure that "flag" to use.
--
This SF.Net email is sponsored by the Verizon Developer Community
T
> let snprintf_va = makeVarinfo true "snprintf" (TVoid [])> let snprintf =
Lval((Var snprintf_va),NoOffset)
> >
> > class snprintfV ?(tracelist=[]) file = object
> > inherit nopCilVisitor
> > method vstmt s = ChangeDoChildrenPost(
> > s,
> > fun s -> if L.mem (s.sid) tracelist then (
>
>
> Hint: always run the CIL checks after your transformations, this will
> let you know if you broke some invariants in the code.
>
>
What is CIL check ? and how do I run it to see if some invariants are
broken ?
Thanks,
-
Hi,
On Sat, Dec 19, 2009 at 12:48:39PM -0700, ThanhVu (Vu) Nguyen wrote:
> I follow your suggestion and use ChangeDoChildrenPost and also not
> mutate things directly. I also use method vstmt instead of method
> vinstr. Below is my new version for changing
> sprintf(buff,"a string")
> to
> sn
Hi Gabriel, I follow your suggestion and use ChangeDoChildrenPost and also
not mutate things directly. I also use method vstmt instead of method
vinstr. Below is my new version for changing
sprintf(buff,"a string")
to
snprintf(buff,sizeof(buff","a string").
Please let me know if there's any p
Hi,
On Thu, Dec 17, 2009 at 03:46:32PM -0700, ThanhVu (Vu) Nguyen wrote:
> 1) After I change the original statement s to a new one s' , I want
> s'.id to be the same as s.id. Using the "method vinst", I cannot do
> this.
You can, but you have to use the mutable property of the
>
> 1) After I change the original statement s to a new one s' , I want
> s'.id to be the same as s.id. Using the "method vinst", I cannot do
> this.
>
> 2) And the return type of "method vinst" is "Cil.instr list
> Cil.visitAction" so I cannot call ChangeTo(new_stmt) .
>
I made some
First thanks for your quick reply,
After rewritting the code as suggested so that it uses "method vinst i"
(looks much cleaner), I face 2 problems here.
1) After I change the original statement s to a new one s' , I want s'.id
to be the same as s.id. Using the "method vinst", I cannot do t
Hi,
Your code might work on simple examples, but it will probably break on
real programms. Could you give a real example of what you are trying to
do? Don't you want to change the name of the function in it's
definition too? What if there are function pointers? All this can be
changed very eas
14 matches
Mail list logo