本文介绍了如何在 gdb 启动时加载 .gdbinit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个看似微不足道的问题,但我找不到一个简单的方法来完成这个.

This is a seemly trivial question but I can't find a simple way to accomplish this.

我的 .gdbinit 文件与 gdb.exe 所在的目录定义在同一目录中——即在我的编译器的 bin 目录中.但是,当我运行 gdb 时,我得到了这个:

I have my .gdbinit file defined in the same directory as where gdb.exe exist -- that is inside my compiler's bin directory. However, when I run gdb I get this:

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.3in.gdbinit" auto-loading has been declined by
your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".

我查看了关于自动加载的手册这里但它与保存我添加的新安全路径无关!退出 gdb 并重新启动它,我添加的安全路径消失了.

I looked up the manual about auto-loading here but it has nothing about keeping that new safe-path I added saved! Exiting gdb and starting it up again and the safe-paths I added are gone.

我的 .gdbinit 包含我总是希望在启动时加载的设置.加载 .gdbinit 可能与环境无关,但在 Windows 下执行此操作的最简单方法是什么?.gdbinit 不能驻留在我的主目录中还有一个附加约束——它必须与 gdb.exe 可执行文件位于同一路径中.

My .gdbinit contains settings that I always want loaded upon startup. Loading .gdbinit is probably environment agnostic but what's the simplest way to do this under Windows? There is an addition constraint that .gdbinit cannot reside in my home directory -- it must be in the same path as the gdb.exe executable.

推荐答案

放入您的 $HOME当前 目录.

Put into your $HOME or into current directory.

这篇关于如何在 gdb 启动时加载 .gdbinit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 00:36