sor*_*oru 28
您需要的是命令set substitute-path.
(gdb) set substitute-path /usr/src/include /mnt/include
Run Code Online (Sandbox Code Playgroud)
但是,仅在最新版本(6.6+)的gdb中可用.
Sam*_*man 16
或者您可以执行以下操作,以便prog
在目录中使用source 调试程序srcdir
:
gdb `find srcdir -type d -printf '-d %p '` prog
Run Code Online (Sandbox Code Playgroud)
我认为这是对你的问题更直接的回答.如果您的可执行文件不包含编译目录和/或您没有6.6+版本的gdb,也很有用.
(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.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
32307 次 |
最近记录: |