1
votes

Setup so far

1. Building gdb

The latest versions of Qt creator require gdb to be compiled with python support. Compiling gdb for remote arm with python support.

  1. Get gdb source from here http://www.gnu.org/software/gdb/download/
  2. Extract and move to the extracted directory
  3. (Optional) Create a build folder

    mkdir -p build/gdb

  4. Run configure with the following parameters. NOTE: arm-linux-gnueabi this should be the prefix to your cross compiler binaries that are in PATH.

    ../../configure --target=arm-linux-gnueabi --with-python

  5. Run make

If all went well, there should be a gdb executable in gdb-7.7.1/build/gdb/gdb/ compiled with python support that can communicate with a gdbserver running on arm.

2. Building gdbserver

The source for gdbserver is in the gdb source.

  1. (Optional) Create a build dir for the gdbserver

    mkdir -p build/gdbserver

  2. Prepare the gdbserver for cross compilation

    ../../gdb/gdbserver/configure --host=arm-linux-gnueabi

  3. Run make

If all went well, you should have the gdbserver executable in gdb-7.7.1/build/gdbserver/.

3. Migrating the gdbserver to the target

The gdbserver has to be located on the target device on which the code you're debugging will be run. I've just moved it to /usr/bin with scp. Since /usr/bin is in PATH, that makes gdbserver available in the remote terminal.

4. Setting up Qt creator

To be able do deploy and run from Qt Creator you need to specify the way how it should connect to the target. In Devices add a new device with the required parameters. I'm using openssh on the target with password authentication. Run test to check if this step passes.

To define the run path on the target add the following to the .pro file:

linux-* {
         target.path = .
         INSTALLS += target }

NOTE: you can check the run settings in Projects->Run. Add a kit first if you can't find the run button.

In the Build and Run-> Kits -> "Your cross compiler kit name" select Manage... for the Debugger attribute. Add a new debugger which points to the gdb executable that was compiled in step 1.

Also, be sure to enable Use Debugging Helper in Debugger->Locals & Expressions to get the QStrings interpreted correctly.

I came this far succesfully


The problem

When I compile a sample code and run on the host everything works. enter image description here

but when I try doing it on the remote, nothing is accessible.

enter image description here

The error that pops out it:

enter image description here

I'll be updating this as new insights occur.

2

2 Answers

1
votes

The "Can not parse XML..." message comes from gdb. Make sure to libexpat development package in sight when you configure gdb for building.

This might not be the real problem, though. I see "stty". How do you specify the connection to the remote target?

1
votes

I can't relate it to errors regarding the XML, however the issue was solved once the correct Sysroot was set in the Build&Run->Kits->Sysroot.

Don't know what sysroot it used by default...