How do I get a debugged application to find shared libraries when called in gdb inside Eclipse CDT?
I am trying to debug Firefox trunk inside Eclipse CDT on Linux x86_64 (Ubuntu Karmic).
I did the following:
- I created a path mapping from / to / to DevMo in the Source area of ββthe Project / Level Run / Debug configuration.
- I have installed / opt / Projects / obj -debug / dist / bin / firefox-bin as a C ++ application in the main area. (My Firefox obj dir is / opt / Projects / obj-debug)
- I have set the working directory / opt / Projects / obj -debug / dist / bin in the Arguments panel
- I have set the arguments to -no-remote -P dev in the Arguments panel
- In the Environment area, I set up an environment to add 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 panel I have
- Selected debugger gdb
- I have installed gdb executable in gdb and .gdbinit in /home/hsivonen/.gdbinit
The above is sufficient to successfully launch Firefox using Run. However, when running 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 also tried to put the appropriate paths in the shared library set solib-search-path /opt/Projects/obj-debug/dist/bin/components:/opt/Projects/obj-debug/dist/bin/plugins:/opt/Projects/obj-debug/dist/bin
subview of the Debugger panel and I tried to install
in my .gdbinit.
Bad luck.
What can I do to make shared libraries discovered when I debug my application?
a source to share
I often successfully use the CDT debugger this way:
- from terminal, set up a working environment for the binary you want to debug (export LD_LIBRARY_PATH, etc.)
- from terminal of the same , start eclipse (eclipse inherits environment)
- from eclipse, select "Makefile Project With Existing Code" and import your folder
- in the left pane, select your binary and right click: Debug as -> C / C ++ Application.
a source to share