如何在unix中提到gdb以递归方式在单个目录内搜索源文件 例如 如果在一个模块中存在一些不同的构建块。 a是b,c,d的父目录,其中b,c,d是子目录。 和源文件分布在b,c,b。 我只需要提到gdb,所有源文件都位于(父目录)中。 哪个gdb将用作参考并在调试程序时递归搜索源文件。gdb搜索源目录
Q
gdb搜索源目录
17
A
回答
16
或者你也可以做这样的事情,在目录srcdir
调试程序prog
带源:
gdb `find srcdir -type d -printf '-d %p '` prog
我认为这是一个更直接的回答你的问题。如果您的可执行文件不包含编译目录和/或您没有版本6.6及以上版本的gdb,这也很有用。
5
(gdb) help files
Specifying and examining files.
List of commands:
add-shared-symbol-files -- Load the symbols from shared objects in the dynamic linkers link map
add-symbol-file -- Load symbols from FILE
add-symbol-file-from-memory -- Load the symbols out of memory from a dynamically loaded object file
cd -- Set working directory to DIR for debugger and program being debugged
core-file -- Use FILE as core dump for examining memory and registers
directory -- Add directory DIR to beginning of search path for source files
edit -- Edit specified file or function
exec-file -- Use FILE as program for getting contents of pure memory
file -- Use FILE as program to be debugged
forward-search -- Search for regular expression (see regex(3)) from last line listed
generate-core-file -- Save a core file with the current state of the debugged process
(gdb) help directory
Add directory DIR to beginning of search path for source files.
Forget cached info on source file locations and line positions.
DIR can also be $cwd for the current working directory, or $cdir for the
directory in which the source file was compiled into object code.
With no argument, reset the search path to $cdir:$cwd, the default.
21
你需要的是命令set substitute-path。
(gdb) set substitute-path /usr/src/include /mnt/include
只适用于gdb的最新版本(6.6+)。
相关问题
- 1. 目录搜索
- 2. 搜索目录
- 3. 搜索和目录
- 4. 通过目录搜索
- 5. PHP搜索目录设计
- 6. 如何搜索目录IOS
- 7. 问题搜索子目录
- 8. 目录搜索功能C++
- 9. ASP.Net搜索子目录
- 10. 搜索文件的目录
- 11. Excel VBA:搜索目录
- 12. 搜索所有目录中
- 13. Magento2目录搜索问题
- 14. SQLite全文搜索目录
- 15. VB.Net搜索系统目录
- 16. 如何显示/修改源目录dbx搜索?
- 17. 如何指定搜索目录的源代码构建
- 18. 在.emacs中列出gdb的源代码目录
- 19. LDAP目录下的选项搜索以搜索ROLE
- 20. 在Java根目录下搜索文件
- 21. php scandir - >搜索文件/目录
- 22. 无法使用CFBundleCopyResourceURL搜索子目录
- 23. 搜索目录中的图像
- 24. C++搜索目录和文件
- 25. 目录第一次搜索与查找
- 26. 搜索所有目录中的文件
- 27. 模式搜索目录中的
- 28. 搜索文件的tarball目录?
- 29. G ++搜索/lib/../lib/,然后/ lib目录/
- 30. 用os.walk递归搜索多个目录()
“设置目录”也可用于最新版本。 – ernesto 2014-04-23 05:29:33