问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/25674703/how-to-do-a-remote-debug-using-gdb-from-qt-creator