On Fri, Jul 26, 2013 at 11:07:42AM +0800, tsuletgo wrote: > Bug: Visitor's instruction queue is not empty. > You should only use queueInstr inside a function body! > Fatal error: exception Errormsg.Error > Could anyone give me some suggestions ?
I'm not sure exactly why this fails, but I guess you might break some invariant by iterating yourself on the globals rather than letting the visitor do it. What about something like (untested): List.iter begin fun g -> match g with | GFun( func, loc) -> ignore (visitCilFunction (new myStmtVisitor) func); | _ -> () end file.globals class myVisitor = object(self) inherit nopCilVisitor method vfunc = function | GFun _ -> DoChildren | _ -> SkipChildren method vstmt st = let df_fun = Cil.emptyFunction "df_stmt_monitor" in let df_monitor_call = Call(None,Lval(Var df_fun.svar,NoOffset), [Cil.integer !function_id; Cil.integer st.sid], !currentLoc) in self#queueInstr [df_monitor_call]; DoChildren end;; visitCilFileSameGlobals (new myVisitor) file It might also be a bug in the visitor code; if the above doesn't help, could you please send a minimal example exhibiting the issue (your code+input file)? Best, -- Gabriel ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ CIL-users mailing list CIL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cil-users