LLDB 相当于 gdb “目录"指定源搜索路径的命令? [英] LLDB equivalent of gdb "directory" command for specifying source search path?

查看:38
本文介绍了LLDB 相当于 gdb “目录"指定源搜索路径的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在寻找与 gdbdirectory"命令等效的 lldb 以添加搜索路径以查找缺失的源代码(或 xcode 中可能的类似功能)?

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

提前致谢!

推荐答案

target.source-map 设置允许您定义一系列 a =>b 调试会话中的路径重新映射.它与 gdb dir 命令不同,后者是按基本名称搜索源文件的目录列表,但您可以使用 source-map 解决相同的问题.这是我在编译后将源文件移动到隐藏目录的示例:

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) 

有关此设置的更多信息,请在 lldb 中键入 set list target.source-map.fwiw 您可能已经通过执行 apropos path 在 lldb 中发现了这一点,这将列出名称/描述中包含 path 一词的所有命令/设置.看到有此名称的设置,您可以执行 settings list 以查看设置列表并发现它已归档在 target. 下.

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..

这篇关于LLDB 相当于 gdb “目录"指定源搜索路径的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