13

I installed gcc-arm-linux-gnueabihf cross-compiler on Ubuntu 12.04, and now I am able to build a program for embedded device. Where can I find cross gdb for debugging?

gcc-arm-linux-gnueabihf reference contains gdb-arm-linux-gnueabihf in the Related Packages list, which seems to be the debugger that I am looking for. But this package is not available.

Alex F
  • 42,307
  • 41
  • 144
  • 212
  • Try toolchain from http://www.codesourcery.com/sgpp/lite/arm/download.html – anishsane Nov 07 '12 at 12:41
  • @anishsane - Thanks, I have already tried it, but device vendor recommends gcc-arm-linux-gnueabihf. Now I need to find (or possibly to build) cross-debugger for this device. – Alex F Nov 07 '12 at 12:48
  • @anishsane - can you recommend good embedded Linux forum? I don't post such question here, because such questions are immediately closed :( – Alex F Nov 07 '12 at 12:51
  • I think, you can get in touch with community like beagle-board, etc. (It's a very active google group.) There you will get good help at least for arm+linux combination. It will be specific to beagleboard, but I think, for simple requirements, they can guide you. – anishsane Nov 07 '12 at 13:49

2 Answers2

16

I recommend getting gdb from the Linaro toolchain rather than the Ubuntu repositories. Download gcc-linaro-arm-linux-gnueabihf-4.7-2012.10-20121022_linux.tar.bz2 from here and you'll find:

  • bin/arm-linux-gnueabihf-gdb
  • arm-linux-gnueabihf/debug-root/usr/bin/gdbserver

The latter is statically linked and of course built for ARM Linux.

Assuming you have networking already set up to your target board, copy gdbserver to it and run:

$ gdbserver --multi :2345

On your development machine, run:

$ arm-linux-gnueabihf-gdb
(gdb) target extended BOARD-IP-ADDR:2345
(gdb) set remote exec-file /bin/true
(gdb) run

and you're up and running with remote cross debugging.

Links to the Linaro bug tracker, mailing list and web forum are here. They're very active in ARM Linux toolchain, kernel, QEMU development as you can see from their release notes.

scottt
  • 7,008
  • 27
  • 37
  • 2
    Thanks, got it working. Nice to see that there are embedded developers in this forum. – Alex F Nov 08 '12 at 06:21
  • For me arm-linux-gnueabihf-gdb doesn't start on a 64-bit machine do you know if it is only for 32bit? – eactor Jul 22 '13 at 07:09
  • 1
    @eactor, see http://askubuntu.com/questions/297151/how-to-run-32-bit-programs-on-a-64-bit-system-ubuntu-13-04 – scottt Jul 22 '13 at 07:14
  • ok somehow the output of the programm is issued to the target board instead of forwarded to the devlopment machine, is that normal and can i change it? – eactor Aug 02 '13 at 10:47
  • @eactor, ask that as a new question tagged with "embedded-linux" and provide details of how you're connecting to the target board and starting your program. The short answer is _yes_ ;) – scottt Aug 02 '13 at 14:20
  • @scott I did thx in advance http://stackoverflow.com/questions/17995734/gdb-server-output – eactor Aug 05 '13 at 06:05
  • Thanks! Needed this to realize I can do exactly the same with `gdbserver` and `arm-linux-androideabi-gdb` on Android devices. – domen Nov 20 '13 at 14:51
  • I'm trying to push this and run this on arm android device, but it is not liking the file, looks like this is file, getting, not executable: magic 7F45 – user3826306 Sep 18 '17 at 10:57
  • @domen - Were you able to get the gdbserver from linaro to work on arm 64 bit processor ? I can see a similiar link - https://blueprints.launchpad.net/linaro-toolchain-binaries/+spec/aarch64-build but there are no downloadable items – badri Jan 08 '19 at 13:34
  • @badri if you're talking about Android, there's now a `gdbserver64/gdbserver` on target and a unified (all arch) `gdb` (prebuilt in NDK package) for host. – domen Jan 08 '19 at 14:21
  • Thanks domen. It is actually for arm processor. – badri Jan 09 '19 at 11:03
8

You need to install the gdb-multiarch package, then run gdb-multiarch command to remotely debug your target.

user2104315
  • 81
  • 1
  • 1
  • That solved it for me, thanks! I'd much rather install a package from the official repositories, than from a third-party website. – chrset Dec 12 '18 at 13:26