Initializes the instruction coverage plugin

        Introduces hooks for each instruction
        :param symbolic_vm:
        :return:
431394
def initialize(self, symbolic_vm: LaserEVM):
        
        self.coverage = {}
        self.initial_coverage = 0
        self.tx_id = 0

        @symbolic_vm.laser_hook("stop_sym_exec")
        def stop_sym_exec_hook():
            # Print results
            for code, code_cov in self.coverage.items():
                cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100

                log.info(
                    "Achieved {:.2f}% coverage for code: {}".format(
                        cov_percentage, code
                    )
                )

        @symbolic_vm.laser_hook("execute_state")
        def execute_state_hook(global_state: GlobalState):
            # Record coverage
            code = global_state.environment.code.bytecode

            if code not in self.coverage.keys():
                number_of_instructions = len(
                    global_state.environment.code.instruction_list
                )
                self.coverage[code] = (
                    number_of_instructions,
                    [False] * number_of_instructions,
                )

            self.coverage[code][1][global_state.mstate.pc] = True

        @symbolic_vm.laser_hook("start_sym_trans")
        def execute_start_sym_trans_hook():
            self.initial_coverage = self._get_covered_instructions()

        @symbolic_vm.laser_hook("stop_sym_trans")
        def execute_stop_sym_trans_hook():
            end_coverage = self._get_covered_instructions()
            log.info(
                "Number of new instructions covered in tx %d: %d"
                % (self.tx_id, end_coverage - self.initial_coverage)
            )
            self.tx_id += 1
366439
private static boolean initSingleCoverageMode(final String runName, Instrumentation instrumentation) {
        // Check if run is affected and if not start coverage.
        if (Ekstazi.inst().checkIfAffected(runName)) {
            Ekstazi.inst().startCollectingDependencies(runName);
            // End coverage when VM ends execution.
            Runtime.getRuntime().addShutdownHook(new Thread() {
                @Override
                public void run() {
                    Ekstazi.inst().finishCollectingDependencies(runName);
                }
            });
            return true;
        } else {
            instrumentation.addTransformer(new RemoveMainCFT());
            return false;
        }
    }
521014
def _initVirtualOutputs(self):
        
        self.virtualOutputs = {}
        for product in self.outputNames:
            self.virtualOutputs[product] = None
368619
def _initializer_wrapper(actual_initializer, *rest):
    
    signal.signal(signal.SIGINT, signal.SIG_IGN)
    if actual_initializer is not None:
        actual_initializer(*rest)
926404
def initialize_plugin(self):
        
        if not self.patterns:
            self.patterns = [
                re.compile(pattern_string)
                for pattern_string in self.PRERELEASE_PATTERNS
            ]
            logger.info(f"Initialized prerelease plugin with {self.patterns}")
602769
def init(name, *args, **kwargs):
    
    if name in _PLUGIN_CATALOG:
        if rapport.config.get_int("rapport", "verbosity") >= 2:
            print("Initialize plugin {0}: {1} {2}".format(name, args, kwargs))
        try:
            return _PLUGIN_CATALOG[name](*args, **kwargs)
        except (ValueError, TypeError) as e:
            print("Failed to initialize plugin {0}: {1}!".format(name, e), file=sys.stderr)
    else:
        print("Failed to initialize plugin {0}: Not in catalog!".format(name), file=sys.stderr)
288690
def _initialize_cfg(self):
        

        self.kb.functions = FunctionManager(self.kb)

        self._jobs_to_analyze_per_function = defaultdict(set)
        self._completed_functions = set()
1240019
def init(scope):
    
    # define wrapper compatibility symbols
    QtCore.THREADSAFE_NONE = XThreadNone()
    QtGui.QDialog = QDialog
    
    # define the importable symbols
    scope['QtCore'] = QtCore
    scope['QtGui'] = QtGui
    scope['QtWebKit'] = lazy_import('PySide.QtWebKit')
    scope['QtNetwork'] = lazy_import('PySide.QtNetwork')
    scope['QtXml'] = lazy_import('PySide.QtXml')
    
    scope['uic'] = Uic()
    scope['rcc_exe'] = 'pyside-rcc'
    
    # map overrides
    #QtCore.SIGNAL = SIGNAL
    
    # map shared core properties
    QtCore.QDate.toPyDate = lambda x: x.toPython()
    QtCore.QDateTime.toPyDateTime = lambda x: x.toPython()
    QtCore.QTime.toPyTime = lambda x: x.toPython()
    QtCore.QStringList = list
    QtCore.QString = unicode
444823
def init(self):
        
        # some modules might need to be imported "on the other side of the fork"
        # .. but the, when importing this module, the import is not tested
        #
        # 
        # from openalpr import Alpr
        from valkka.mvision.alpr.openalpr_fix import Alpr
        self.movement = MovementDetector()
        self.alpr = Alpr(self.country, self.conf_file, self.runtime_data)
        if not self.alpr.is_loaded():
            self.alpr = None
            return
        self.alpr.set_top_n(self.top_n)
        self.reset()
        
        """
        # test in ipython:
        from valkka.mvision.alpr.openalpr_fix import Alpr
        country="eu"
        conf_file="/usr/share/openalpr/config/openalpr.defaults.conf"
        runtime_data="/usr/share/openalpr/runtime_data"
        a = Alpr(country, conf_file, runtime_data)
        a.is_loaded()        
        """
1024055
def _initialize(cls):
    
    op_symbols = """
      + add radd pos
      - sub rsub neg
      * mul rmul
      / truediv rtruediv
      // floordiv rfloordiv
      % mod rmod
      ** pow rpow
      >> rshift rrshift
      << lshift rlshift
      ~ invert
      & and rand
      | or ror
      ^ xor rxor
      < lt
      <= le
      == eq
      != ne
      > gt
      >= ge
    """.strip().splitlines()
    if HAS_MATMUL:
      op_symbols.append("@ matmul rmatmul")
    for op_line in op_symbols:
      symbol, names = op_line.split(None, 1)
      for name in names.split():
        cls._insert(name, symbol)
283557
public function initialize() {
    $this->drupalVmAlias = $this->getConfigValue('project.machine_name') . '.local';
    $this->drupalVmVersionConstraint = '^5.0';
    $this->defaultDrupalVmDrushAliasesFile = $this->getConfigValue('blt.root') . '/scripts/drupal-vm/drupal-vm.site.yml';
    $this->defaultDrupalVmConfigFile = $this->getConfigValue('blt.root') . '/scripts/drupal-vm/config.yml';
    $this->defaultDrupalVmVagrantfile = $this->getConfigValue('blt.root') . '/scripts/drupal-vm/Vagrantfile';
    $this->projectDrushAliasesFile = $this->getConfigValue('drush.alias-dir') . '/' . $this->getConfigValue('project.machine_name') . '.site.yml';
    $this->projectDrupalVmVagrantfile = $this->getConfigValue('repo.root') . '/Vagrantfile';
    $this->projectDrupalVmConfigFile = $this->getConfigValue('vm.config');
    $this->vmDir = dirname($this->projectDrupalVmConfigFile);
    $this->vmConfigDir = str_replace($this->getConfigValue('repo.root') . DIRECTORY_SEPARATOR, '', $this->vmDir);
    $path_parts = explode(DIRECTORY_SEPARATOR, $this->projectDrupalVmConfigFile);
    $this->vmConfigFile = array_pop($path_parts);
  }
1057980
function initialize() {
    if (global.isVinn) {
      tr.isVinn = true;
    } else if (global.process && global.process.versions.node) {
      tr.isNode = true;
    } else {
      tr.isVinn = false;
      tr.isNode = false;
      tr.doc = document;

      tr.isMac = /Mac/.test(navigator.platform);
      tr.isWindows = /Win/.test(navigator.platform);
      tr.isChromeOS = /CrOS/.test(navigator.userAgent);
      tr.isLinux = /Linux/.test(navigator.userAgent);
    }
    tr.isHeadless = tr.isVinn || tr.isNode;
  }
598923
def _initialize(self):
        

        # figure out section alignments
        for section in self.project.loader.main_object.sections:
            in_segment = False
            for segment in self.project.loader.main_object.segments:
                segment_addr = segment.vaddr
                if segment_addr <= section.vaddr < segment_addr + segment.memsize:
                    in_segment = True
                    break
            if not in_segment:
                continue

            # calculate alignments
            if section.vaddr % 0x20 == 0:
                alignment = 0x20
            elif section.vaddr % 0x10 == 0:
                alignment = 0x10
            elif section.vaddr % 0x8 == 0:
                alignment = 0x8
            elif section.vaddr % 0x4 == 0:
                alignment = 0x4
            else:
                alignment = 2

            self._section_alignments[section.name] = alignment

        l.debug('Generating CFG...')
        cfg = self.project.analyses.CFG(normalize=True, resolve_indirect_jumps=True, collect_data_references=True,
                                        extra_memory_regions=[(0x4347c000, 0x4347c000 + 0x1000)],
                                        data_type_guessing_handlers=[
                                            self._sequence_handler,
                                            self._cgc_extended_application_handler,
                                            self._unknown_data_size_handler,
                                        ],
                                        )

        self.cfg = cfg

        old_capstone_syntax = self.project.arch.capstone_x86_syntax
        if old_capstone_syntax is None:
            old_capstone_syntax = 'intel'

        if self.syntax == 'at&t':
            # switch capstone to AT&T style
            self.project.arch.capstone_x86_syntax = "at&t"
            # clear the block cache in lifter!
            self.project.factory.default_engine.clear_cache()

        # initialize symbol manager
        self.symbol_manager = SymbolManager(self, cfg)

        # collect address of all instructions
        l.debug('Collecting instruction addresses...')
        for cfg_node in self.cfg.nodes():
            self.all_insn_addrs |= set(cfg_node.instruction_addrs)

        # Functions

        l.debug('Creating functions...')
        for f in cfg.kb.functions.values():
            # Skip all SimProcedures
            if self.project.is_hooked(f.addr):
                continue
            elif self.project.simos.is_syscall_addr(f.addr):
                continue

            # Check which section the start address belongs to
            section = next(iter(sec.name for sec in self.project.loader.main_object.sections
                                if f.addr >= sec.vaddr and f.addr < sec.vaddr + sec.memsize
                                ),
                           ".text"
                           )

            if section in ('.got', '.plt', 'init', 'fini'):
                continue

            procedure = Procedure(self, f, section=section)
            self.procedures.append(procedure)

        self.procedures = sorted(self.procedures, key=lambda x: x.addr)

        # Data

        has_sections = len(self.project.loader.main_object.sections) > 0

        l.debug('Creating data entries...')
        for addr, memory_data in cfg._memory_data.items():

            if memory_data.sort in ('code reference', ):
                continue

            if memory_data.sort == 'string':
                # it might be the CGC package list
                new_sort, new_size = self._cgc_package_list_identifier(memory_data.address, memory_data.size)
                if new_sort is not None:
                    # oh we got it!
                    memory_data = memory_data.copy()
                    memory_data.sort = new_sort

            if has_sections:
                # Check which section the start address belongs to
                section = next(iter(sec for sec in self.project.loader.main_object.sections
                                    if sec.vaddr <= addr < sec.vaddr + sec.memsize
                                    ),
                               None
                               )

                if section is not None and section.name not in ('.note.gnu.build-id', ):  # ignore certain section names
                    data = Data(self, memory_data, section=section)
                    self.data.append(data)
                elif memory_data.sort == 'segment-boundary':
                    # it just points to the end of the segment or a section
                    section = next(iter(sec for sec in self.project.loader.main_object.sections
                                        if addr == sec.vaddr + sec.memsize),
                                   None
                                   )
                    if section is not None:
                        data = Data(self, memory_data, section=section)
                        self.data.append(data)

                else:
                    # data = Data(self, memory_data, section_name='.data')
                    # the data is not really within any existing section. weird. ignored it.
                    pass
            else:
                # the binary does not have any section
                # we use segment information instead
                # TODO: this logic needs reviewing
                segment = next(iter(seg for seg in self.project.loader.main_object.segments
                                    if seg.vaddr <= addr <= seg.vaddr + seg.memsize
                                    ),
                               None
                               )

                if segment is not None:
                    data = Data(self, memory_data, section_name='.data')
                    self.data.append(data)

        # remove all data that belong to GCC-specific sections
        section_names_to_ignore = {'.init', '.fini', '.fini_array', '.jcr', '.dynamic', '.got', '.got.plt',
                                   '.eh_frame_hdr', '.eh_frame', '.rel.dyn', '.rel.plt', '.rela.dyn', '.rela.plt',
                                   '.dynstr', '.dynsym', '.interp', '.note.ABI-tag', '.note.gnu.build-id', '.gnu.hash',
                                   '.gnu.version', '.gnu.version_r'
                                   }

        # make sure there are always memory data entries pointing at the end of sections
        all_data_addrs = set(d.addr for d in self.data)
        all_procedure_addrs = set(f.addr for f in self.procedures)
        all_addrs = all_data_addrs | all_procedure_addrs

        if has_sections:
            for section in self.project.loader.main_object.sections:

                if section.name in section_names_to_ignore:
                    # skip all sections that are CGC specific
                    continue

                # make sure this section is inside a segment
                for segment in self.project.loader.main_object.segments:
                    segment_start = segment.vaddr
                    segment_end = segment_start + segment.memsize
                    if segment_start <= section.vaddr < segment_end:
                        break
                else:
                    # this section is not mapped into memory
                    continue

                section_boundary_addr = section.vaddr + section.memsize
                if section_boundary_addr not in all_addrs:
                    data = Data(self, addr=section_boundary_addr, size=0, sort='segment-boundary',
                                section_name=section.name
                                )
                    self.data.append(data)
                    # add the address to all_data_addrs so we don't end up adding another boundary in
                    all_data_addrs.add(section_boundary_addr)

        self.data = sorted(self.data, key=lambda x: x.addr)

        data_indices_to_remove = set()

        # Go through data entry list and refine them
        for i, data in enumerate(self.data):

            if i in data_indices_to_remove:
                continue

            # process the overlapping ones
            if i < len(self.data) - 1:
                if data.addr + data.size > self.data[i + 1].addr:
                    # they are overlapping :-(

                    # TODO: make sure new_size makes sense
                    new_size = self.data[i + 1].addr - data.addr

                    # there are cases that legit data is misclassified as pointers
                    # we are able to detect some of them here
                    if data.sort == 'pointer-array':
                        pointer_size = self.project.arch.bytes
                        if new_size % pointer_size != 0:
                            # the self.data[i+1] cannot be pointed to by a pointer
                            # remove that guy later
                            data_indices_to_remove.add(i + 1)
                            # mark the source as a non-pointer
                            # apparently the original Reassembleable Disassembler paper cannot get this case
                            source_addr = self.data[i + 1].memory_data.pointer_addr
                            if source_addr is not None:
                                # find the original data
                                original_data = next((d for d in self.data if d.addr <= source_addr < d.addr + d.size),
                                                     None
                                                     )
                                if original_data is not None:
                                    original_data.desymbolize()

                            continue

                    data.shrink(new_size)

            # process those ones whose type is unknown
            if data.sort == 'unknown' and data.size == 0:
                # increase its size until reaching the next item

                if i + 1 == len(self.data):
                    if data.section is None:
                        continue
                    data.size = data.section.vaddr + data.section.memsize - data.addr
                else:
                    data.size = self.data[i + 1].addr - data.addr

        for i in sorted(data_indices_to_remove, reverse=True):
            self.data = self.data[ : i] + self.data[i + 1 : ]

        # CGC-specific data filtering
        self.data = [ d for d in self.data if d.section_name not in section_names_to_ignore ]

        # restore capstone X86 syntax at the end
        if self.project.arch.capstone_x86_syntax != old_capstone_syntax:
            self.project.arch.capstone_x86_syntax = old_capstone_syntax
            self.project.factory.default_engine.clear_cache()

        l.debug('Initialized.')
1141187
public void initializing()
    {
        for (KernelExtension kernelExtension : kernelExtensions.keySet())
        {
            Collection<Plugin> plugins = kernelExtensions.get(kernelExtension);
            kernelExtension.initializing(plugins);
        }
    }
512740
def build_instruction_coverage_plugin() -> LaserPlugin:
        
        from mythril.laser.ethereum.plugins.implementations.coverage import (
            InstructionCoveragePlugin,
        )

        return InstructionCoveragePlugin()
1253492
def initialize_plugin(self):
        
        # Generate a list of blacklisted packages from the configuration and
        # store it into self.blacklist_package_names attribute so this
        # operation doesn't end up in the fastpath.
        if not self.blacklist_package_names:
            self.blacklist_release_requirements = (
                self._determine_filtered_package_requirements()
            )
            logger.info(
                f"Initialized release plugin {self.name}, filtering "
                + f"{self.blacklist_release_requirements}"
            )
224855
private static void initializeDefaultModules(SecurityContext context)
	{
		if (context.isInitialized()) {
			return;
		}
		
		if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("SecurityContext default module initializer starting");
		}
		
		String moduleName;
		
		// Loop through the module names
		for (int i=0; i<DEFAULT_MODULES.length; i++) {
			moduleName = DEFAULT_MODULES[i];
			try {
				LOGGER.debug(moduleName + MODULE_INITIALIZER_CLASS);
				
				// Get a class instance for the module initializer
				Class<?> clazz = Class.forName(moduleName + MODULE_INITIALIZER_CLASS);
				
				// Get the method instance for the module initializer's initialization method
				Method method = clazz.getMethod(MODULE_INITIALIZER_METHOD, (Class[])null);
				
				// Invoke the initialization method
				Object invokeResult = method.invoke(clazz.newInstance(), (Object[])null);
				
				// Validate that the result of the initialization is a valid module context
				if (invokeResult instanceof AbstractModuleContext) {
					
					// Register the module context
					context.registerModuleContext(moduleName, (AbstractModuleContext)invokeResult);
				} else {
					throw new IllegalArgumentException("Initializer method did not return correct type");
				}

				if (LOGGER.isInfoEnabled()) {
					LOGGER.info("SecurityContext module "+ moduleName + " initialized");
				}
			}  catch (ClassNotFoundException cnfe) {
				LOGGER.warn("SecurityContext module "+ moduleName + " not found, skipping.");
				if (LOGGER.isDebugEnabled()) {
					LOGGER.debug("Stack trace: ", cnfe);
				}
			} catch (NoSuchMethodException nsme) {
				LOGGER.warn("SecurityContext module "+ moduleName + " does not support default initialization, skipping.", nsme);
				if (LOGGER.isDebugEnabled()) {
					LOGGER.debug("Stack trace: ", nsme);
				}
			} catch (Throwable t) {
				LOGGER.error("Error initializing SecurityContext module "+ moduleName, t);
			} finally {

			}
		}
		if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("SecurityContext default module initializer ending");
		}		
	}