How to run gdb with LD_PRELOAD?

Michael Snyder msnyder@vmware.com
Sat Jan 15 23:16:00 GMT 2011


陳韋任 wrote:
> Hi, all
> 
>   I have a program using LD_PRELOAD. The program should be run like
> this, "LD_PRELOAD=/path/to/libfoo.so qemu -U LD_PRELOAD a.out", if
> without gdb.
> 
>   Here are what I did while running gdb.
> 
> --------------------------------------------------------------------
> $ gdb
> (gdb) set environment LD_PRELOAD=/path/to/libfoo.so
> (gdb) file qemu
> (gdb) r -U LD_PRELOAD a.out
> --------------------------------------------------------------------
> 
>   But gdb gave me the error below,
> 
> ERROR: ld.so: object '/nfs_home/chenwj/lib/libdbo.so' from LD_PRELOAD cannot be preloaded: ignored.
> 
>   Any suggestion appreciated.  


I would think it should be

(gdb) set environment LD_PRELOAD=/path/to/libfoo.so qemu -U LD_PRELOAD
(gdb) run



More information about the Gdb mailing list