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 w
GDB
does not invoke your executable directly. Instead, it does
bash -c '/nfs_home/chenwj/tools/bin/qemu-i386 -U LD_PRELOAD bzip2_base.i386-m32-gcc44-annotated input.source 1'
This is done so that bash takes care of I/O redirection (which you are not using).
My guess is that /bin/bash
doesn't work when LD_PRELOAD=libdbo.so is in effect, though I don't understand the exact nature of failure.
One way to work around this problem is to create a wrapper executable, implementing C
equivalent of this:
export LD_PRELOAD=/nfs_home/chenwj/tools/lib/libdbo.so
exec /nfs_home/chenwj/tools/bin/qemu-i386 "$@"
and debug that executable (without setting LD_PRELOAD
). You'll see an extra SIGTRAP
when the wrapper execve()
s the wrapped qemu-i386
, which you should ignore and continue
.