Package soot

Class SourceLocator

  • Direct Known Subclasses:
    ModulePathSourceLocator

    public class SourceLocator
    extends Object
    Provides utility methods to retrieve an input stream for a class name, given a classfile, or jimple or baf output files.
    • Method Detail

      • invalidateCaches

        public void invalidateCaches()
      • ensureDirectoryExists

        public static void ensureDirectoryExists​(File dir)
        Create the given directory and all parent directories if dir is non-null.
        Parameters:
        dir -
      • explodeClassPath

        public static List<String> explodeClassPath​(String classPath)
        Explodes a class path into a list of individual class path entries.
      • getClassSource

        public ClassSource getClassSource​(String className)
        Given a class name, uses the soot-class-path to return a ClassSource for the given class.
      • additionalClassLoader

        public void additionalClassLoader​(ClassLoader c)
      • setupClassProviders

        protected void setupClassProviders()
      • setClassProviders

        public void setClassProviders​(List<ClassProvider> classProviders)
      • invalidateClassPath

        public void invalidateClassPath()
      • classesInDynamicPackage

        public Set<String> classesInDynamicPackage​(String str)
      • getExtensionFor

        public String getExtensionFor​(int rep)
      • getOutputDir

        public String getOutputDir()
        Returns the output directory given by Options or a default if not set. Also ensures that all directories in the path exist.
        Returns:
        the output directory from Options or a default if not set
      • getOutputJarName

        public String getOutputJarName()
        If {@link Options#v()#output_jar()} is set, returns the name of the jar file to which the output will be written. The name of the jar file can be given with the -output-dir option or a default will be used. Also ensures that all directories in the path exist.
        Returns:
        the name of the Jar file to which outputs are written
      • lookupInClassPath

        public IFoundFile lookupInClassPath​(String fileName)
        Searches for a file with the given name in the exploded classPath.
      • getSourceForClass

        public String getSourceForClass​(String className)
        Returns the name of the class in which the (possibly inner) class className appears.
      • dexClassIndex

        public Map<String,​File> dexClassIndex()
        Return the class index that maps class names to dex/assembly(exe/dll) files. A dex/exe/dll file contains multiple classes and is not structured as a "folder structure"
        Returns:
        the index
      • setDexClassIndex

        public void setDexClassIndex​(Map<String,​File> index)
        Set the class_container (dex, assembly) class index
        Parameters:
        index - the index
      • extendClassPath

        public void extendClassPath​(String newPathElement)
      • getDexClassPathExtensions

        public Set<String> getDexClassPathExtensions()
        Gets all files that were added to the classpath later on and that have not yet been processed for the dexClassIndex mapping
        Returns:
        The set of dex or apk or assembly (exe/dll) files that still need to be indexed
      • clearDexClassPathExtensions

        public void clearDexClassPathExtensions()
        Clears the set of dex or apk or assembly files that still need to be indexed
      • resetCaches

        public void resetCaches()
        Resets the cached class path, class providers, and source path to null. This method allows for subsequent calls to Scene.loadNecessaryClasses() to recompute and load the classes using updated configurations if provided.