uroboros-diversification/src/instrumentation/gfree/gfree.py
def findfreebranches(self):
        """
        Locate free branches in program's code for each function
        """
        j = 0; curr_func = self.funcs[0]
        for ins in self.instrs:
            loc_addr = get_loc(ins).loc_addr
            if loc_addr >= self.funcs[j].func_end_addr and j < len(self.funcs) - 1:
                j += 1
                curr_func = self.funcs[j]
            if Opcode_utils.is_indirect(ins[1]):
                self.indcalls[curr_func.func_begin_addr].append(loc_addr)
            elif Opcode_utils.is_ret(ins):
                self.rets[curr_func.func_begin_addr].append(loc_addr)
            elif Opcode_utils.is_any_jump(ins[0]):
                if (isinstance(ins[1], Types.Label) \
                    and (not ins[1].startswith('S_0') \
                    or int(ins[1].lstrip('S_'), 16) in self.rets)) \
                  or Opcode_utils.is_func(ins[1]):
                    self.rets[curr_func.func_begin_addr].append(loc_addr)
        # Logging
        # with open('exitpoints.info', 'w') as f:
        #     f.writelines(str(hex(e)) + ': ' + str(map(hex, self.rets[e])) + '\n' for e in self.rets if len(self.rets[e]) > 0)
        # with open('indcalls.info', 'w') as f:
        #     f.writelines(str(hex(e)) + ': ' + str(map(hex, self.indcalls[e])) + '\n' for e in self.indcalls if len(self.indcalls[e]) > 0)

        Locate free branches in program's code for each function
        
Locate free branches in program's code for each function
Locate free branches in program ' s code for each function
def findfreebranches(self):
        j = 0; curr_func = self.funcs[0]
        for ins in self.instrs:
            loc_addr = get_loc(ins).loc_addr
            if loc_addr >= self.funcs[j].func_end_addr and j < len(self.funcs) - 1:
                j += 1
                curr_func = self.funcs[j]
            if Opcode_utils.is_indirect(ins[1]):
                self.indcalls[curr_func.func_begin_addr].append(loc_addr)
            elif Opcode_utils.is_ret(ins):
                self.rets[curr_func.func_begin_addr].append(loc_addr)
            elif Opcode_utils.is_any_jump(ins[0]):
                if (isinstance(ins[1], Types.Label) \
                    and (not ins[1].startswith('S_0') \
                    or int(ins[1].lstrip('S_'), 16) in self.rets)) \
                  or Opcode_utils.is_func(ins[1]):
                    self.rets[curr_func.func_begin_addr].append(loc_addr)
def findfreebranches ( self ) : j = 0 ; curr_func = self . funcs [ 0 ] for ins in self . instrs : loc_addr = get_loc ( ins ) . loc_addr if loc_addr >= self . funcs [ j ] . func_end_addr and j < len ( self . funcs ) - 1 : j += 1 curr_func = self . funcs [ j ] if Opcode_utils . is_indirect ( ins [ 1 ] ) : self . indcalls [ curr_func . func_begin_addr ] . append ( loc_addr ) elif Opcode_utils . is_ret ( ins ) : self . rets [ curr_func . func_begin_addr ] . append ( loc_addr ) elif Opcode_utils . is_any_jump ( ins [ 0 ] ) : if ( isinstance ( ins [ 1 ] , Types . Label ) and ( not ins [ 1 ] . startswith ( 'S_0' ) or int ( ins [ 1 ] . lstrip ( 'S_' ) , 16 ) in self . rets ) ) or Opcode_utils . is_func ( ins [ 1 ] ) : self . rets [ curr_func . func_begin_addr ] . append ( loc_addr )
Locate free branches in program's code for each function
Locate free branches in program ' s code for each function
"""
        Locate free branches in program's code for each function
        """ # Logging # with open('exitpoints.info', 'w') as f: #     f.writelines(str(hex(e)) + ': ' + str(map(hex, self.rets[e])) + '\n' for e in self.rets if len(self.rets[e]) > 0) # with open('indcalls.info', 'w') as f: #     f.writelines(str(hex(e)) + ': ' + str(map(hex, self.indcalls[e])) + '\n' for e in self.indcalls if len(self.indcalls[e]) > 0)
self