33

I am having a exception crash issue and I am trying to edit this file to get more info about the crash.

Where is .gdbinit is located and how can I edit it?

saman01
  • 924
  • 4
  • 12
  • 25

5 Answers5

26

You can also put .gdbinit in your debugging folder, this makes more applicable for debugging different apps. GDB will automatically load ./.gdbinit for current debugging.

coanor
  • 3,746
  • 4
  • 50
  • 67
25

You need to create a new file called .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.

Panshul
  • 956
  • 1
  • 10
  • 25
  • Thanks now I have the .gdbinit file in my home directory. Where can I locate the crash result? – saman01 Mar 06 '12 at 10:56
  • You can add this system default to your .gdbinit to log Xcode's GDB output to a file. So when you execute your program, your logs will be written to the log file: defaults write com.apple.dt.Xcode IDEGDBLogToFile /tmp/logs.txt – Panshul Mar 06 '12 at 16:33
6

You can do

nano ~/.gdbinit

modify your file and save it. Verify the changes with cat ~/.gdbinit

Dharman
  • 30,962
  • 25
  • 85
  • 135
willis
  • 321
  • 3
  • 5
2

You may want to add the line echo "set disassembly intel" > ~/.gdbinit. For example:

gdb@Name:~$ echo "set disassembly intel" > ~/.gdbinit
gdb@Name:~$ cat ~/.gdbinit
set disassembly intel
gdb@Name:
Rubens
  • 14,478
  • 11
  • 63
  • 92
-1

go to the root directory using cd ~/ or cd root, then create .gdbinit

fizzbuzz
  • 159
  • 1
  • 1
  • 8