def __init__(self,
                 pre_ast,
                 config_text,
                 system_map_text,
                 progress_cb=None,
                 cache_dir=None,
                 overwrite=False):
        """Initialize the ProfileBuilder.

        Args:
          pre_ast: A Preprocessor AST object.
          config_text: The content text of the kernel .config file
            (e.g. /boot/config-3.13.0-71-generic)
          system_map_text: The content text of the system map.
            (e.g. /boot/System.map-3.13.0-71-generic)
        """
        self.pre_ast_forest = pre_ast
        self.config_text = config_text
        self.system_map_text = system_map_text
        self.cache = util.CacheManager(cache_dir, force=overwrite)
        self.functions_ = functions.get_arithmetic_functions()

        if progress_cb:
            self.progress_cb = progress_cb
        else:
            self.progress_cb = ProgressReporter().report_progress
Exemple #2
0
 def __init__(self, include_directories, cache=None, progress_cb=None):
     self._preprocessing_parser = preprocessing_parser.PreprocessingParser()
     self._include_collector = (
         include_collecting_visitor.IncludeCollectingVisitor())
     self.include_directories = include_directories
     self.cache = cache or util.CacheManager(None)
     self.opened_files = []
     self.loaded_files = {}
     self.progress_cb = progress_cb or (lambda *_: None)
 def __init__(self,
              linux_source_path,
              module_source_path,
              progress_cb=None,
              cache_dir=None,
              overwrite=False):
     self.linux_source_path = linux_source_path
     self.module_source_path = module_source_path
     self.include_directories = (
         os.path.join(self.linux_source_path, 'arch/x86/include'),
         os.path.join(self.linux_source_path, 'arch/x86/include/generated'),
         os.path.join(self.linux_source_path, 'arch/x86/include/uapi'),
         os.path.join(self.linux_source_path, 'include'),
         os.path.join(self.linux_source_path, 'include/uapi'),
         '/usr/lib/gcc/x86_64-linux-gnu/4.8/include',
         '/usr/include',
     )
     self.cache = util.CacheManager(cache_dir, force=overwrite)
     if progress_cb:
         self.progress_cb = progress_cb
     else:
         self.progress_cb = ProgressReporter().report_progress