forked from oracle/graal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent-python.py
More file actions
39 lines (23 loc) · 806 Bytes
/
agent-python.py
File metadata and controls
39 lines (23 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
print(f"Python: Insight version {insight.version} is launching")
insight.on("source", lambda env : print(f"Python: observed loading of {env.name}"))
print("Python: Hooks are ready!")
def onEnter(ctx, frame):
print(f"minusOne class-based filter {frame.n}")
class Roots:
roots = True
def sourceFilter(self, src):
return src.name == "agent-fib.js"
def rootNameFilter(self, n):
return n == "minusOne"
insight.on("enter", onEnter, Roots())
def onEnterWithDict(ctx, frame):
print(f"minusTwo dict-based filter {frame.n}")
def sourceFilter(src):
return src.name == "agent-fib.js"
def rootNameFilter(n):
return n == "minusTwo"
insight.on("enter", onEnterWithDict, dict(
roots=True,
sourceFilter=sourceFilter,
rootNameFilter=rootNameFilter,
))