mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
find global variable ir and field data from metadata
This commit is contained in:
@ -348,9 +348,7 @@ def process_func_body(
|
||||
resolved_type = VmlinuxHandlerRegistry.get_struct_type(
|
||||
context_type_name
|
||||
)
|
||||
context_type = LocalSymbol(
|
||||
None, ir.PointerType(resolved_type), resolved_type
|
||||
)
|
||||
context_type = LocalSymbol(None, None, resolved_type)
|
||||
local_sym_tab[context_name] = context_type
|
||||
logger.info(f"Added argument '{context_name}' to local symbol table")
|
||||
|
||||
|
||||
@ -93,8 +93,11 @@ class VmlinuxHandler:
|
||||
logger.info(
|
||||
f"Attempting to access field {field_name} of possible vmlinux struct {struct_var_name}"
|
||||
)
|
||||
print(var_info.ir_type)
|
||||
print(self.get_field_type(struct_var_name, field_name))
|
||||
python_type: type = var_info.metadata
|
||||
globvar_ir, field_data = self.get_field_type(
|
||||
python_type.__name__, field_name
|
||||
)
|
||||
|
||||
# Return pointer to field and field type
|
||||
return None
|
||||
else:
|
||||
|
||||
@ -17,7 +17,7 @@ def hello_world(ctx: struct_trace_event_raw_sys_enter) -> c_int64:
|
||||
a = 2 + TASK_COMM_LEN + TASK_COMM_LEN
|
||||
b = ctx.id
|
||||
print(f"Hello, World{TASK_COMM_LEN} and {a}")
|
||||
# print(f"This is context field {b}")
|
||||
print(f"This is context field {b}")
|
||||
return c_int64(TASK_COMM_LEN + 2)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user