2013-03-14 179 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