2014-11-02 33 views
4

我在一个环境中构建了一个程序,我想在自己的环境中进行调试。我已经复制了可执行文件,.dSYM和源代码,但是我找不到让lldb知道在哪里可以找到源代码的方法。如何在xcode中设置lldb的发现路径

例如,在建筑环境有源文件:

/build_src/rel_path/source1.c 
/build_src/rel_path/source1.dSYM 
/build_src/rel_path/app1 

而且在我的环境中的文件和.dSYM复制到:

/source/rel_path/source1.c 
/source/rel_path/source1.dSYM 
/source/rel_path/app1 

有什么办法来设置发现路径或任何其他方式来重新映射源代码路径?

+0

一个类似的问题:http://stackoverflow.com/questions/12973633/lldb-equivalent-of-gdb-directory-command-for-specifying-source-search-path – guini 2015-10-30 07:16:21

回答

5

这就是“target.source地图”的设置是为了什么:

(lldb) settings list target.source-map 
    source-map -- Source path remappings used to track the change of location between a source file when built, and where it exists on the current system. 
       It consists of an array of duples, the first element of each duple is some part (starting at the root) of the path to the file when it 
       was built, and the second is where the remainder of the original build hierarchy is rooted on the local system. Each element of the 
       array is checked in order and the first one that results in a match wins. 

因此,例如,你的情况,你会怎么做:

settings set target.source-map /build_src /source 

LLDB有apropos命令,您可以使用找到这些埋藏​​好的东西,例如apropos source就会向你显示上面的帮助,以及其他一些非常简短的列表。