QtCreator 2.6: remote Linux debugging issues
I'm encountering some issues when remote debugging a Qt application using QtCreator 2.6.1.
- Target: ARM embedded Linux with Qt4.7 and gdbserver
- Host: x86 running QtCreator 2.6.1 and gdb
On QtCreator, I have added compiler, Qt libraries, device and kit on Tools->Options->Build&Run:
- Name: mytarget
- Type: Generic Linux
- Machine type: Physical Device
- Authentication Type: Password
- Host name: <target IP address>
- Free Ports: 1000-10100
- SSH port: 22
- Timeout: 5s
- Username: root
- Password: <my password>
- Name: myboard
- Device type: Generic Linux Device
- Device: mytarget
- Sysroot: (empty)
- Compiler: link to the compiler I have added
- Debugger: link to the cross gdb (i.e., arm-linux-gdb)
- Qt version: link to the new Qt I have added
- Qt mkspec: link to a specific mkspec that I have created starting from linux-g++
With these settings, I have been able of successfully cross-compiling my application.
When trying remote debugging, the only viable method seems to be "Attach to Running Application", since:
- "Start and Debug external application" doesn't let select my kit (i.e., only "Desktop" is available)
- "Attach to Remote Debug Server" doesn't let select my kit (i.e., only "Desktop" is available)
- "Start Remote Debug Server Attached to Process" does nothing
Therefore, I have started my remote application and used "Attach to Running Application" to start remote debugging.
The result of "Attach to Running Application", however, changes based on kit's sysroot setting:
If I leave sysroot empty, then remote debugging complains with the error message "Cannot find ABI for remote process"
If I set sysroot equal to a copy of the remote filesystem, then remote debugging complains with the error message "Cannot find local executable for remote process"
Finally, if I set sysroot equal to the build directory of the project, remote debugging works
I would really appreciate if someone can answer one or more of the following questions:
1. What is the purpose of kit's sysroot field and what it should contain ?
2. I assume that the kit should be a property independent by the specific project. So, why remote debugging works only if I set sysroot equal to the application build directory ?
3. What is the right method for remote debugging of a Qt application in my scenario ? "Attach to Running Application ?
4. Why "Start and Debug external application" and "Attach to Remote Debug Server" don't let me select my kit ?
Many thanks for your help.
The remote linux support needs ssh on the device as well as gdbserver. Are these two installed?
Provided you set up deployment (Projects>Your Project Name>Kit Name>Run, top area on that page), you should be able to deploy and debug simply by hitting the debug button in the lower left of the Qt Creator UI.
The sysroot is where the compiler will look for additional headers/libraries your binary needs. It should basically point to a copy of your device's filesystem (with the additions of headers and debugging symbols that are often not deployed to embedded devices since they are not necessary to run the software).
Many thanks for your quick reply.
Here are my answers:
Yes, both ssh and gdbserver are installed on the target. Indeed, QtCreator can run gdbserver, and could even debug when syroot was set equal to the application build directory (which was a wrong setting, according to your answer)
Acttually, I have not set "Run Settings" for my project. I come from Eclipse, so I was looking for a way to start debugging manually. What "Run Settings" should contain in my specific scenario.
Thank you for your clarification about sysroot. So, if I let it point to a copy of my device’s filesystem, I get the “Cannot find local executable for remote process” error message. Now I guess that setting "Run Settings" properly, this error should disappear....
You seem to have rather messed up deployment then:-)
Please check your Kit: Is the device configuration correct?
Check the device configuration again: Does the "test configuration" button work there?
Are you really using the kit for the device in your project? Check "Projects" mode, button is on the left side. Is the device-kit the one that is displayed right away? How do the deployment settings look (in the run section): Does it have some entries there ("Copy to remote device" or something similar, don't remember exactly and there are several options to start with)? If that is empty, then you are not deploying your program to the device at all.
If you are indeed not deploying to your device (and that is what this looks like), then it will produce code for your local machine and try to run it there... not what you want at all.
Many thanks for your help. Adding the proper settings about Run and Deploy I have been able to succesfully debug my application (keeping sysroot/ to the correct value).
Many thanks again. Just a suggestion: the documentation should explain people that deployment steps are needed to have a working debug :)
Great, happy hacking then!
Please consider to "file a bug report":https://bugreports.qt-project.org/ with any improvements you want to see, incl. missing documentation;-) That way issues will not get lost, which they will otherwise.