我有一个在一个环境中构建的程序,我想在我自己的环境中调试它。我已经复制了可执行文件、.dSYM 和源代码,但我找不到让 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
是否有任何方法可以设置发现路径或任何其他方法来重新映射源代码路径?
最佳答案
这就是“target.source-map”设置的用途:
(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
会向您显示上面的帮助,以及其他事情的简短 list 。
关于xcode - 如何在xcode中设置lldb的发现路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26705506/