parse context from first function argument to local symbol table

This commit is contained in:
2025-10-22 11:38:52 +05:30
parent adf32560a0
commit b3921c424d
8 changed files with 64 additions and 8 deletions

View File

@ -4,7 +4,8 @@ from pythonbpf import bpf, section, bpfglobal, compile_to_ir
from pythonbpf import compile # noqa: F401
from vmlinux import TASK_COMM_LEN # noqa: F401
from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401
from ctypes import c_int64
from ctypes import c_int64, c_void_p # noqa: F401
# from vmlinux import struct_uinput_device
# from vmlinux import struct_blk_integrity_iter
@ -14,7 +15,9 @@ from ctypes import c_int64
@section("tracepoint/syscalls/sys_enter_execve")
def hello_world(ctx: struct_trace_event_raw_sys_enter) -> c_int64:
a = 2 + TASK_COMM_LEN + TASK_COMM_LEN
# b = ctx
print(f"Hello, World{TASK_COMM_LEN} and {a}")
# print(f"This is context field {b}")
return c_int64(TASK_COMM_LEN + 2)