How Do I Prepend A Directory The Library Path When Loading A Core File In Gdb On Linux
I have a core file generated on a remote system that I don't have direct access to. I also have local copies of the library files from the remote system, and the executable file for the crashing program.
I'd like to analyse this core dump in gdb.
For example:
gdb path/to/executable path/to/corefile
My libraries are in the current directory.
In the past I've seen debuggers implement this by supplying the option "-p ." or "-p /=."; so my question is:
How can I specify that libraries be loaded first from paths relative to my current directory when analysing a corefile in gdb?
Answer
Start gdb without specifying the executable or core file, then type the following commands:
set solib-absolute-prefix ./usr
file path/to/executable
core-file path/to/corefile
You will need to make sure to mirror your library path exactly from the target system. The above is meant for debugging targets that don't match your host, that is why it's important to replicate your root filesystem structure containing your libraries.
If you are remote debugging a server that is the same architecture and Linux/glibc version as your host, then you can do as fd suggested:
set solib-search-path <path>
If you are trying to override some of the libraries, but not all then you can copy the target library directory structure into a temporary place and use the solib-absolute-prefix
solution described above.
Related Questions
- → Database Record created_at Time Randomly Changes
- → npm is putting all dependencies and sub-dependecies int he same folder
- → Laravel 5.2 not working with vagrant homestead php 7
- → Can't add cron task in Laravel 5.0.5 on linux server
- → Node.js Split large file into parts and iterate over the parts
- → Laravel - Connection could not be established with host smtp.gmail.com
- → Redirect Each Page of Old Domain to Same Page URL on the New Domain
- → October CMS - Cannot edit pages in backend - http status 403
- → The Laravel View is Not Working On Linux Server
- → How to get a value in an array that's in a list of arrays in javascript
- → Beanstalkd to start when the system starts up or reboots , how to uncomment "START yes" on Centos
- → Vagrant with homestead and Linux boxes
- → Only one route not returning anything on live Laravel site, works on local sites