首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >让gdb自动读取。/.gdbinit

让gdb自动读取。/.gdbinit
EN

Stack Overflow用户
提问于 2019-06-01 20:41:33
回答 1查看 1.6K关注 0票数 2

通过在我的Linux/x86-64/Debian Sid AMD2970WX桌面上调试RefPerSys时使用原始的gdb (Debian 8.2.1-2) (GPLv3+,在gitlab上)提交ec4ab756d302056cace0b,我可以重复地获得

代码语言:javascript
复制
rimski.x86_64 ~/refpersys 14:39 .0 % gdb --args ./refpersys --object-tinybenchmark1
GNU gdb (Debian 8.2.1-2) 8.2.1
Copyright (C) 2018 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"...
Reading symbols from ./refpersys...done.
warning: File "/home/basile/refpersys/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
    add-auto-load-safe-path /home/basile/refpersys/.gdbinit
line to your configuration file "/home/basile/.gdbinit".
To completely disable this security protection add
    set auto-load safe-path /
line to your configuration file "/home/basile/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
    info "(gdb)Auto-loading safe path"

在没有诊断的情况下,这样的gdb调用能够消化我的./.gdbinit,这有什么神奇之处呢?该.gdbinit包含:

代码语言:javascript
复制
# file refpersys/.gdbinit 
# GPLv3+ licensed 
add-auto-load-safe-path ./.gdbinit 
break abort 
break rps_fatal_stop_at 
set max-value-size 67108864

我可以(过去也是这么做的)从gdb的源代码重建它。但是今天,我变得无能为力,更喜欢专注于我的bug。

FWIW

代码语言:javascript
复制
(gdb) show configuration 
This GDB was configured as follows:
   configure --host=x86_64-linux-gnu --target=x86_64-linux-gnu
             --with-auto-load-dir=$debugdir:$datadir/auto-load
             --with-auto-load-safe-path=$debugdir:$datadir/auto-load
             --with-expat
             --with-gdb-datadir=/usr/share/gdb (relocatable)
             --with-jit-reader-dir=/usr/lib/gdb (relocatable)
             --without-libunwind-ia64
             --with-lzma
             --with-babeltrace
             --with-intel-pt
             --disable-libmcheck
             --without-mpfr
             --with-python=/usr (relocatable)
             --without-guile
             --with-separate-debug-dir=/usr/lib/debug (relocatable)
             --with-system-gdbinit=/etc/gdb/gdbinit
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-01 23:24:44

正如启动gdb时出现的警告所示:

代码语言:javascript
复制
To enable execution of this file add
    add-auto-load-safe-path /home/basile/refpersys/.gdbinit
line to your configuration file "/home/basile/.gdbinit".

您似乎误解了,并将该行添加到您的存储库中的.gdbinit文件中,但它需要放到您的主目录中。

如果.gdbinit文件还不存在于您的主目录中,您可以创建它并只添加上面所需的行,它应该可以工作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56406855

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档