@@ -40,43 +40,22 @@ def process_vmlinux_post_ast(
4040 type_length : Optional [int ] = None
4141 module_name = getattr (elem_type_class , "__module__" , None )
4242
43- if hasattr (elem_type_class , "_length_" ) and is_complex_type :
44- type_length = elem_type_class ._length_
45-
4643 if current_symbol_name in processing_stack :
47- logger .debug (
44+ logger .info (
4845 f"Circular dependency detected for { current_symbol_name } , skipping"
4946 )
5047 return True
5148
5249 # Check if already processed
5350 if handler .has_node (current_symbol_name ):
54- existing_node = handler .get_node (current_symbol_name )
55- # If the node exists and is ready, we're done
56- if existing_node and existing_node .is_ready :
57- logger .info (f"Node { current_symbol_name } already processed and ready" )
58- return True
51+ logger .info (f"Node { current_symbol_name } already processed and ready" )
52+ return True
5953
6054 processing_stack .add (current_symbol_name )
6155
6256 if module_name == "vmlinux" :
6357 if hasattr (elem_type_class , "_type_" ):
64- is_complex_type = True
65- containing_type = elem_type_class ._type_
66- if containing_type .__module__ == "vmlinux" :
67- print ("Very weird type ig for containing type" , containing_type )
68- elif containing_type .__module__ == ctypes .__name__ :
69- if isinstance (elem_type_class , type ):
70- if issubclass (elem_type_class , ctypes .Array ):
71- ctype_complex_type = ctypes .Array
72- elif issubclass (elem_type_class , ctypes ._Pointer ):
73- ctype_complex_type = ctypes ._Pointer
74- else :
75- raise TypeError ("Unsupported ctypes subclass" )
76- # handle ctype complex type
77-
78- else :
79- raise ImportError (f"Unsupported module of { containing_type } " )
58+ pass
8059 else :
8160 new_dep_node = DependencyNode (name = current_symbol_name )
8261 handler .add_node (new_dep_node )
@@ -103,6 +82,40 @@ def process_vmlinux_post_ast(
10382 logger .debug (
10483 f"Processing vmlinux field: { elem_name } , type: { elem_type } "
10584 )
85+ if hasattr (elem_type , "_type_" ):
86+ is_complex_type = True
87+ containing_type = elem_type ._type_
88+ if hasattr (elem_type , "_length_" ) and is_complex_type :
89+ type_length = elem_type ._length_
90+ if containing_type .__module__ == "vmlinux" :
91+ pass
92+ elif containing_type .__module__ == ctypes .__name__ :
93+ if isinstance (elem_type , type ):
94+ if issubclass (elem_type , ctypes .Array ):
95+ ctype_complex_type = ctypes .Array
96+ elif issubclass (elem_type , ctypes ._Pointer ):
97+ ctype_complex_type = ctypes ._Pointer
98+ else :
99+ raise TypeError ("Unsupported ctypes subclass" )
100+ else :
101+ raise ImportError (
102+ f"Unsupported module of { containing_type } "
103+ )
104+ logger .info (f"{ containing_type } containing type of parent { elem_name } with { elem_type } and ctype { ctype_complex_type } and length { type_length } " )
105+ new_dep_node .set_field_containing_type (elem_name , containing_type )
106+ new_dep_node .set_field_type_size (elem_name , type_length )
107+ new_dep_node .set_field_ctype_complex_type (elem_name , ctype_complex_type )
108+ new_dep_node .set_field_type (elem_name , elem_type )
109+ if containing_type .__module__ == "vmlinux" :
110+ if process_vmlinux_post_ast (
111+ containing_type , llvm_handler , handler , processing_stack
112+ ):
113+ new_dep_node .set_field_ready (elem_name , True )
114+ elif containing_type .__module__ == ctypes .__name__ :
115+ logger .info (f"Processing ctype internal{ containing_type } " )
116+ else :
117+ raise TypeError ("Module not supported in recursive resolution" )
118+ continue
106119 if process_vmlinux_post_ast (
107120 elem_type , llvm_handler , handler , processing_stack
108121 ):
@@ -111,7 +124,6 @@ def process_vmlinux_post_ast(
111124 raise ValueError (
112125 f"{ elem_name } with type { elem_type } from module { module_name } not supported in recursive resolver"
113126 )
114- print ("" )
115127
116128 else :
117129 raise ImportError ("UNSUPPORTED Module" )
0 commit comments