'Besides calling _get_next_addr, we will check if data locates at that address seems to be code or not. If not,
we\'ll move on to request for next valid address.'

def _get_next_code_addr(self, initial_state):

    next_addr = self._get_next_addr_to_search()
    if (next_addr is None):
        return None
    start_addr = next_addr
    sz = ''
    is_sz = True
    while is_sz:
        while (next_addr in initial_state.memory):
            try:
                l.debug('Searching    address    %x', next_addr)
                val = initial_state.mem_concrete(next_addr, 1)
                if (val == 0):
                    if (len(sz) < 4):
                        is_sz = False
                    else:
                        reach_end = True
                    break
                if (chr(val) not in string.printable):
                    is_sz = False
                    break
                sz += chr(val)
                next_addr += 1
            except SimValueError:
                l.debug('Address    0x%08x    is    not    concretizable!', next_addr)
                break
        if ((len(sz) > 0) and is_sz):
            l.debug('Got    a    string    of    %d    chars:    [%s]', len(sz), sz)
            self._seg_list.occupy(start_addr, (len(sz) + 1))
            sz = ''
            next_addr = self._get_next_addr_to_search()
            if (next_addr is None):
                return None
            start_addr = next_addr
        if is_sz:
            next_addr += 1
    instr_alignment = initial_state.arch.instruction_alignment
    if ((start_addr % instr_alignment) > 0):
        start_addr = ((start_addr - (start_addr % instr_alignment)) + instr_alignment)
    l.debug('_get_next_code_addr()    returns    0x%x', start_addr)
    return start_addr
