Qt Creator 2.7.1和Qt 4.8.4无法远程调试库

5

使用Qt Creator 2.7.1和Qt 4.8.4,我创建了一个Qt库和一个简单的Qt应用程序,它动态链接到这个库。我尝试远程部署和调试我的应用程序,并在调用它们时逐步进入我的库函数。我可以成功地设置断点并进行远程调试,但是我无法使用调试器(gdb)逐步进入我的库函数。当我首次在调试模式下使用QtCreator远程启动我的应用程序时,会出现以下警告:

Could not load shared library symbols for 7 libraries, e.g. libcustom-stuff.so.1.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?

我的调试器是使用Qt Creator设置的,如下图所示(请注意,我在第3张图中切换了“目标路径”和“路径”,但并没有帮助): enter image description here enter image description here enter image description here 我的“工具包”设置如下: enter image description here 在Qt Creator中的“调试器日志”中,我输入了“命令”:
info sharedlibrary

我得到的回复是:
>~"From        To          Syms Read   Shared Object Library\n"
>~"0x400007e0  0x40011bf0  Yes         /home/user/proj/output/buildroot/host/usr/arm-buildroot-linux-gnueabi/sysroot/lib/ld-linux.so.3\n"
>~"                        No          libcustom-stuff.so.1\n"
>~"0x4006d018  0x400d7124  Yes         /home/user/proj/output/buildroot/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib/libQtDBus.so.4\n"
>~"0x401065c4  0x4013dd18  Yes         /home/user/proj/output/buildroot/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib/libQtXml.so.4\n"
>~"0x40172430  0x4024c1b4  Yes         /home/user/proj/output/buildroot/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib/libQtNetwork.so.4\n"

我还确保库和应用程序都使用以下方式构建:

CONFIG+=declarative_debug

在库和应用程序的“编译输出”窗格中,我看到了“-g”标志。它们都位于文件系统上的同一个目录中,那么是什么原因导致我可以在应用程序中进行调试并设置断点,但无法进入库调用?非常感谢您的任何想法。
更新: 根据kikeenrique的建议,我尝试从我的Ubuntu主机(而不是ARM目标)加载调试符号:
GNU gdb (Ubuntu/Linaro 7.4-0~69~lucid1) 7.4
Copyright (C) 2012 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Welcome to Fluke GDB Init Script for QtCreator
Reading symbols from /home/user/proj/output/exported-nfs/home/user/libcustom-stuff.so.1.0.0...done.
(gdb)

看起来GDB至少能够加载符号。
1个回答

6

您是否在使用不同的架构远程应用程序?

如果它们不同,您需要使用相同的gdb服务器和客户端架构。

尝试在您的项目->构建和运行->构建环境中设置LD_LIBRARY_PATH,并使用库的路径。


是的,远程架构是ARM。我可以在我的主应用程序中很好地进行调试,但无法从调试我的主应用程序进入我的库(也为ARM构建)。 - PhilBot
@philbot 请尝试在gdb中手动加载您的符号文件(命令symbol-file path/to/your/library)。libcustom-stuff.so的路径是什么? - kikeenrique
我可以手动从我的主机加载它们-请参见我上面编辑的帖子。应用程序和库都位于目标计算机的/home/user中。 - PhilBot
@PhilBot,你可以尝试在项目->构建和运行->构建环境中设置LD_LIBRARY_PATH,并将路径指向你的库吗? - kikeenrique
1
哇 - 成功了,我的LD_LIBRARY_PATH设置错了。非常感谢你。 - PhilBot
各位好,你们能否详细说明一下这个问题?我正在尝试将LD_LIBRARY_PATH添加到环境变量中,但是没有成功。能否展示一下在你们的例子中正确的路径是什么? - Łukasz Przeniosło

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接