How to make the debugged app find shared libraries when invoked in gdb inside Eclipse CDT?
I'm trying to debug Firefox trunk inside Eclipse CDT on Linux x86_64 (Ubuntu Karmic).
I have done the following:
- I have made a path mapping from / to / per DevMo in the Source pane of the project-level Run/Debug config.
- I have set /opt/Projects/obj-debug/dist/bin/firefox-bin as the C++ app in the Main pane. (My Firefox obj dir is /opt/Projects/obj-debug)
- I have set the working dir to /opt/Projects/obj-debug/dist/bin in the Arguments pane
- I have set the arguments to -no-remote -P dev in the Arguments pane
- In the Environment pane, I have set the environment to append the following based on what run-mozilla.sh does:
- ADDON_PATH : /opt/Projects/obj-debug/dist/bin
- DISPLAY : :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
- In the Debugger pane I have
- Chosen gdb Debugger
- I have set the gdb executable to gdb and .gdbinit to /home/hsivonen/.gdbinit
The above is enough to launch Firefox successfully using Run. However, when launching using Debug, I get this one line in the console:
/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
I have additionally tried to put the relevant paths in the shared library subpane of the Debugger pane and I've tried to put
set solib-search-path /opt/Projec开发者_如何学Gots/obj-debug/dist/bin/components:/opt/Projects/obj-debug/dist/bin/plugins:/opt/Projects/obj-debug/dist/bin
in my .gdbinit.
No luck.
What should I do to make the shared libraries found when the app is debugged?
I've often successfully manage to use CDT debugger that way :
- from a terminal, set a working environment for the binary you want to debug (export LD_LIBRARY_PATH and so on)
- from the same terminal, start eclipse (eclipse will inherit environment)
- from eclipse, choose "Makefile Project With Existing Code" and import your folder
- from the left pane, choose your binary and right click : Debug As → C/C++ Application.
精彩评论