Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Creator remote debugging

I have an application that I run on an Embedded Linux device. In Eclipse, I can run remote debugging using the eclipse-cdt-launch-remote plugin where I point a binary to run, and where to put it on the device with some environment variables to be exported before running the application. The application is a C++ application with a custom Makefile for building the application as an ELF file.

The application is deployed on the device via SSH, using login with user and password. And then, I can debug from Eclipse using stepping and so on. (I am also using the MentorGraphics crosscompiler for arm-none-linux-gnueabi-2014.05)

My question is: How do I mimic the same functionality in Qt Creator since I like coding with Qt Creator more than coding with Eclipse? I know that an easy fix would be to code in Qt Creator, and then debug using Eclipse, but I really want to debug using Qt Creator.

  • Edit: Solved it by hours of testing and reading up on the Qt Creator IDE.
    1. Imported my project that was an Makefile project.
    2. Then I went in to Options under Tools and added my Device that used SSH.
    3. After that I added a debugger, I used gdb-multiarch since the one provided in the prebuilt toolchain binary did not support python.
    4. Then I added my custom toolchain pointing the compiler path to the toolchains binary g++. And set the ABI to arm-linux-generic-elf-32bit. Although I dont actually see the compiler settings being used during debug.
    5. I created a new kit using my Device, Debugger, and Compiler. And set device type to Generic Linux Device. Pointing to my sysroot that I extracted when using buildroot for the filesystem. These were the only options I set in the kit.
    6. Closed the options menu, and went into Projects where I added my new kit
    7. Changed the build settings and set the build directory and build steps for the application.
    8. Changed the run settings to use some custom commands, like moving the newly built .elf application to target. And then I set where the local executable was and where the remote executable was. The remote executable is the one I moved to the target using custom command from host.
    9. Voila! I could now run remote debugging on my target from Qt Creator.
like image 450
YoloMcSwaggy Avatar asked Apr 04 '16 09:04

YoloMcSwaggy


1 Answers

Qt Creator has built-in support for automatic deploy on remote devices.

On the Embedded Linux device:

  • Create a login password for the root user
  • Install the openssh-server and gdb-server packages

On Qt Creator:

  • Enter Tools > Options > Devices and create a new device specifying address (i.e. IP and port numbers) and credentials (i.e. root and password). Further information available here.
  • Enter Tools > Options > Build & Run > Compilers and add the gcc cross-compiler path (further information available here)
  • Enter Tools > Options > Build & Run > Debuggers and add the gdb cross-debugger path (further information available here)
  • As the last step, finally enter Tools > Options > Build & Run > Kits and link compiler, debugger and device into a single Kit, also specifying the sysroot (i.e. local copy of the embedded Linux root filesystem).
  • Set the build target to Debug.
  • In the Qt project, check that all deploy steps are selected (e.g. transfer file to the remote device) and add any needed argument (e.g. -qws for touchscreen on Qt 4.x)

In general, have a look at the guide here.

like image 87
Claudio Avatar answered Nov 12 '22 07:11

Claudio