远程gdb调试 [英] Remote GDB debugging

查看:231
本文介绍了远程gdb调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚花了一整天的时间试图找到一种方法,能够从QtCreater或者Eclipse gdb调试。我了解到,基本上有发射目标应用两种方式:

I've just spent a whole day trying to find a way to enable gdb debugging from QtCreater or Eclipse. I learned that there are basically two approaches to launch the target application:


  • 使用ssh( SSH主机GDB

  • 使用gdbserver的

我能够使用这两种方法来GDB远程启动和启动应用程序。然而,GDB从来没有reponds在IDE中设置的任何断点。此外,我不能停下来检查程序状态的应用程序。在QtCreator我只是得到一个不起眼的堆栈跟踪(我可能一直在寻找ssh或GDB的痕迹居然...)。

I was able to use both approaches to launch gdb remotely and start the application. However, GDB never reponds to any breakpoints set in the IDE. Also I can't pause the application to inspect the program state. In QtCreator I just get an obscure stack trace (I might have been looking at the traces of ssh or gdb actually...).

谁能帮我开始?

我发现,QtCreater 2.0有一个叫做功能附加和调试远程机应用。它是基于gdbserver的。好事是,它停在IDE的断点。但是有两个问题:

I found that with QtCreater 2.0 there is an feature called "Attach and debug remote appliction." It's based on gdbserver. The good thing is that it stops on the IDE's breakpoints. However there are two issues:


  • 当遇到断点那只能说明装配code,而不是源$ C ​​$ C

  • gdb的退出往往因接收信号

我也许应该提及的是,远程可执行文件与一个比安装在我的本地计算机上的旧版本的GCC编译。也许有些问题都与此有关。

I should probably mention that the remote executable is compiled with an older version of gcc than the one installed on my local PC. Perhaps some of the problems are related to this.

我要指出,我切换到通过ssh远程机器上运行 cgdb

I should mention that I switched to running cgdb on the remote machine via ssh.

远程基于QtCreator-溶液也不稳定。 GDB往往因为神秘的信号接收的邮件的退出。

The remote QtCreator-based solution wasn't stable. GDB tends to quit because of mysterious 'signal received' messages.

推荐答案

由于我们的makefile构建系统包含在调试符号文件引用的特点是这样的:

Due to peculiarities in our makefile buildsystem the file references contained in the debugging symbols look like this:

../src/main.cpp
../../src/utils/logger.cpp

这是对GDB没有问题,但QtCreator无法将这些路径的实际文件映射。我能够通过添加gdb的init文件'目录'语句来解决这个问题:

This is no problem for gdb, but QtCreator was unable to map these paths to the actual files. I was able to fix this by adding 'dir' statements in the gdb init file:

dir src
dir src/utils
...

现在它的工作原理。

这篇关于远程gdb调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