在 GDB 中搜索源目录 [英] searching for source directories in GDB
问题描述
如何告诉 *nix 中的 GDB 递归搜索单个目录中的源文件?例如:
How do I tell GDB in *nix to search for source files inside a single directory recursively? For example:
- 如果在一个模块中有一些不同的构建块.
- a 是 b、c、d 的父目录,其中 b、c、d 是子目录.
- 源文件分布在 b,c,b 中.
我需要向 GDB 指定所有源文件都位于a"(父目录)中,GDB 应将其用作参考并在调试程序时递归搜索源文件.
I would need to specify to GDB that all the source files are located in 'a'(parent directory) which GDB should use as a reference and search for source files recursively while debugging a program.
推荐答案
或者你可以做这样的事情,用于调试程序 prog
和目录 srcdir
中的源代码:
Or you can do something like this, for debugging program prog
with source in directory srcdir
:
gdb `find srcdir -type d -printf '-d %p '` prog
我认为这是对您问题的更直接的回答.如果您的可执行文件不包含编译目录和/或您没有 6.6+ 版本的 gdb,也很有用.
I think it's a more direct answer to your question. Also useful if your executable doesn't contain the compilation directories and/or you don't have version 6.6+ of gdb.
这篇关于在 GDB 中搜索源目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!