ionelmc / python-hunter

Hunter is a flexible code tracing toolkit.
https://python-hunter.readthedocs.io/
BSD 2-Clause "Simplified" License
794 stars 46 forks source link

Can we trace all open() calls? #121

Open qlibp opened 5 months ago

qlibp commented 5 months ago

As said in the doc, there's a flag named builtin in Filtering session, but I still can't get it tracing open() calls with the following snippet.

import hunter
hunter.trace(hunter.Q(builtin=True, function="open", action=hunter.CallPrinter))

f = open("test_trace.py", "r")
lines = f.readlines()
print(lines[0])
f.close()
ionelmc commented 2 months ago

Well it would appear that particular function doesn't emit any trace events. May I ask what are you trying to trace, or what the goals are?

fubuki8087 commented 4 weeks ago

Actually I have similar needs. I want to trace the arguments of eval() and exec(). They are also builtin functions. I cannot find call in the trace about these two functions.

qlibp commented 4 weeks ago

would like

Well it would appear that particular function doesn't emit any trace events. May I ask what are you trying to trace, or what the goals are?

would like to trace all accessed files in python rather than using strace