Reveal2通过lldb调试的方法

    xiaoxiao2021-03-25  104

    一、添加lldbinit文件

    打开终端,输入如下指令:

    vim ~/.lldbinit

    然后将以下内容复制进入

    command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer", 0x2); command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2); command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil]; command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];

    指令的作用:

    reveal_load_sim 模拟器加载reveal调试用的动态链接库。reveal_load_dev 真机加载reveal调试用的动态链接库。reveal_start 启动reveal调试功能。reveal_stop 结束reveal调试功能。

    二、添加BreakPoint

    按下图进行设置:

    打开breakpoint编辑界面

    点击左下角的+,选择Symbolic Breakpoint

    如图设置该断点,作用是程序启动时,断点自动启动。断点启动后,选择继续执行,reveal的库就动态添加到项目中了。此时再打开reveal,就可以查看你模拟器的项目了

    三、reveal1.x和reveal2.x的区别

    1.X : command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2); 2.X : command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer", 0x2);

    主要区别是iOS-Libraries的库不一样了

    参考链接

    http://support.revealapp.com/kb/getting-started/load-the-reveal-server-via-an-xcode-breakpoint http://blog.csdn.net/nadazero/article/details/52638696

    转载请注明原文地址: https://ju.6miu.com/read-18630.html

    最新回复(0)