I am new to CIL and I have some difficulty to get start using it.
What I want to do is to print all executed statements (including declaration statements) at runtime.
I studied and modified logcall.ml. I have a visitor to visit and instrument a printf statement before each actual statement. My visitor has only one method which is vstmt, here is the code:
method vstmt (s : stmt) = begin
let pre = mkPrint (d_string "exit %s\n" !currentFunc)  in
ChangeTo (mkStmt (Block (mkBlock [ mkStmtOneInstr pre; s ])))
However, when I run the instrumented code, it print each statement only once. The instrumented code has a loop so the statements inside the loop should be printed for multiple times. Beside, I can't instrument a printf before the declaration statement (which is not a statement in CIL). I try adding a vvdec method and try adding a code to instrument a printf statement before the declaration location but it didn't work.
I think I must misunderstand something and definitely don't fully understand on how CIL works.
Any suggestion or advice would be very appreciate to hep me get going :)
Thank you very much,
Get latest updates about Open Source Projects, Conferences and News.