dkogan / ltrace

GNU General Public License v2.0
47 stars 17 forks source link

attaching ltrace to a process started with LD_PRELOAD does not recognize -x filter #3

Open gonber opened 8 years ago

gonber commented 8 years ago

I want to test a library mylib.so that is to be used in LD_PRELOAD. To test that certain functions in the library are being called I run

# LD_PRELOAD=mylib.so ltrace -CLx *opendir*@mylib.so python
>>> import os
>>> os.listdir(".")
opendir@mylib.so("." <unfinished ...>
(...)

However I'd prefer to operate in attached mode. Something like

# ltrace -CLx *opendir*@mylib.so -p <pid>

If I start python with LD_PRELOAD in a separate shell and give the correct pid to ltrace I do not get any output from ltrace.

Interestingly this works

# ltrace -Ce *opendir* -p <pid>
exe->opendir(".") = 0x22bcb00

Do you have any idea of what's going on?