Skip to content

Commit 08c0ccf

Browse files
committed
Pass map_sym_tab to handle_struct_field_assign
1 parent 64e44d0 commit 08c0ccf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

pythonbpf/assign_pass.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def handle_struct_field_assignment(
10-
func, module, builder, target, rval, local_sym_tab, structs_sym_tab
10+
func, module, builder, target, rval, local_sym_tab, map_sym_tab, structs_sym_tab
1111
):
1212
"""Handle struct field assignment (obj.field = value)."""
1313

@@ -27,7 +27,9 @@ def handle_struct_field_assignment(
2727

2828
# Get field pointer and evaluate value
2929
field_ptr = struct_info.gep(builder, local_sym_tab[var_name].var, field_name)
30-
val = eval_expr(func, module, builder, rval, local_sym_tab, None, structs_sym_tab)
30+
val = eval_expr(
31+
func, module, builder, rval, local_sym_tab, map_sym_tab, structs_sym_tab
32+
)
3133

3234
if val is None:
3335
logger.error(f"Failed to evaluate value for {var_name}.{field_name}")

pythonbpf/functions/functions_pass.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ def handle_assign(
8484
if isinstance(target, ast.Attribute):
8585
# NOTE: Struct field assignment case: pkt.field = value
8686
handle_struct_field_assignment(
87-
func, module, builder, target, rval, local_sym_tab, structs_sym_tab
87+
func,
88+
module,
89+
builder,
90+
target,
91+
rval,
92+
local_sym_tab,
93+
map_sym_tab,
94+
structs_sym_tab,
8895
)
8996
return
9097

0 commit comments

Comments
 (0)