Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
902 views
in Technique[技术] by (71.8m points)

xcode - LLDB equivalent of gdb "directory" command for specifying source search path?

Looking for the lldb equivalent of the gdb "directory" command to add search paths for finding missing source code (or possibly similar functionality within xcode)?

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The target.source-map setting allows you define a series of a => b path remappings in the debug session. It's not identical to the gdb dir command, which is a list of directories to search for source files by base name, but you can solve the same problems with source-map. Here's an example where I move a source file to a hidden directory after compiling:

% 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) 

For more information about this setting, type set list target.source-map in lldb. fwiw you might have discovered this in lldb by doing apropos path which will list all commands/settings that have the word path in the name/description. Seeing that there was a setting by this name, you'd do settings list to see the list of settings and find out that it's filed under target..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...