Skip to content

Commit 12b8bf6

Browse files
committed
Add struct field access stub - too sleepy to debug
1 parent 0f9a407 commit 12b8bf6

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

pythonbpf/functions_pass.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -130,30 +130,8 @@ def handle_assign(func, module, builder, stmt, map_sym_tab, local_sym_tab, struc
130130
elif isinstance(rval.func, ast.Attribute):
131131
print(f"Assignment call attribute: {ast.dump(rval.func)}")
132132
if isinstance(rval.func.value, ast.Name):
133-
# probably a struct access
134-
var_name = rval.func.value.id
135-
field_name = rval.func.attr
136-
137-
print(f"Handling struct field assignment"
138-
f"{var_name}.{field_name}")
139-
140-
if var_name in local_sym_tab and var_name in local_var_metadata:
141-
struct_type = local_var_metadata[var_name]
142-
struct_info = structs_sym_tab[struct_type]
143-
144-
if field_name in struct_info["fields"]:
145-
field_idx = struct_info["fields"][field_name]
146-
struct_ptr = local_sym_tab[var_name]
147-
field_ptr = builder.gep(
148-
struct_ptr, [ir.Constant(ir.IntType(32), 0),
149-
ir.Constant(ir.IntType(32), field_idx)],
150-
inbounds=True)
151-
val = eval_expr(func, module, builder, rval,
152-
local_sym_tab, map_sym_tab)
153-
if val is None:
154-
print("Failed to evaluate struct field assignment")
155-
return
156-
builder.store(val, field_ptr)
133+
# TODO: probably a struct access
134+
print(f"TODO STRUCT ACCESS {ast.dump(rval)}")
157135
elif isinstance(rval.func.value, ast.Call) and isinstance(rval.func.value.func, ast.Name):
158136
map_name = rval.func.value.func.id
159137
method_name = rval.func.attr

0 commit comments

Comments
 (0)