linux - Qt Creator/gdb/远程调试/交叉编译: solib-search-path not used

标签 linux gdb qt-creator cross-compiling remote-debugging

我使用 Qt Creator 3.2.1 和 gdb 7.6.2(来自 QorIQ SDK 1.8powerpc64-fsl-linux-gdb )来调试交叉编译的应用程序。

在我的 ppc64 测试机(Yocto)上运行 gdbserver:gdbserver :666/path/to/myapp

然后我在 x86_64 开发机器 (Debian) 上使用 Qt Creator 连接到 gdbserver。我已经指定了 Kit(sysroot 是 /opt/fsl-networking/QorIQ-SDK-V1.8/sysroots/ppc64e6500-fsl-linux)、工具链 gdb 等......到目前为止,这有效。我可以调试任何应用程序。

但是,如果我的应用程序动态链接到一个库,并且我想调试该库 (/path/to/libmylib.so),则 Qt Creator 中的 gdb 无法单步执行 mylib 的断点。

我想要用 Qt Creator 做的事情是像这样:

  1. Yocto:启动 gdbserver
  2. Debian:运行 powerpc64-fsl-linux-gdb/path/to/myapp 并输入
    • 设置 solib-search-path/path/to/mylib/
    • 目标远程 192.168.120.211:666
    • 中断 MyLibraryFunctionIWantToDebug
    • 运行
    • c

日志:

GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-fslsdk-linux --target=powerpc64-fsl-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /path/to/myapp...done.
(gdb) show solib-search-path
The search path for loading non-absolute shared library symbol files is .
(gdb) set solib-search-path /path/to/mylib/
(gdb) show solib-search-pat
The search path for loading non-absolute shared library symbol files is /path/to/mylib/.
(gdb) target remote 192.168.120.211:666
Remote debugging using 192.168.120.211:666
(gdb) break MyLibraryFunctionIWantToDebug
Breakpoint 1 at 0x10001088: file /path/to/myapp/myapp.c, line 196.
(gdb) run
The "remote" target does not support "run".  Try "help target" or "continue".
(gdb) c
...

迄今为止的研究:

  • gdb has a bug in version 7.4 (我现在使用的是 7.6.2)
  • 我可以将 set solib-search-path/path/to/mylib/ 命令放入 .gdbinit 。在 Qt Creator 中,每个 .gdbinit 文件都会被忽略。我尝试过多个位置,例如~/.gdbinit/path/to/myapp/.gdbinit、Qt 创建者中的命令行参数选项:-x ~/.gdbinit、工具 > 选项 > 调试器将命令放入每个附加字段中。没有一个有效:-(
  • 我并不是唯一有此疑问的人,请参阅 herehere

使用共享库时,有什么想法如何在 Qt Creator 中与 gdb 进行交叉调试吗?

最佳答案

也许它随着 QtCreator 3.6(我正在使用的)而改变,但如果我将 set solib-search-path 命令放入“附加附加命令”fiend 中,并且仅在该字段中,我就可以使用它了。

当然,我的案例可能并不完全适用于您的情况,因为它不是完整的交叉编译,而是在与我的远程目标运行的 Linux 版本不同的 Linux 版本上运行 GDB 的情况。

关于linux - Qt Creator/gdb/远程调试/交叉编译: solib-search-path not used,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32312266/

相关文章:

c++ - 我可以使用自定义样板模板创建 Qt Creator 项目吗?

c++ - 通过qtcreator/qtdesigner给QMenu添加QWidgetAction

java - maven-resources-plugin :2. 6 - 无法创建资源输出目录

linux - Windows有中断上下文吗?

linux - 如何让 Linux 使用 cat 只显示文本文件中的最后一段?

emacs - 通过emacs运行时设置gdb的环境

debugging - 如何使用 MacPorts 在 MacOS Lion 上设置/使用 GDB 7

windows - 当我的 Git 存储库在 Linux 上时如何在 Windows IDE 上工作(使用 VMPlayer)

gdb - 加载后在 gdb 下运行程序的命令行选项?

qt - 找不到有效的设置文件