2013-03-14 178 views
3

这是一个看似微不足道的问题,但我找不到一个简单的方法来完成这个。如何在gdb启动时加载.gdbinit?

我有我的.gdbinit文件定义在gdb.exe所在的同一目录中 - 这是在我的编译器的bin目录中。然而,当我运行GDB我得到这个:

GNU gdb (GDB) 7.5.50.20120804-cvs 
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 "i686-w64-mingw32". 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
warning: File "g:\Mingw32-4.6.3\bin\.gdbinit" auto-loading has been declined by 
your `auto-load safe-path' set to "$debugdir:$datadir/auto-load". 

我抬头手动约自动加载here,但它没有任何关于保持新的安全路径我加得救了!退出gdb并重新启动,我添加的安全路径消失了。

我的.gdbinit包含我始终希望在启动时加载的设置。加载.gdbinit可能是环境不可知的,但在Windows下这样做最简单的方法是什么?有一个额外的约束,.gdbinit不能驻留在我的主目录中 - 它必须与gdb.exe可执行文件位于相同的路径中。

回答

6

我在同一目录中定义我的.gdbinit中为其中gdb.exe存在

把你$HOME或成当前目录。

+0

我在当前目录中添加了.gdbinit,但仍然不起作用。我在文件开头添加的echo命令也不会被打印。 – Sarvavyapi 2015-03-05 18:32:05

5

我在Windows 7上使用CodeSourcery arm-none-eabi-gdb.exe。按照上面的说明在我的情况下不起作用。下面命令工作:

arm-none-eabi-gdb.exe -x D:\CodeSourcery\bin\.gdbinit

0

我推出XT-GDB附带的Xtensa工具链-iex -ix参数如下:

XT-GDB -iex“设置自动加载安全路径Path \ to \ gdbinit \ dir“-ix Path \ to \ gdbinit \ dir.gdbinit