如何在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