【发布时间】:2018-09-20 19:52:06
【问题描述】:
调试器gdb 找不到我的本地.gdbinit 文件,而只能找到位于-cd 参数指向的文件夹中的那个。
当启动它的本地文件夹中没有文件时,它不会显示任何警告:
/home/mydir/sources $ rm .gdbinit
/home/mydir/sources $ gdb --cd /home/mydir/apprundir
(output omited)
但是,如果我们在启动它的当前文件夹中创建一个.gdbinit 文件,它会检测到它在那里,但不会加载它,而是显示“警告:.gdbinit:没有这样的文件或目录”。
/home/mydir/sources $ > .gdbinit
/home/mydir/sources $ gdb -cd /home/mydir/apprundir
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: .gdbinit: No such file or directory
有没有其他方法可以不通过 gdb 命令行参数来设置 cmd 文件?但是通过任何外部方式,如环境变量或其他方式?我无法将参数传递给 gdb,因为它是由第三方脚本启动的,并且我无法在应用主文件夹中创建文件。
PS:我的最后一个选择是将所有命令放在 $HOME/.gdbinit 文件中,但我避免这样做,因为其他开发环境共享相同的 $HOME/.dbginit 文件
【问题讨论】: