简体   繁体   English

Qt Creator GDB使用调试助手进行远程调试

[英]Qt creator gdb remote debugging with debug helpers

Setup so far 到目前为止的设置

1. Building gdb 1.建立gdb

The latest versions of Qt creator require gdb to be compiled with python support. Qt Creator的最新版本要求gdb必须使用python支持进行编译。 Compiling gdb for remote arm with python support. 使用python支持为远程手臂编译gdb。

  1. Get gdb source from here http://www.gnu.org/software/gdb/download/ 从此处http://www.gnu.org/software/gdb/download/获取gdb来源
  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. 使用以下参数运行configure。 NOTE: arm-linux-gnueabi this should be the prefix to your cross compiler binaries that are in PATH. 注意: arm-linux-gnueabi这应该是PATH中交叉编译器二进制文件的前缀。

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

  5. Run make 运行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. 如果一切顺利,则应该在gdb-7.7.1/build/gdb/gdb/使用python支持编译一个gdb可执行文件,该文件可以与arm上运行的gdbserver通信。

2. Building gdbserver 2.构建gdbserver

The source for gdbserver is in the gdb source. gdbserver的源位于gdb源中。

  1. (Optional) Create a build dir for the gdbserver (可选)为gdbserver创建一个构建目录

    mkdir -p build/gdbserver

  2. Prepare the gdbserver for cross compilation 准备gdbserver进行交叉编译

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

  3. Run make 运行make

If all went well, you should have the gdbserver executable in gdb-7.7.1/build/gdbserver/ . 如果一切顺利,则应该在gdb-7.7.1/build/gdbserver/具有gdbserver可执行文件。

3. Migrating the gdbserver to the target 3.将gdbserver迁移到目标

The gdbserver has to be located on the target device on which the code you're debugging will be run. gdbserver必须位于要运行您要调试的代码的目标设备上。 I've just moved it to /usr/bin with scp . 我刚刚使用scp将其移动到/usr/bin Since /usr/bin is in PATH, that makes gdbserver available in the remote terminal. 由于/usr/bin位于PATH中,因此gdbserver在远程终端中可用。

4. Setting up Qt creator 4.设置Qt创建者

To be able do deploy and run from Qt Creator you need to specify the way how it should connect to the target. 为了能够从Qt Creator部署和运行,您需要指定如何连接到目标。 In Devices add a new device with the required parameters. Devices添加具有所需参数的新设备。 I'm using openssh on the target with password authentication. 我在具有密码身份验证的目标上使用openssh。 Run test to check if this step passes. 运行测试以检查此步骤是否通过。

To define the run path on the target add the following to the .pro file: 要在目标上定义运行路径,请在.pro文件中添加以下内容:

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

NOTE: you can check the run settings in Projects->Run . 注意:您可以在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. Build and Run-> Kits -> "Your cross compiler kit name" ,为Debugger属性选择Manage... Add a new debugger which points to the gdb executable that was compiled in step 1. 添加一个新的调试器,该调试器指向在步骤1中编译的gdb可执行文件。

Also, be sure to enable Use Debugging Helper in Debugger->Locals & Expressions to get the QStrings interpreted correctly. 另外,请确保在Debugger->Locals & Expressions启用Use Debugging Helper ,以正确解释QString。

I came this far succesfully 我成功地走了这么远


The problem 问题

When I compile a sample code and run on the host everything works. 当我编译示例代码并在主机上运行时,一切正常。 在此处输入图片说明

but when I try doing it on the remote, nothing is accessible. 但是当我尝试在遥控器上进行操作时,无法访问任何内容。

在此处输入图片说明

The error that pops out it: 弹出的错误:

在此处输入图片说明

I'll be updating this as new insights occur. 随着新见解的出现,我将对此进行更新。

The "Can not parse XML..." message comes from gdb. “无法解析XML ...”消息来自gdb。 Make sure to libexpat development package in sight when you configure gdb for building. 配置用于构建的gdb时,请确保将libexpat开发包放在眼前。

This might not be the real problem, though. 但是,这可能不是真正的问题。 I see "stty". 我看到“ stty”。 How do you specify the connection to the remote target? 如何指定与远程目标的连接?

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. 我无法将其与有关XML的错误相关联,但是一旦在Build&Run-> Kits-> Sysroot中设置了正确的Sysroot,就可以解决该问题。

Don't know what sysroot it used by default... 不知道默认情况下使用了什么sysroot ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM