[~process] be <address> - enable a code breakpoint
        [~thread] be <address> - enable a hardware breakpoint
        [~process] be <address-address> - enable a memory breakpoint
        [~process] be <address> <size> - enable a memory breakpoint
545123
def do_be(self, arg):
        
        token_list = self.split_tokens(arg, 1, 2)
        pid, tid, address, size = self.input_breakpoint(token_list)
        debug = self.debug
        found = False
        if size is None:
            if tid is not None:
                if debug.has_hardware_breakpoint(tid, address):
                    debug.enable_hardware_breakpoint(tid, address)
                    found = True
            if pid is not None:
                if debug.has_code_breakpoint(pid, address):
                    debug.enable_code_breakpoint(pid, address)
                    found = True
        else:
            if debug.has_page_breakpoint(pid, address):
                debug.enable_page_breakpoint(pid, address)
                found = True
        if not found:
            print("Error: breakpoint not found.")
29277
@Override
    public void process(byte b) {
        if (b == END_SYSEX) {
            byte[] buffer = convertI2CBuffer(getBuffer());
            byte address = buffer[0];
            byte register = buffer[1];
            byte[] message = new byte[buffer.length - 2];
            System.arraycopy(buffer, 2, message, 0, buffer.length - 2);
            Event event = new Event(I2C_MESSAGE);
            event.setBodyItem(I2C_ADDRESS, address);
            event.setBodyItem(I2C_REGISTER, register);
            event.setBodyItem(I2C_MESSAGE, message);
            transitTo(WaitingForMessageState.class);
            publish(event);
        } else {
            bufferize(b);
        }
    }
791710
def enable_all_breakpoints(self):
        

        # disable code breakpoints
        for (pid, bp) in self.get_all_code_breakpoints():
            if bp.is_disabled():
                self.enable_code_breakpoint(pid, bp.get_address())

        # disable page breakpoints
        for (pid, bp) in self.get_all_page_breakpoints():
            if bp.is_disabled():
                self.enable_page_breakpoint(pid, bp.get_address())

        # disable hardware breakpoints
        for (tid, bp) in self.get_all_hardware_breakpoints():
            if bp.is_disabled():
                self.enable_hardware_breakpoint(tid, bp.get_address())
1282237
def __cleanup_module(self, event):
        
        pid     = event.get_pid()
        process = event.get_process()
        module  = event.get_module()

        # Cleanup thread breakpoints on this module
        for tid in process.iter_thread_ids():
            thread = process.get_thread(tid)

            # Running breakpoints
            if tid in self.__runningBP:
                bplist = list(self.__runningBP[tid])
                for bp in bplist:
                    bp_address = bp.get_address()
                    if process.get_module_at_address(bp_address) == module:
                        self.__cleanup_breakpoint(event, bp)
                        self.__runningBP[tid].remove(bp)

            # Hardware breakpoints
            if tid in self.__hardwareBP:
                bplist = list(self.__hardwareBP[tid])
                for bp in bplist:
                    bp_address = bp.get_address()
                    if process.get_module_at_address(bp_address) == module:
                        self.__cleanup_breakpoint(event, bp)
                        self.__hardwareBP[tid].remove(bp)

        # Cleanup code breakpoints on this module
        for (bp_pid, bp_address) in compat.keys(self.__codeBP):
            if bp_pid == pid:
                if process.get_module_at_address(bp_address) == module:
                    bp = self.__codeBP[ (bp_pid, bp_address) ]
                    self.__cleanup_breakpoint(event, bp)
                    del self.__codeBP[ (bp_pid, bp_address) ]

        # Cleanup page breakpoints on this module
        for (bp_pid, bp_address) in compat.keys(self.__pageBP):
            if bp_pid == pid:
                if process.get_module_at_address(bp_address) == module:
                    bp = self.__pageBP[ (bp_pid, bp_address) ]
                    self.__cleanup_breakpoint(event, bp)
                    del self.__pageBP[ (bp_pid, bp_address) ]
1367895
def bes(args):
    
    from jcvi.apps.align import run_blat

    p = OptionParser(bes.__doc__)
    p.set_cpus()
    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    bacfasta, clonename = args

    entrez([clonename, "--database=nucgss", "--skipcheck"])
    besfasta = clonename + ".fasta"
    blatfile = clonename + ".bes.blat"
    run_blat(infile=besfasta, outfile=blatfile, db=bacfasta, \
             pctid=95, hitlen=100, cpus=opts.cpus)

    aid, asize = next(Fasta(bacfasta).itersizes())

    width = 50
    msg = "=" * width
    msg += "  " + aid
    print(msg, file=sys.stderr)

    ratio = width * 1. / asize
    _ = lambda x: int(round(x * ratio, 0))
    blasts = [BlastLine(x) for x in open(blatfile)]
    for b in blasts:
        if b.orientation == '+':
            msg = " " * _(b.sstart) + "->"
        else:
            msg = " " * (_(b.sstop) - 2) + "<-"
        msg += " " * (width - len(msg) + 2)
        msg += b.query
        if b.orientation == '+':
            msg += " (hang={0})".format(b.sstart - 1)
        else:
            msg += " (hang={0})".format(asize - b.sstop)

        print(msg, file=sys.stderr)
