Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default options for gdb?

Tags:

gdb

I have several options that I set every time I open GDB, for instance:

set print thread-events off

Is there a way to set these options by default, perhaps something like a .gdb_rc file?

like image 971
leecbaker Avatar asked Nov 28 '12 22:11

leecbaker


1 Answers

The initialization file for gdb is called .gdbinit. You can put your desired options in this file. They'll be automatically executed during gdb's startup.

Example content:

# set command line argument to "2"
set args 2

You may put the .gdbinit file into your $HOME or current directory. The latter overrides the settings in the global $HOME/.gdbinit file.

like image 134
harpun Avatar answered Nov 27 '22 04:11

harpun