Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I load .gdbinit on gdb startup?

Tags:

windows

gdb

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

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

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.

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.

like image 883
greatwolf Avatar asked Mar 14 '13 00:03

greatwolf


People also ask

Where do I put .gdbinit files?

gdbinit - put it in your home directory. Now every time gdb starts it will execute the commands in this file. ". gdbinit" is a file you can drop in your home directory that gdb will parse when gdb launches, either from the command line or from within Xcode.

What is GDB init?

GDB User Initialization FileThe user initialization file contains commands that are executed upon the startup of GDB. It is located in your home directory under the path: ~/. gdbinit.


2 Answers

I launch xt-gdb that comes with Xtensa tool chain with -iex -ix parameters as follows:

xt-gdb -iex "set auto-load safe-path Path\to\gdbinit\dir" -ix Path\to\gdbinit\dir.gdbinit

like image 156
AK S Avatar answered Sep 21 '22 11:09

AK S


I have my .gdbinit file defined in the same directory as where gdb.exe exist

Put into your $HOME or into current directory.

like image 37
Employed Russian Avatar answered Sep 18 '22 11:09

Employed Russian