Jas*_*nda 27
该target.source-map设置允许您a => b在调试会话中定义一系列路径重映射.它与gdb dir命令不同,后者是按基本名称搜索源文件的目录列表,但您可以解决相同的问题source-map.这是一个示例,我在编译后将源文件移动到隐藏目录:
% cd /tmp
% echo 'int main () { }' > a.c
% clang -g a.c
% mkdir hide
% mv a.c hide/
% xcrun lldb a.out
(lldb) settings set target.source-map /tmp /tmp/hide
(lldb) l -f a.c
1 int main () { }
(lldb) br se -n main
Breakpoint created: 1: name = 'main', locations = 1
(lldb) r
Process 21674 launched: '/private/tmp/a.out' (x86_64)
Process 21674 stopped
* thread #1: tid = 0x1f03, 0x0000000100000f49 a.out`main + 9 at a.c:1, stop reason = breakpoint 1.1
#0: 0x0000000100000f49 a.out`main + 9 at a.c:1
-> 1 int main () { }
(lldb)
Run Code Online (Sandbox Code Playgroud)
有关此设置的更多信息,请键入set list target.source-maplldb.fwiw你可能已经在lldb中发现了这一点,apropos path这将列出名称/描述中包含单词path的所有命令/设置.看到这个名字有一个设置,你会settings list看到设置列表,并发现它已归档target..