marmottus
marmottus

Reputation: 371

How to debug ARM from Mac OS X

I'm developing on a ARMv5 board and I'm trying to debug a program on it using an intel Mac OS X,

I tried on Linux without any problem (I compiled the binary using gnueabi toolchain), I run a gdbserver on the board and connect to it on the host machine and everything was fine.

But on Mac OS X it seems to be much more tricky, I think I need a cross compiled gdb too for ARM target but I don't want to install all the toolchain.

Since Mac OS supports iOS remote debugging, isn't there a gdb which could work for ARM remote debugging?

And another question: why do we need a cross-compiled debugger for remote debugging? Can't simply the server and the client communicate by the network without being architecture dependent?

Thank you.

Upvotes: 3

Views: 5778

Answers (2)

Variable Length Coder
Variable Length Coder

Reputation: 8116

The Apple tools are going to be of little use to you unless you are using the Mach-O object format. You will need to build your own toolchain. If you have Macports installed this will be easy as it includes a port of the arm-elf-eabi toolchain. See http://www.macports.org/ports.php?by=name&substr=eabi

Upvotes: 1

marko
marko

Reputation: 9159

You will require a build of gdb not only configured for the correct architecture, but also object file type: remember that MacOSX/Darwin uses MachO object files where as GNU/Linux systems use ELF.

When using gdbserver, gdb is run on the development host, and reads executables and libraries in order to build a symbol-map corresponding to the target. It's for this reason that the gdb that Apple ships - which is built for Darwin and MachO binaries - doesn't work.

As for why things are as they are, this is an architectural limitation of gdb, binutils and incidentally gcc - all of which can only ever handle one target environment at once.
With remote debugging scenarios, there is often a need minimise link traffic and target memory foot-print. Remember, the comms link is sometimes a low speed serial-line. For this reason, as much as possible is done on the development host with gdbserver transacting very low-level operations.

Building a cross-gdb environment for MacOSX shouldn't pose any particular issues.

Upvotes: 3

Related Questions