tags:

views:

487

answers:

3

Hi,

I have a XCode which builds and runs under XCode. I would like to know if it is possible to debug it using a gdb I build under Mac OSX (gdb 7 to be specified). If yes, can you please tell me how can I do that?

Thank you.

A: 

XCode's debugger is gdb (likely with Apple-specific modifications.) When you debug an application you can get to the gdb command line by opening the Console from the Run menu.

What requirements are imposed on your application that would require you to debug with your own version of gdb?

fbrereto
I would like to take advantage the 'Reverse debugging, Process record and replay' feature new in gdb 7.0.
n179911
+1  A: 

So you want to use your own version of gdb to debug your executable? Easy!

Open Terminal, and do something like this:

$ cd <directory where Xcode project lives>
$ cd build/Debug                 (for example - depends on project configuration)
$ /usr/local/bin/my-gdb ./MyExecutable

Of course, specifying the actual path to your custom gdb version.

Nick Dowell
+1  A: 

gdb-7.0 reverse debugging currently can only work with two classes of targets: 1) a remote simulator/emulator/virtual-machine that supports going backwards, or 2) the built in "process record" target, which at present has only been ported to x86-linux, x86-64 linux, and moxie linux.

Well, now -- I take that back. I recently discovered that process record can work with any remote x86 target, so if you're connecting with your macintosh target via "target remote", you might just be able to do it!

There is an online tutorial for process record here: http://www.sourceware.org/gdb/wiki/ProcessRecord/Tutorial More info about process record here: http://www.sourceware.org/gdb/wiki/ProcessRecord And about gdb reverse debugging here: http://www.sourceware.org/gdb/wiki/ReverseDebug

Michael Snyder