5

I'm working on a Embedded Linux application and I would like to use GDB to debug it. The problem is that, although the Kit configuration seems fine (the Debugger option is correctly pointed to the GDB correspondent to the device's GCC - device is a Linux ARM), when I ask Qt Creator to run in debug mode it returns an error in the "Application Output":

sh: gdbserver: not found

This seems strange since, as I sad, the configuration is fine and no error about that is reported by Qt Creator in any moment before starting debug mode.

I did some research on the web to find which was the exact steps to use GDB to debug an Embedded Linux application from within Qt Creator (to use breakpoints, etc.) and the closest thing to an answer I got was this commentary by Tobias Hunger:

You will need to have ssh and gdbserver installed on your board for this to work. Then you need to set up your board [qt-project.org] in Creator. Afterwards you need to set up a kit [qt-project.org] using this device.

Those steps, thought, are not clear to me.

  • First, why would I need to have a GDB inside the device if the Kit should point to my local GDB?
  • Or it shouldn't?
  • Where would I put the GDB anyway?
  • How do I know if I have this ssh on my device?
  • If I don't, how do I install it?
  • All the other mentioned steps are already done, but related to the GDB located on my Desktop Ubuntu. Should I change something if I do the above steps?

And of course, is this manual my Tobias complete or do I need to do something else for this to work?

Momergil
  • 2,213
  • 5
  • 29
  • 59

1 Answers1

8

You need gdb and ssh on your Ubuntu and gdbserver and sshd on your device: actually when you deploy a project on a remote device using QtCreator, it makes use of ssh for copying the files to target, then it launches gdbserver on the device (attached to the executable that you want to debug) and then launches gdb on your Ubuntu connecting to the running gdbserver on the device.

So you need all of them to make things working.

ssh and gdb can be installed on your Ubuntu simply via apt-get. Instead the installation of sshd and gdbserver on your board is platform-specific: it can be that some boards already have them in their standard system image, or maybe in some cases it is up to you to install them... if your Linux distribution on the board has some package manager then you might try to use it... in the worst case you will have to compile them on your own for your board and install them manually.

Morix Dev
  • 2,700
  • 1
  • 28
  • 49
  • Thanks for the reply; great answer! The unique problem is that I wasn't capable of finding a download link for this `gdbserver`; most results in Google points to `GDB` only, and even the Wikipedia page about it doesn't point to a repository or download link. So how/where can I download that for my embedded Linux? – Momergil Sep 05 '14 at 14:08
  • of course, I'm talking about a `gdbserver` to compile and install in my Embedded Linux device; to install it on my Desktop machine is OK by Synaptic (and, in this case, it's already installed and it still not working as expected) – Momergil Sep 05 '14 at 14:37
  • well, finally I did manage to make remote debugging :) The only difference from what I did and what you answered is that I didn't need to compile a `gdbserver` specifically for my external device; I just used the one that came with the `linux-devkit` that I'm using to compile my apps to the device, copying it to the `/usr/bin/` directory in my Embedded Linux (`chmod +x` later required). – Momergil Sep 05 '14 at 17:03
  • 1
    @Momergil: I am sorry but I read only now your comments... I am glad that finally you did it! Anyway the source code of `gdbserver` is included in `gdb` package, so if you download it from [here](http://ftp.gnu.org/gnu/gdb/) then you will also have `gdbserver`. Please consider accepting my answer if you think that I helped you :) – Morix Dev Sep 06 '14 at 06:44
  • Well it definitely helped, although I didn't have to use a "custom" compiled `gdbserver` as previously mentioned :) – Momergil Sep 08 '14 at 13:53
  • you can try this on device : `sudo apt-get install gdbserver` – Tuncay Ince Nov 08 '20 at 12:25