@@ -30,6 +30,7 @@ def process_vmlinux_class(node, llvm_module, handler: DependencyHandler):
3030 if current_symbol_name not in symbols_in_module :
3131 raise ImportError (f"{ current_symbol_name } not present in module vmlinux" )
3232 logger .info (f"Resolving vmlinux class { current_symbol_name } " )
33+ logger .debug (f"Current handler state: { handler .is_ready } readiness and { handler .get_all_nodes ()} all nodes" )
3334 field_table = {} # should contain the field and it's type.
3435
3536 # Get the class object from the module
@@ -65,13 +66,33 @@ def process_vmlinux_class(node, llvm_module, handler: DependencyHandler):
6566 new_dep_node .add_field (elem_name , elem_type , ready = True )
6667 elif module_name == "vmlinux" :
6768 new_dep_node .add_field (elem_name , elem_type , ready = False )
68- # Create a temporary node-like object for recursion
69- temp_node = type ('TempNode' , (),
70- {'name' : elem_type .__name__ if hasattr (elem_type , '__name__' ) else str (elem_type )})()
71- if process_vmlinux_class (temp_node , llvm_module , handler ):
69+ print ("elem_name:" , elem_name , "elem_type:" , elem_type )
70+ # currently fails when a non-normal type appears which is basically everytime
71+ identify_ctypes_type (elem_type )
72+ symbol_name = elem_type .__name__ if hasattr (elem_type , '__name__' ) else str (elem_type )
73+ vmlinux_symbol = getattr (imported_module , symbol_name )
74+ if process_vmlinux_class (vmlinux_symbol , llvm_module , handler ):
7275 new_dep_node .set_field_ready (elem_name , True )
7376 else :
7477 raise ValueError (f"{ elem_name } with type { elem_type } not supported in recursive resolver" )
7578 handler .add_node (new_dep_node )
79+ logger .info (f"added node: { current_symbol_name } " )
7680
7781 return True
82+
83+ def identify_ctypes_type (t ):
84+ if isinstance (t , type ): # t is a type/class
85+ if issubclass (t , ctypes .Array ):
86+ print ("Array type" )
87+ print ("Element type:" , t ._type_ )
88+ print ("Length:" , t ._length_ )
89+ elif issubclass (t , ctypes ._Pointer ):
90+ print ("Pointer type" )
91+ print ("Points to:" , t ._type_ )
92+ elif issubclass (t , ctypes ._SimpleCData ):
93+ print ("Scalar type" )
94+ print ("Base type:" , t )
95+ else :
96+ print ("Other ctypes type" )
97+ else :
98+ print ("Instance, not type" )
0 commit comments