From 08c0ccf0ac23a3006fa675de359bc27cb4152c8e Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Sun, 12 Oct 2025 10:37:20 +0530 Subject: [PATCH] Pass map_sym_tab to handle_struct_field_assign --- pythonbpf/assign_pass.py | 6 ++++-- pythonbpf/functions/functions_pass.py | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pythonbpf/assign_pass.py b/pythonbpf/assign_pass.py index 3cad93e..ab09141 100644 --- a/pythonbpf/assign_pass.py +++ b/pythonbpf/assign_pass.py @@ -7,7 +7,7 @@ logger = logging.getLogger(__name__) def handle_struct_field_assignment( - func, module, builder, target, rval, local_sym_tab, structs_sym_tab + func, module, builder, target, rval, local_sym_tab, map_sym_tab, structs_sym_tab ): """Handle struct field assignment (obj.field = value).""" @@ -27,7 +27,9 @@ def handle_struct_field_assignment( # Get field pointer and evaluate value field_ptr = struct_info.gep(builder, local_sym_tab[var_name].var, field_name) - val = eval_expr(func, module, builder, rval, local_sym_tab, None, structs_sym_tab) + val = eval_expr( + func, module, builder, rval, local_sym_tab, map_sym_tab, structs_sym_tab + ) if val is None: logger.error(f"Failed to evaluate value for {var_name}.{field_name}") diff --git a/pythonbpf/functions/functions_pass.py b/pythonbpf/functions/functions_pass.py index 4a91333..68314f1 100644 --- a/pythonbpf/functions/functions_pass.py +++ b/pythonbpf/functions/functions_pass.py @@ -84,7 +84,14 @@ def handle_assign( if isinstance(target, ast.Attribute): # NOTE: Struct field assignment case: pkt.field = value handle_struct_field_assignment( - func, module, builder, target, rval, local_sym_tab, structs_sym_tab + func, + module, + builder, + target, + rval, + local_sym_tab, + map_sym_tab, + structs_sym_tab, ) return