'Step execution until next "inst" instruction within a specific memory range
Args:
- inst: the instruction to reach (String)
- mapname: name of virtual memory region to check for the instruction (String)
- depth: backtrace depth (Int)
Returns:
- tuple of (depth, instruction)
+ depth: current backtrace depth (Int)
+ instruction: current instruction (String)'

def stepuntil(self, inst, mapname=None, depth=None):

    if (not self.getpid()):
        return None
    maxdepth = to_int(config.Option.get('tracedepth'))
    if (not maxdepth):
        maxdepth = 4294967295
    maps = self.get_vmmap()
    binname = self.getfile()
    if (mapname is None):
        mapname = binname
    mapname = (mapname.replace('    ', '').split(',') + [binname])
    targetmap = []
    for m in mapname:
        targetmap += self.get_vmmap(m)
    binmap = self.get_vmmap('binary')
    current_instruction = ''
    pc = self.getreg('pc')
    if (depth is None):
        current_depth = self.backtrace_depth(self.getreg('sp'))
    else:
        current_depth = depth
    old_status = self.get_status()
    while True:
        status = self.get_status()
        if (status != old_status):
            if (('SIG' in status) and (status[3:] not in ['TRAP']) and (not to_int(status[3:]))):
                current_instruction = ('Interrupted:    %s' % status)
                call_depth = current_depth
                break
            if ('STOP' in status):
                current_instruction = 'End    of    execution'
                call_depth = current_depth
                break
        call_depth = self.backtrace_depth(self.getreg('sp'))
        current_instruction = self.execute_redirect('x/i    $pc')
        if (not current_instruction):
            current_instruction = 'End    of    execution'
            break
        p = re.compile('.*?(0x[^    :]*)')
        addr = p.search(current_instruction).group(1)
        addr = to_int(addr)
        if (addr is None):
            break
        p = re.compile('.*?:\\s*(.*)')
        code = p.match(current_instruction).group(1)
        found = 0
        for i in inst.replace(',', '    ').split():
            if re.match(i.strip(), code.strip()):
                if (self.is_address(addr, targetmap) and (addr != pc)):
                    found = 1
                    break
        if (found != 0):
            break
        self.execute_redirect('stepi', silent=True)
        if ((not self.is_address(addr, targetmap)) or (call_depth > maxdepth)):
            self.execute_redirect('finish', silent=True)
        pc = 0
    return ((call_depth - current_depth), current_instruction.strip())
