How to run gdb with LD_PRELOAD?

陳韋任 chenwj@iis.sinica.edu.tw
Sun Jan 16 02:56:00 GMT 2011


Hi, Michael

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

  Thanks for your reply.

  I actually use qemu as an emulator to run a program like "a.out". And the
LD_PRELOAD  is for qemu not the a.out. I did what you said, but gdb gave
me the error below,

ERROR: ld.so: object '/nfs_home/chenwj/tools/bin/qemu-i386' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '-U' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object 'LD_PRELOAD' from LD_PRELOAD cannot be preloaded: ignored.
Inconsistency detected by ld.so: rtld.c: 757: init_tls: Assertion `i == _rtld_local._dl_tls_max_dtv_idx' failed!
During startup program exited with code 127.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667



More information about the Gdb mailing list