identify error in pointer to ctypes subclass dependency fixing

This commit is contained in:
2025-10-18 22:48:34 +05:30
parent d855e9ef2e
commit 33aa794718
3 changed files with 5 additions and 4 deletions

View File

@ -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:

View File

@ -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)