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(
|
resolved_type = VmlinuxHandlerRegistry.get_struct_type(
|
||||||
context_type_name
|
context_type_name
|
||||||
)
|
)
|
||||||
context_type = LocalSymbol(
|
context_type = LocalSymbol(None, None, resolved_type)
|
||||||
None, ir.PointerType(resolved_type), resolved_type
|
|
||||||
)
|
|
||||||
local_sym_tab[context_name] = context_type
|
local_sym_tab[context_name] = context_type
|
||||||
logger.info(f"Added argument '{context_name}' to local symbol table")
|
logger.info(f"Added argument '{context_name}' to local symbol table")
|
||||||
|
|
||||||
|
|||||||
@ -93,8 +93,11 @@ class VmlinuxHandler:
|
|||||||
logger.info(
|
logger.info(
|
||||||
f"Attempting to access field {field_name} of possible vmlinux struct {struct_var_name}"
|
f"Attempting to access field {field_name} of possible vmlinux struct {struct_var_name}"
|
||||||
)
|
)
|
||||||
print(var_info.ir_type)
|
python_type: type = var_info.metadata
|
||||||
print(self.get_field_type(struct_var_name, field_name))
|
globvar_ir, field_data = self.get_field_type(
|
||||||
|
python_type.__name__, field_name
|
||||||
|
)
|
||||||
|
|
||||||
# Return pointer to field and field type
|
# Return pointer to field and field type
|
||||||
return None
|
return None
|
||||||
else:
|
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
|
a = 2 + TASK_COMM_LEN + TASK_COMM_LEN
|
||||||
b = ctx.id
|
b = ctx.id
|
||||||
print(f"Hello, World{TASK_COMM_LEN} and {a}")
|
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)
|
return c_int64(TASK_COMM_LEN + 2)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user