How to use gdb with LD_PRELOAD

MetallicPriest picture MetallicPriest · May 4, 2012 · Viewed 26k times · Source

I run a program with LD_PRELOADing a specific library. Like this.

LD_PRELOAD=./my.so ./my_program

How do I run this program with gdb?

Answer

MetallicPriest picture MetallicPriest · May 4, 2012

Do the following.

gdb your_program

(gdb) set environment LD_PRELOAD ./yourso.so
(gdb) start