frama-c


How to handle printf(“ ”, ) and scanf(“ ”) with frama-c command?

这一生的挚爱 提交于 2020-01-14 19:27:18
问题 I am using this code to generate the control flow graph of a C program. It is working fine for all the function except built-in function like printf and scanf . What can I change in this code to output the built in function as it is? open Cil open Cil_types let print_stmt out = function | Instr i -> !Ast_printer.d_instr out i | Return _ -> Format.pp_print_string out "<return>" | Goto _ -> Format.pp_print_string out "<goto>" | Break _ -> Format.pp_print_string out "<break>" | Continue _ ->

How to handle printf(“ ”, ) and scanf(“ ”) with frama-c command?

元气小坏坏 提交于 2020-01-14 19:27:08
问题 I am using this code to generate the control flow graph of a C program. It is working fine for all the function except built-in function like printf and scanf . What can I change in this code to output the built in function as it is? open Cil open Cil_types let print_stmt out = function | Instr i -> !Ast_printer.d_instr out i | Return _ -> Format.pp_print_string out "<return>" | Goto _ -> Format.pp_print_string out "<goto>" | Break _ -> Format.pp_print_string out "<break>" | Continue _ ->

Frama-C-Plugin: Set value of variable in plugin

左心房为你撑大大i 提交于 2020-01-07 06:58:29
问题 I am writing a Frama-C Plugin. I want to develop a plugin, that sets the value of a local variable. By this idea I try to do the value-analysis afterwards, and then I can analyze the reachablility, path analysis and other things by my second plugin. Is it possible to set the value of a local variable within a plugin (at the start of a function where I know the name)? EDIT I now found out how to make new local variables, how to get the Varinfo of variables and how to create new varinfos. The

Syntax error in Frama-C due to custom machdep

。_饼干妹妹 提交于 2020-01-05 08:12:14
问题 I am using MPLAB XC16 C Compiler for my application. If I use machdep x86_16, the Frama-C works normally. For example, I can launche Frama-C in this way: $ frama-c-gui machdep x86_16 -cpp-command 'C:\\"Program Files (x86)"\\Microchip\\xc16\\v1.26\\bin\\xc16-gcc.exe -E' -no-cpp-gnu-like D:\\project\\*.c But machdep x86_16 do not comply fully with XC16. So I want to customize machdep. Following the instructions, I created file machdep_xc16.ml that contain: open Cil_types let xc16 = { version =

Meaning of \old in ACSL post-conditions

六眼飞鱼酱① 提交于 2020-01-02 07:12:51
问题 I am a newbie user of Frama-C and have a few questions regarding assertions over pointers. Consider the C fragment below involving: two related data structures Data and Handle, s.t. Handle has a pointer to Data; a 'state' field in Data indicating whether some hypothetical operation has completed three functions: init(), start_operation() and wait(); a main() function using the above, and containing 6 assertions (A1-A6) Now, why is it that A5 and A6 cannot be asserted with the WP verifier (

How do I use the results of WP in another plug-in?

岁酱吖の 提交于 2019-12-24 16:39:51
问题 I am working on writing a Frama-C plug-in and I would like to know if it is possible to get the weakest precondition of something using WP from within my plug-in, and if so, how exactly? In the past I've used Db.Value, for example, to use the results of the EVA plug-in in my own plug-in. Is there something similar to Db.Value for WP? 回答1: The WP plugin exposes its API in the WP.mli file, that is generated by collecting the interfaces of the higher-level modules composing Wp . you can find it

Frama-c : Trouble understanding WP memory models

拟墨画扇 提交于 2019-12-24 00:23:11
问题 I'm looking for WP options/model that could allow me to prove basic C memory manipulations like : memcpy : I've tried to prove this simple code : struct header_src{ char t1; char t2; char t3; char t4; }; struct header_dest{ short t1; short t2; }; /*@ requires 0<=n<=UINT_MAX; @ requires \valid(dest); @ requires \valid_read(src); @ assigns (dest)[0..n-1] \from (src)[0..n-1]; @ assigns \result \from dest; @ ensures dest[0..n] == src[0..n]; @ ensures \result == dest; */ void* Frama_C_memcpy(char

How to use functions in Value.Eval_expr, Value.Eval_op etc modules of Frama-c Value plugin

北城以北 提交于 2019-12-23 10:04:11
问题 I am trying to create a frama-c plugin. This plugin depends upon Frama-c Value plugin. I want to obtain and print value set of all the lvalue(s) in a C source code. In order to do that I want to use functions available in Value.Eval_exprs, Value.Eval_op etc. like Eval_exprs.lval_to_precise_loc . Unfortunately I am unable to figure out a way to use these function in my plugin. I tried to follow steps mentioned in section 4.10.1 (Registration through a .mli file) of Frama-c Plugin Development

what's the meaning of the circle node in pdgs which is generated by frama-c

ぃ、小莉子 提交于 2019-12-22 18:26:31
问题 I use frama-c tool to analyse the code below. int main (int argc, char *argv[]) { int i,a; for (i = 0; i < 100; i += 1) { a=0; if (a==0) { continue; } else { break; } } return 0; } the cmd is frama-c -pdg -dot-pdg graph main.c My question is about the control dependence. what's the circle node means? I try to explain the "while" node, maybe it stand for one time loop , because a loop start from "i<100",so there a control dependence ("i<100" ------o "while" ). Is what I guess right ? but what

The exact mechanism of mapping WhyML into SMT logic

纵饮孤独 提交于 2019-12-14 03:57:32
问题 Good day, auto deduction and verification hackers! In order to gain a deeper understanding of how exactly WhyML provides proofs for ACSL-annotated C programs I am trying to manually "reproduce" the job Why3 does with WhyML program while translating it into SMT logic and feeding it into Z3 prover. Lets say we have the following C fragment: const int L = 3; int a[L] = {0}; int i = 0; while (i < L) { a[i] = i; i++; } assert (a[1] == 1); I am trying to encode it into SMT logic like this: (set

工具导航Map