834022
public void setRequiredPragmas(Instruction instruction) {
      final boolean setDouble = instruction.getByteCode().usesDouble();
      if (setDouble) {
         usesDoubles = true;
         if (logger.isLoggable(Level.FINE)) {
            logger.fine("Found D on =" + instruction + " in " + getName());
         }
      }

      if ((instruction instanceof I_BASTORE) || (instruction instanceof I_CASTORE /* || instruction instanceof I_SASTORE */)) {
         usesByteWrites = true;
         if (usesByteWrites && logger.isLoggable(Level.FINE)) {
            logger.fine("Found Byte Addressable Store on =" + instruction + " in " + getName());
         }
      }
   }
490010
def is_system_defined_breakpoint(self, address):
        
        if address:
            module = self.get_module_at_address(address)
            if module:
                return module.match_name("ntdll")    or \
                       module.match_name("kernel32")
        return False
1051961
function UInt32Be(value, opt) {
	SingleType.call(this, value, 4, Buffer.prototype.readUInt32BE, Buffer.prototype.writeUInt32BE, opt);
}
540318
def do_memory(self, arg):
        
        if arg:     # TODO: take min and max addresses
            raise CmdError("too many arguments")
        process = self.get_process_from_prefix()
        try:
            memoryMap       = process.get_memory_map()
            mappedFilenames = process.get_mapped_filenames()
            print('')
            print(CrashDump.dump_memory_map(memoryMap, mappedFilenames))
        except WindowsError:
            msg = "can't get memory information for process (%d)"
            raise CmdError(msg % process.get_pid())
14696
private function _memory()
    {
        if (CommonFunctions::executeProgram('pidin', 'info', $buf)
           && preg_match('/^.* FreeMem:(\S+)Mb\/(\S+)Mb/', $buf, $memm)) {
            $this->sys->setMemTotal(1024*1024*$memm[2]);
            $this->sys->setMemFree(1024*1024*$memm[1]);
            $this->sys->setMemUsed(1024*1024*($memm[2]-$memm[1]));
        }
    }
218707
public static void main(String[] args) throws InterruptedException {
        StringBuilder errbuf = new StringBuilder();
        try {
            PcapIf pcapIf = pcapIf(errbuf);
            Pcap.Builder builder = new Pcap.Builder()
                    .source(pcapIf.getName())
                    .snaplen(SNAPLEN)
                    .promiscuousMode(PROMISCUOUS)
                    .timeout(TIMEOUT)
                    .immediateMode(IMMEDIATE)
                    .timestampType(TIMESTAMP_TYPE)
                    .timestampPrecision(TIMESTAMP_PRECISION)
                    .rfmon(RFMON)
                    .enableNonBlock(nonBlock)
                    .dataLinkType(LINK_TYPE)
                    .fileName(FILE_NAME)
                    .errbuf(errbuf)
                    .pcapType(PCAP_TYPE);
            com.ardikars.jxnet.context.Application.run("application", "Application", "", builder);
            final Context context = com.ardikars.jxnet.context.Application.getApplicationContext();
            LOGGER.info("Network Interface : " + pcapIf.getName());
            LOGGER.info("Addresses         : ");
            for (PcapAddr addr : pcapIf.getAddresses()) {
                if (addr.getAddr().getSaFamily() == SockAddr.Family.AF_INET) {
                    LOGGER.info("\tAddress       : " + Inet4Address.valueOf(addr.getAddr().getData()));
                    LOGGER.info("\tNetwork       : " + Inet4Address.valueOf(addr.getNetmask().getData()));
                }
            }
            if (Platforms.isWindows()) {
                try {
                    byte[] hardwareAddress = Jxnet.FindHardwareAddress(pcapIf.getName());
                    LOGGER.info("\tMAC Address   : " + MacAddress.valueOf(hardwareAddress));
                } catch (PlatformNotSupportedException e) {
                    LOGGER.warning(e.getMessage());
                } catch (DeviceNotFoundException e) {
                    LOGGER.warning(e.getMessage());
                }
            } else {
                try {
                    LOGGER.info("\tMAC Address   : " + MacAddress.fromNicName(pcapIf.getName()));
                } catch (SocketException e) {
                    LOGGER.warning(e.getMessage());
                }
            }
            final ExecutorService pool = Executors.newCachedThreadPool();
            Runtime.getRuntime().addShutdownHook(new Thread() {
                public void run() {
                    pool.shutdownNow();
                }
            });

            final int linktype = context.pcapDataLink().getValue();

            context.pcapLoop(MAX_PACKET, new RawPcapHandler<String>() {

                @Override
                public void nextPacket(String user, int capLen, int len, int tvSec, long tvUsec, long memoryAddress) {
                    Memory buffer = Memories.wrap(memoryAddress, len);
                    buffer.writerIndex(buffer.capacity());
                    Packet packet;
                    if (linktype == 1) {
                        packet = Ethernet.newPacket(buffer);
                    } else {
                        packet = UnknownPacket.newPacket(buffer);
                    }
                    print(Tuple.of(PcapPktHdr.newInstance(capLen, len, tvSec, tvUsec), packet));
                }

            }, "Jxnet!", pool);
            pool.shutdown();
            pool.awaitTermination(WAIT_TIME_FOR_THREAD_TERMINATION, TimeUnit.MICROSECONDS);
        } catch (DeviceNotFoundException e) {
            LOGGER.warning(e.getMessage());
        }

    }
