How to use gdb with LD_PRELOAD

后端 未结 5 1382
攒了一身酷
攒了一身酷 2020-12-23 16:24

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<

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 16:46

    You can supply env as an exec-wrapper on the command line using the -iex flag:

    gdb -iex "set exec-wrapper env LD_PRELOAD=./my.so" ./my_program
    

提交回复
热议问题