Skip to content

How to launch OCLint in xcode with debug model. #447

@litianying137

Description

@litianying137

Issue Summary

How to launch OCLint in xcode with debug model.

Environment

  • Operation system name and version: MacOS
  • OCLint version:4.0.0
  • How OCLint is installed: local build? prebuilt binary downloaded from github? homebrew install? others?
    downloaded frome guthub.

Reproduction Steps

1,I downloaded the OCLint source code form Git,
2,I used the ./make command builded zhe OCLInt project
3,I created a custom rule , I move the custome rule's dylib to rule paths, It can run.
3,but I want debug zhe rule in xcode,How to do?

Activity

litianying137

litianying137 commented on Aug 1, 2017

@litianying137
Author

now I can debug oclint and rules in xcode IDE.
step1. used the cmake tool, create xcode project with each module
step2. ensure each project compile complete
step3.create a workspace, and content the all xcode project
step4.整理好每个project的依赖关系,特别是要oclint依赖你自己的rule,便于开发调试
step5.xcode中选择oclint-0.12scheme,edit scheme,添加运行参数如下(注意有些路径要改为自己的路径)

-p /Users/tianying/Desktop/AHOCLintTest -report-type html -o /Users/tianying/Desktop/AHOCLintTest/reporter.html /Users/tianying/Desktop/AHOCLintTest/AHOCLintTest/ViewController.m -- -iframework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks -isystem /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include -isystem /Users/tianying/Documents/oclint/llvm/xcode/Debug/lib/clang/4.0.0/include

step6.开始开心用xcode的开发rule吧

silan-liu

silan-liu commented on Nov 27, 2017

@silan-liu

有demo吗, -p是什么命令需要的

iphone-andy

iphone-andy commented on Dec 7, 2017

@iphone-andy

@litianying137 我这能跑起来,但是在分析的时候报错了,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:17:10: 'stdarg.h' file not found你有遇到过么、

silan-liu

silan-liu commented on Dec 7, 2017

@silan-liu

@iphone-andy 你是按他的方法来的吗

silan-liu

silan-liu commented on Dec 7, 2017

@silan-liu

@iphone-andy 报错,需要添加clang的include路径。
-isystem /Users/liu/Documents/workspace/my/opensource/oclint/build/oclint-release/lib/clang/5.0.0/include

iphone-andy

iphone-andy commented on Dec 8, 2017

@iphone-andy

@silan-liu 是的,你可以debug么,这个我加了,还是报错,我的参数是这样的
-p /Users/qiucaning/Desktop/testCode/CoreText /Users/qiucanqing/Desktop/testCode/CoreText/CoreText/ViewController.m -- -isystem /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include -iframework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks -isystem /Users/qiucaning/Desktop/BaiLi/oclint/build/oclint-release/lib/clang/5.0.0/include

silan-liu

silan-liu commented on Dec 8, 2017

@silan-liu

@iphone-andy 嗯我是可以了。只不过我跟他的命令有点不同,直接用的
-R=/Users/liusilan/Documents/workspace/code/3rd/oclint/oclint-xcoderules/rules.dl/Debug TestObject.m -- -x objective-c,之前也是跟你一样的错,后来加了clang的include就好了。

iphone-andy

iphone-andy commented on Dec 8, 2017

@iphone-andy

@silan-liu 是的-R参数我也加了,你TestObject.m使用了系统库么,我这报错UIKit/UIKit.h' file not found

iphone-andy

iphone-andy commented on Dec 8, 2017

@iphone-andy

最后试验可以debug,参数如下,-p是oclint的运行参数,指定文件目录,后跟要分析的文件名称,eg : -p ~/test ViewController.m ,-R指定要加载的规则,感谢各位 -R=/Users/qiucanqing/Desktop/BaiLi/oclint/oclint-xcoderules/rules.dl/Debug ViewController.m -- -x objective-c -isystem /Users/qiucanqing/Desktop/BaiLi/oclint/build/oclint-release/lib/clang/5.0.0/include -iframework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks -isystem /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include

yangshengtao

yangshengtao commented on Jan 30, 2018

@yangshengtao

@silan-liu TestObject.m怎么写的

silan-liu

silan-liu commented on Feb 1, 2018

@silan-liu

就是在另外一个工程里面建的TestObject的类,跟平常的oc一样。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @litianying137@silan-liu@iphone-andy@yangshengtao

        Issue actions

          How to launch OCLint in xcode with debug model. · Issue #447 · oclint/oclint