简体   繁体   English

使用Frama-c分析具有CMake构建基础结构的项目

[英]Use Frama-c to analyze a project with CMake build infrastructure

I need to use frama-c value analysis plug-in to analyze some projects. 我需要使用frama-c值分析插件来分析一些项目。 These projects use CMake build infrastructure as their build system. 这些项目使用CMake构建基础结构作为其构建系统。

I have used frama-c to analyze each file separately. 我使用frama -c分别分析每个文件。 This way, the information about the entry point will be lost. 这样,有关入口点的信息将丢失。 More precisely, frama-c requires an entry point for the files that do not include a "main" function and therefore it is challenging to cover all functions and choose the best entry point within a single file from the project. 更确切地说,frama-c需要一个不包含“main”函数的文件的入口点,因此覆盖所有函数并从项目中选择单个文件中的最佳入口点是一项挑战。

My question is that is there a way that we can run frama-c on the entire project as a whole unit (not file by file)? 我的问题是,有没有一种方法可以在整个项目中作为整个单元运行frama-c(不是逐个文件)?

Frama-C accepts multiple files on its command-line. Frama-C在其命令行上接受多个文件。 This will work if the configuration of the preprocessor (option -cpp-extra-args , used in particular for includes) is the same accross all files. 如果预处理器的配置(选项-cpp-extra-args ,特别是用于包含)与所有文件相同,则此方法将起作用。

If you need different preprocessor settings for different files, you should preprocess each file alone (only cpp , no Frama-C), and save each result as a .i file. 如果您需要针对不同文件使用不同的预处理器设置,则应单独预处理每个文件(仅限cpp ,不使用Frama-C),并将每个结果保存为.i文件。 Then, you can supply all those preprocessed files to Frama-C simultaneously. 然后,您可以同时将所有这些预处理文件提供给Frama-C。 Usually, the first operation can be done by tweaking the build process. 通常,可以通过调整构建过程来完成第一个操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM