Reputation: 77
My main method in my source code a.c accepts 2 arguments : one is a file name and the other is an integer. I run it like :
./a.out filename1.txt 3
But when I try to use slicing with frama-c
frama-c a.c filename1.txt 3 -slice-......
Framac throws an error saying it cannot find the file 3 ???
I also tried other options when I enter filename1.txt_3 and extract them separately within the code, but even then frama-c doesnt like it. it complains it cannt find file filename1.txt_3.
Please let me know how to send multiple arguments to source when running Frama C
Upvotes: 0
Views: 99
Reputation: 80276
If your analyzed program needs commandline arguments, you usually need to write a function of void
that builds arguments argc
and argv
and passes them on to the main()
function of the analyzed program:
int analysis_main(void) {
char *argv[] = { "myprogram", "filename1.txt", "3", 0 };
return main(3, argv);
}
Note that if the goal is to have "filename1.txt" used as the name of a file to open with fopen()
and read from with fread()
, and if the contents of the file are relevant to the behavior of the program, you had better provide implementations for these two functions, that return the desired results when called instead.
Conversely, if the first thing the analyzed program does is to pass argv[2]
to strtol()
, you might want to pragmatically simplify that bit of the program instead of providing an implementation for strtol()
, the analysis of which would only introduce complexity where none was necessary.
Upvotes: 1