Today I’m starting something new on this blog. Whenever I find a solution to a software development problem I encounter and believe it’s worth telling, I’ll write it here.
This time – loading different shared libraries when analyzing a core dump in GDB on Linux. By “different” I mean “not the libraries that GDB finds and uses when the core dump is loaded”. The motivation to do this is, for example, if you have libraries on the computer you’re using to analyze the core dump that are different from the libraries which were used while the application ran. If you have the latter in some directory, say in the path /tmp/core/libs
, then the way to redirect GDB to them is:
(gdb) set solib-absolute-prefix /dev/null/
(gdb) nosharedlibrary
(gdb) set solib-search-path /tmp/core/libs
Note that /tmp/core/libs
must be a full path, without using ~ or anything. It doesn’t work. My guess is that this is unacceptable by the loader, which loads the libraries starting from the specified path.