@@ -97,7 +97,7 @@ def handle_vmlinux_struct_field(
9797 globvar_ir , field_data = self .get_field_type (
9898 python_type .__name__ , field_name
9999 )
100- builder .function .args [0 ].type = ir .PointerType (ir .IntType (64 ))
100+ builder .function .args [0 ].type = ir .PointerType (ir .IntType (8 ))
101101 print (builder .function .args [0 ])
102102 field_ptr = self .load_ctx_field (
103103 builder , builder .function .args [0 ], globvar_ir
@@ -125,19 +125,18 @@ def load_ctx_field(builder, ctx_arg, offset_global):
125125 # Load the offset value
126126 offset = builder .load (offset_global )
127127
128- # # Ensure ctx_arg is treated as i8* (byte pointer)
129- # # i8_type = ir.IntType(8)
130- # i8_ptr_type = ir.PointerType()
128+ # Ensure ctx_arg is treated as i8* (byte pointer)
129+ i8_ptr_type = ir .PointerType ()
131130
132131 # Cast ctx_arg to i8* if it isn't already
133- # if str(ctx_arg.type) != str(i8_ptr_type):
134- # ctx_i8_ptr = builder.bitcast(ctx_arg, i8_ptr_type)
135- # else:
136- # ctx_i8_ptr = ctx_arg
132+ if str (ctx_arg .type ) != str (i8_ptr_type ):
133+ ctx_i8_ptr = builder .bitcast (ctx_arg , i8_ptr_type )
134+ else :
135+ ctx_i8_ptr = ctx_arg
137136
138137 # GEP with explicit type - this is the key fix
139138 field_ptr = builder .gep (
140- ctx_arg ,
139+ ctx_i8_ptr ,
141140 [offset ],
142141 inbounds = False ,
143142 )
@@ -151,8 +150,8 @@ def load_ctx_field(builder, ctx_arg, offset_global):
151150 raise KeyError
152151 except (KeyError , AttributeError ):
153152 passthrough_type = ir .FunctionType (
154- ir . PointerType () ,
155- [ir .IntType (32 ), ir . PointerType () ],
153+ i8_ptr_type ,
154+ [ir .IntType (32 ), i8_ptr_type ],
156155 )
157156 passthrough_fn = ir .Function (
158157 module ,
0 commit comments