Skip to content

Commit 0e7dcaf

Browse files
committed
Add var_comp test for conditionals
1 parent a574527 commit 0e7dcaf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from pythonbpf import bpf, section, bpfglobal, compile
2+
from ctypes import c_void_p, c_int64
3+
4+
5+
@bpf
6+
@section("tracepoint/syscalls/sys_enter_execve")
7+
def hello_world(ctx: c_void_p) -> c_int64:
8+
x = 2
9+
if x > 3:
10+
print("Hello, World!")
11+
else:
12+
print("Goodbye, World!")
13+
return
14+
15+
16+
@bpf
17+
@bpfglobal
18+
def LICENSE() -> str:
19+
return "GPL"
20+
21+
22+
compile()

0 commit comments

Comments
 (0)