本文介绍了从当前目录加载 .gdbinit 失败,“自动加载已被您的‘自动加载安全路径’拒绝"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm having trouble loading a .gdbinit file located in the current directory. On starting gdb, I get this:

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". 

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

I can load the .gdbinit file in the current directory by starting gdb with:

gdb -iex 'add-auto-load-safe-path .'

此处所述.但是有没有办法设置 $debugdir 来包含当前目录?

as described here. but is there a way set $debugdir to include the current directory?

尝试

$ export debugdir=.
$ gdb

产生与上述相同的警告.

yields the same warning as above.

推荐答案

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

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

Basically, what you want is to allow loading the per-directory .gdbinit from your ~/.gdbinit. If you are not worried about the security aspects, then this works:

set auto-load safe-path .

或者,如果由于某种原因无法解决问题,您还可以允许从系统上的任何位置加载 .gdbinit:

Or, if that doesn't cut it for some reason, you can also allow loading the .gdbinit from anywhere on the system:

set auto-load safe-path /

这篇关于从当前目录加载 .gdbinit 失败,“自动加载已被您的‘自动加载安全路径’拒绝"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 18:26