繁体   English   中英

在Eclipse CDT中的gdb中调用时,如何使调试后的应用找到共享库?

[英]How to make the debugged app find shared libraries when invoked in gdb inside Eclipse CDT?

我正在尝试在Linux x86_64(Ubuntu Karmic)上的Eclipse CDT中调试Firefox干线。

我已经完成以下工作:

  • 我已经在项目级“运行/调试”配置的“源”窗格中创建了从/到/每个DevMo的路径映射。
  • 我在主窗格中将/ opt / Projects / obj-debug / dist / bin / firefox-bin设置为C ++应用程序。 (我的Firefox obj目录是/ opt / Projects / obj-debug)
  • 我在“参数”窗格中将工作目录设置为/ opt / Projects / obj-debug / dist / bin
  • 我已在“参数”窗格中将参数设置为-no-remote -P dev
  • 在“环境”窗格中,我已将环境设置为根据run-mozilla.sh的操作添加以下内容:
    • ADDON_PATH:/ opt / Projects / obj-debug / dist / bin
    • 显示::0.0
    • DYLD_LIBRARY_PATH:/ opt / Projects / obj-debug / dist / bin:/ opt / Projects / obj-debug / dist / bin
    • LD_LIBRARY_PATH:/ opt / Projects / obj-debug / dist / bin:/ opt / Projects / obj-debug / dist / bin / plugins:/ opt / Projects / obj-debug / dist / bin
    • LIBPATH:/ opt / Projects / obj-debug / dist / bin:/ opt / Projects / obj-debug / dist / bin
    • LIBRARY_PATH:/ opt / Projects / obj-debug / dist / bin:/ opt / Projects / obj-debug / dist / bin / components:/ opt / Projects / obj-debug / dist / bin
    • MOZILLA_FIVE_HOME:/ opt / Projects / obj-debug / dist / bin
    • NO_EM_RESTART:1
    • NO_REMOTE:1
    • SHLIB_PATH:/ opt / Projects / obj-debug / dist / bin:/ opt / Projects / obj-debug / dist / bin
  • 在“调试器”窗格中,
    • 选择了gdb调试器
    • 我已将gdb可执行文件设置为gdb,并将.gdbinit设置为/home/hsivonen/.gdbinit

以上内容足以使用“运行”成功启动Firefox。 但是,使用Debug启动时,我在控制台中看到这一行: /opt/Projects/obj-debug/dist/bin/firefox-bin: error while loading shared libraries: libmozalloc.so: cannot open shared object file: No such file or directory

我还尝试将相关路径放入“调试器”窗格的共享库子窗格中,并尝试将set solib-search-path /opt/Projects/obj-debug/dist/bin/components:/opt/Projects/obj-debug/dist/bin/plugins:/opt/Projects/obj-debug/dist/bin放入set solib-search-path /opt/Projects/obj-debug/dist/bin/components:/opt/Projects/obj-debug/dist/bin/plugins:/opt/Projects/obj-debug/dist/bin在我的.gdbinit中。

没运气。

调试应用程序后,我应该怎么做才能找到共享库?

我经常成功地设法使用CDT调试器:

  1. 在终端上,为要调试的二进制文件设置工作环境(导出LD_LIBRARY_PATH等)
  2. 同一终端启动eclipse(eclipse将继承环境)
  3. 在eclipse中,选择“使用现有代码的Makefile项目”并导入您的文件夹
  4. 在左窗格中,选择您的二进制文件,然后右键单击:调试为→C / C ++应用程序。

暂无
暂无

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

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