509325
def program_page(self, address, bytes):
        
        assert self._active_operation == self.Operation.PROGRAM

        # prevent security settings from locking the device
        bytes = self.override_security_bits(address, bytes)

        # first transfer in RAM
        self.target.write_memory_block8(self.begin_data, bytes)

        # update core register to execute the program_page subroutine
        result = self._call_function_and_wait(self.flash_algo['pc_program_page'], address, len(bytes), self.begin_data)

        # check the return code
        if result != 0:
            raise FlashProgramFailure('program_page(0x%x) error: %i' % (address, result), address, result)
34877
def process_boolean_array(self, tag):
        """"""
        array_size = tag.get_array_size()
        tag.set_address(self.normal_register.get_array(array_size))
        if self.is_sixteen_bit:
            # each boolean address needs 1/16 byte
            self.normal_register.move_to_next_address((array_size / 16) + 1)
            return
        # each boolean address needs 1/8 byte
        self.normal_register.move_to_next_address((array_size / 8) + 1)
934199
def disassemble(self, data, address, architecture_mode=ARCH_X86_MODE_32):
        
        asm, size = self._cs_disassemble_one(data, address)

        instr = self._parser.parse(asm) if asm else None

        if instr:
            instr.address = address
            instr.size = size
            instr.bytes = data[0:size]
        else:
            raise DisassemblerError()

        return instr
1118647
def _addr(self):
        
        group_by = self._config['address_group_by']

        assert not self._flags['address'], "{} address already assigned".format(self._name)
        assert group_by in ('element', 'variable')

        m0 = self.system.dae.m
        n0 = self.system.dae.n
        mend = m0 + len(self._algebs) * self.n
        nend = n0 + len(self._states) * self.n

        if group_by == 'variable':
            for idx, item in enumerate(self._algebs):
                self.__dict__[item] = list(
                    range(m0 + idx * self.n, m0 + (idx + 1) * self.n))
            for idx, item in enumerate(self._states):
                self.__dict__[item] = list(
                    range(n0 + idx * self.n, n0 + (idx + 1) * self.n))
        elif group_by == 'element':
            for idx, item in enumerate(self._algebs):
                self.__dict__[item] = list(
                    range(m0 + idx, mend, len(self._algebs)))
            for idx, item in enumerate(self._states):
                self.__dict__[item] = list(
                    range(n0 + idx, nend, len(self._states)))

        self.system.dae.m = mend
        self.system.dae.n = nend

        self._flags['address'] = True
191286
def inject_basic_program(self, ascii_listing):
        
        program_start = self.cpu.memory.read_word(
            self.machine_api.PROGRAM_START_ADDR
        )
        tokens = self.machine_api.ascii_listing2program_dump(ascii_listing)
        self.cpu.memory.load(program_start, tokens)
        log.critical("BASIC program injected into Memory.")

        # Update the BASIC addresses:
        program_end = program_start + len(tokens)
        self.cpu.memory.write_word(self.machine_api.VARIABLES_START_ADDR, program_end)
        self.cpu.memory.write_word(self.machine_api.ARRAY_START_ADDR, program_end)
        self.cpu.memory.write_word(self.machine_api.FREE_SPACE_START_ADDR, program_end)
        log.critical("BASIC addresses updated.")
602412
def do_bd(self, arg):
        
        token_list = self.split_tokens(arg, 1, 2)
        pid, tid, address, size = self.input_breakpoint(token_list)
        debug = self.debug
        found = False
        if size is None:
            if tid is not None:
                if debug.has_hardware_breakpoint(tid, address):
                    debug.disable_hardware_breakpoint(tid, address)
                    found = True
            if pid is not None:
                if debug.has_code_breakpoint(pid, address):
                    debug.disable_code_breakpoint(pid, address)
                    found = True
        else:
            if debug.has_page_breakpoint(pid, address):
                debug.disable_page_breakpoint(pid, address)
                found = True
        if not found:
            print("Error: breakpoint not found.")