@@ -59,7 +59,7 @@ def _get_field_debug_type(
5959 generator : DebugInfoGenerator ,
6060 parent_struct : DependencyNode ,
6161 generated_debug_info : List [Tuple [DependencyNode , Any ]]
62- ) -> Any :
62+ ) -> tuple [ Any , int ] :
6363 """
6464 Determine the appropriate debug type for a field based on its Python/ctypes type.
6565
@@ -77,12 +77,12 @@ def _get_field_debug_type(
7777 if field .ctype_complex_type is not None :
7878 if issubclass (field .ctype_complex_type , ctypes .Array ):
7979 # Handle array types
80- element_type = _get_basic_debug_type (field .containing_type , generator )
81- return generator .create_array_type (element_type , field .type_size )
80+ element_type , base_type_size = _get_basic_debug_type (field .containing_type , generator )
81+ return generator .create_array_type (element_type , field .type_size ), field . type_size * base_type_size
8282 elif issubclass (field .ctype_complex_type , ctypes ._Pointer ):
8383 # Handle pointer types
84- pointee_type = _get_basic_debug_type (field .containing_type , generator )
85- return generator .create_pointer_type (pointee_type )
84+ pointee_type , _ = _get_basic_debug_type (field .containing_type , generator )
85+ return generator .create_pointer_type (pointee_type ), 64
8686
8787 # Handle other vmlinux types (nested structs)
8888 if field .type .__module__ == "vmlinux" :
@@ -93,13 +93,13 @@ def _get_field_debug_type(
9393 for existing_struct , debug_info in generated_debug_info :
9494 if existing_struct .name == struct_name :
9595 # Use existing debug info
96- return debug_info
96+ return debug_info , existing_struct . __sizeof__ ()
9797
9898 # If not found, create a forward declaration
9999 # This will be completed when the actual struct is processed
100100 logger .warning ("Forward declaration in struct created" )
101101 forward_type = generator .create_struct_type ([], 0 , is_distinct = True )
102- return forward_type
102+ return forward_type , 0
103103
104104 # Handle basic C types
105105 return _get_basic_debug_type (field .type , generator )
0 commit comments