FaceBook/infer-infer工作流
来源:互联网 发布:java访问控制修饰符 编辑:程序博客网 时间:2024/05/21 14:50
Infer workflow
infer命令
例如我们分析iOS项目,正常情况下,我们构建iOS项目,只需要xcodebuild -target HelloWorldApp -configuration Debug -sdk iphonesimulator
,infer命令只是在这个构建命令开头加入了infer --
这样一个前缀,为何是这样呢?这样从infer的工作流程分析得到解答.
infer执行的两个阶段
转化阶段
首先infer将原本各个构建系统自带的构建命令包含其中,目的是用infer将其编译的过程转化为infer自带的语言翻译过来。就是包裹了一层解释器,将原本已经存在的东西通过转化,可以让自己理解,这个好处是什么?就是不重复造轮子,因为每一个语言或者框架都有自己一套很好的构建实现,我们无需推翻,只需将其转化为infer能理解的东西就行.这个时候我们会有这样一个意味,转换后的东西放在哪里了?默认是同级目录下的infer-out目录,但是你可以通过-o
参数修改.现在我们还是采用默认的路径infer-out,ok,我们已经为第二阶段准备好它所需要的一切,下面进入分析阶段.
分析阶段
第二阶段infer会从infer-out目录中分析第一阶段编译的结果,他会分析每一个函数(方法),一旦发现某个函数有错误,infer会停在这个方法有错误的语句上面.会跳过这个函数继续向下执行分析其他函数.所以infer工作流不仅仅为infer运行code阶段定义,也有可能在修复错误阶段,发现更多错误的阶段以及判断所有错误是否都被修复了这个阶段,这些过程中都会有infer工作流程所定义的过程。
发现错误后,infer会将其打印到标准输出流中,也将其报错到infer-out/bug.txt中,我们也成了csv格式的文件来存放错误信息.
标准输出流
Analysis done4 files analyzed/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/AppDelegate.m:20: error: MEMORY_LEAK memory dynamically allocated to shadowPath by call to CGPathCreateWithRect() at line 20, column 28 is not reachable after line 20, column 5/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/AppDelegate.m:25: error: RESOURCE_LEAK resource acquired to fp by call to fopen() at line 25, column 8 is not released after line 25, column 5/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/AppDelegate.m:29: warning: PARAMETER_NOT_NULL_CHECKED Parameter callback is not checked for null, there could be a null pointer dereference: pointer callback could be null and is dereferenced at line 29, column 5/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/AppDelegate.m:34: error: NULL_DEREFERENCE pointer str last assigned on line 33 could be null and is dereferenced at line 34, column 12/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/AppDelegate.m:39: error: PREMATURE_NIL_TERMINATION_ARGUMENT pointer str last assigned on line 38 could be nil which results in a call to arrayWithObjects: with 1 arguments instead of 3 (nil indicates that the last argument of this variadic method has been reached) at line 39, column 12/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/Hello.m:20: error: NULL_DEREFERENCE pointer hello last assigned on line 19 could be null and is dereferenced at line 20, column 12/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/Hello.m:25: warning: IVAR_NOT_NULL_CHECKED Instance variable hello -> _hello is not checked for null, there could be a null pointer dereference: pointer ret_hello last assigned on line 24 could be null and is dereferenced at line 25, column 12/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/Hello.m:30: warning: PARAMETER_NOT_NULL_CHECKED Parameter hello is not checked for null, there could be a null pointer dereference: pointer ret_hello last assigned on line 29 could be null and is dereferenced at line 30, column 12
bug.txt
report.csv
不知道各个title代码啥意思,以后再说吧.
增量和非增量工作流的含义
我们知道,我们每一次的分析过程都会生成infer-out目录,对于这个目录,如果下次执行infer的时候,都要先删除这个目录,重新生成,我们称这样的工作流叫非增量工作流。但是如果我们要保留infer-out目录,每次只分析增加的新文件的信息,可以通过参数-i(或—-incremental)来改变,这样我们的工作流就称为增量工作流。
不同的分析类型,我都有在器分析的过程的文章详细说明了设置增量参数的方式,这里就不再细说了。
- FaceBook/infer-infer工作流
- FaceBook/infer-尝鲜
- FaceBook/infer-安装说明
- Facebook 静态检测工具 Infer
- FaceBook/infer-Debug模式
- FaceBook/infer-InferPrint命令
- facebook Infer环境搭建
- FaceBook/infer-安装说明
- FaceBook/infer-安装说明
- Facebook Infer安装总结
- FaceBook/infer-infer捕捉的bug类型
- FaceBook/infer-分析OC文件
- FaceBook/infer-分析C文件
- FaceBook/infer-分析iOS项目
- FaceBook/infer-分析C项目
- FaceBook/infer-分析Java文件
- FaceBook/infer-分析Android项目
- FaceBook/infer-inferTraceBugs命令使用
- js 将json字符串转换为json对象的方法解析
- 移位
- UVA 1349 Optimal Bus Route Design 最小费用流+拆点
- android static对内存的影响
- N皇后问题
- FaceBook/infer-infer工作流
- windows下apache部署django项目个人总结(备查)
- 游戏编程入门
- 学习七十一雾央MFC游戏心得,初体验(七)
- MySQL系列,第1部分:Mysql简介
- 大小端
- 英语词典小程序
- Android开发Bitmap在Native层与Java层内存的两种生成方式
- Java中出现异常:Syntax error on token(s), misplaced construct(s)