gdb fails on mountain lion

dlangenk picture dlangenk · Aug 21, 2012 · Viewed 11.4k times · Source

I tried to compile a 7.x Version of gdb without any luck. I codesigned the executable(http://sourceware.org/gdb/wiki/BuildingOnDarwin).

With following version there were these problems.

7.5,7.4,git clone: unknown load command 0x2a (and others) for my application and different system libraries when starting gbd. When trying to print a vector for example i always get: Could not find the frame base for "main(int, char**)"

7.3 (macports and from gdb-website): on starting the application it fails to set the breakpoint and continues to run.

(gdb) start
Temporary breakpoint 1 at 0x100000950: file ../src/main.cpp, line 15.
Starting program: [...]
BFD: unable to read unknown load command 0x24
BFD: unable to read unknown load command 0x2a
BFD: unable to read unknown load command 0x26
Error in re-setting breakpoint 1: Cannot access memory at address 0x100000950
[application continues]

I used the system llvm-gcc, gcc4.7 and svn-gcc4.8 to compile. Has anybody succeeded in installing gdb on Mountain Lion?

Answer

aviak picture aviak · Sep 11, 2012

i installed gdb 7.5 on mountain lion without problems...

  1. those steps might help you: ./configure --prefix=/usr/local --enable-targets=x86_64-apple-darwin10 --enable-64-bit-bfd --disable-werror --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --target=x86_64-apple-darwin10

  2. then make install gdb.

  3. create your own certificate like discribed here and sign the gdb http://sourceware.org/gdb/wiki/BuildingOnDarwin

  4. you have to explicitly state: codesign -s gdb-cert /usr/local/gdb before you sign the gdb make sure you already set your certificate to trusted. also close the keychain before signing your gdb.

hope this also works for your