30

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? Thanks

saman01
  • 884
  • 4
  • 12
  • 25

5 Answers5

24

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,526
  • 4
  • 43
  • 63
23

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
  • 936
  • 1
  • 8
  • 24
  • 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
4

You can do

nano ~/.gdbinit

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

Dharman
  • 26,923
  • 21
  • 73
  • 125
willis
  • 301
  • 2
  • 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
  • 13,978
  • 10
  • 59
  • 92
0

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

fizzbuzz
  • 113
  • 1
  • 1
  • 8