def _new_node(self, node_type, src): node = NodeSolc(node_type, self._counter_nodes) node.set_offset(src, self.slither) self._counter_nodes += 1 node.set_function(self) self._nodes.append(node) return node
def build_ICFG(self): id = 100 for function in self._slither.functions: if not function.is_implemented: continue if function in self.visitedList: return self.visitedList.append(function) for node in function.nodes: callees = get_CFGnode_Calls(node) if callees: dummInode = NodeSolc(NodeType.DUMMY, id) function.addNode(dummInode) dummInode.set_function(function) dummInode.set_sons(node.sons) node.set_sons([]) link_nodes(node, dummInode) id = id + 1 # if any(callee.is_implemented for callee in callees): # link_nodes(node, Node(NodeType.DUMMY, id)) # id -= 1 # dummyInode = Node(NodeType.DUMMY, id) # dummyInode.set_sons(node.sons) # node.set_sons([]) # link_icfgNodes(node, dummyInode) # link_nodes(node, dummyInode) for callee in callees: #print('被调用函数的名字:{}'.format(callee.full_name)) # node.add_icfgSon(callee.entry_point) if callee.entry_point is None: continue # dummyInode = Node(NodeType.DUMMY, id) # dummyInode.set_fathers(node.sons) # node.set_sons([]) # link_nodes(node, dummyInode) # id -= 1 link_icfgNodes(node, callee.entry_point) callee_cfgEndNodes = getCFG_endNodes(callee) for callee_cfgEndNode in callee_cfgEndNodes: # for cfgSon in node.sons: link_backIcfgNodes(callee_cfgEndNode, node.sons[0]) self.allNodes.extend(function.nodes)
def _new_node(self, node_type): node = NodeSolc(node_type, self._counter_nodes) self._counter_nodes += 1 node.set_function(self) self._nodes.append(node) return node