从当前目录加载.gdbinit失败,"自动加载已被"自动加载安全路径"拒绝"

fra*_*gos 13 gdb gdbinit

我在加载位于当前目录中的.gdbinit文件时遇到问题.在启动gdb时,我得到了这个:

GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
warning: File "/home/user1/test/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load". 
Run Code Online (Sandbox Code Playgroud)

我可以通过以下命令启动gdb来加载当前目录中的.gdbinit文件:

gdb -iex 'add-auto-load-safe-path .'
Run Code Online (Sandbox Code Playgroud)

作为描述在这里.但是有没有办法设置$ debugdir来包含当前目录?

$ export debugdir=.
$ gdb
Run Code Online (Sandbox Code Playgroud)

产生与上述相同的警告.

Tom*_*mey 18

请参阅http://sourceware.org/gdb/current/onlinedocs/gdb/Startup.html#Init%20File%20in%20the%20Current%20Directory%20during%20Startup

基本上,你想要的是允许从〜/ .gdbinit加载每个目录.gdbinit.如果您不担心安全问题,那么这可行:

set auto-load safe-path /
Run Code Online (Sandbox Code Playgroud)

  • 谢谢汤姆。在主目录.gdbinit中设置自动加载安全路径有效。将安全路径设置为。代替/也起作用。这样会更安全,不是吗? (2认同)