diff --git a/pythonbpf/vmlinux_parser/class_handler.py b/pythonbpf/vmlinux_parser/class_handler.py index c940711..b75b85d 100644 --- a/pythonbpf/vmlinux_parser/class_handler.py +++ b/pythonbpf/vmlinux_parser/class_handler.py @@ -99,7 +99,9 @@ def process_vmlinux_post_ast( local_module_name = getattr(elem_type, "__module__", None) new_dep_node.add_field(elem_name, elem_type, ready=False) if local_module_name == ctypes.__name__: + #TODO: need to process pointer to ctype and also CFUNCTYPES here new_dep_node.set_field_bitfield_size(elem_name, elem_bitfield_size) + print(elem_type) new_dep_node.set_field_ready(elem_name, is_ready=True) logger.debug( f"Field {elem_name} is direct ctypes type: {elem_type}" @@ -127,6 +129,8 @@ def process_vmlinux_post_ast( ctype_complex_type = ctypes.Array elif issubclass(elem_type, ctypes._Pointer): ctype_complex_type = ctypes._Pointer + else: + raise ImportError("Non Array and Pointer type ctype imports not supported in current version") else: raise TypeError("Unsupported ctypes subclass") else: diff --git a/pythonbpf/vmlinux_parser/ir_gen/debug_info_gen.py b/pythonbpf/vmlinux_parser/ir_gen/debug_info_gen.py index ccb27a9..232cf10 100644 --- a/pythonbpf/vmlinux_parser/ir_gen/debug_info_gen.py +++ b/pythonbpf/vmlinux_parser/ir_gen/debug_info_gen.py @@ -78,7 +78,6 @@ def _get_field_debug_type( """ # Handle complex types (arrays, pointers) if field.ctype_complex_type is not None: - print(field) if issubclass(field.ctype_complex_type, ctypes.Array): # Handle array types element_type, base_type_size = _get_basic_debug_type( @@ -90,7 +89,6 @@ def _get_field_debug_type( elif issubclass(field.ctype_complex_type, ctypes._Pointer): # Handle pointer types pointee_type, _ = _get_basic_debug_type(field.containing_type, generator) - print("DEBUG", pointee_type) return generator.create_pointer_type(pointee_type), 64 # Handle other vmlinux types (nested structs) diff --git a/tests/passing_tests/vmlinux/simple_struct_test.py b/tests/passing_tests/vmlinux/simple_struct_test.py index f3cbb97..b40e620 100644 --- a/tests/passing_tests/vmlinux/simple_struct_test.py +++ b/tests/passing_tests/vmlinux/simple_struct_test.py @@ -1,8 +1,7 @@ from pythonbpf import bpf, section, bpfglobal, compile_to_ir, compile from vmlinux import TASK_COMM_LEN # noqa: F401 from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401 -# from vmlinux import struct_xdp_md -# from vmlinux import struct_request +# from vmlinux import struct_uinput_device from vmlinux import struct_blk_integrity_iter from ctypes import c_int64