Package ghidra.features.bsim.query

# Class GenSignatures

java.lang.Object
ghidra.features.bsim.query.GenSignatures

public class GenSignatures extends Object
Generate decompiler signatures for a set of functions

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `GenSignatures.SignatureTask`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GenSignatures(boolean callgraph)`
  Prepare for generation of signature information and (possibly) callgraph information

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addDateColumnName(String name)`
  `void`
  `addExecutableCategories(List<String> names)`
  `void`
  `addFunctionTags(List<String> names)`
  `void`
  `clear()`
  Clear out any accumulated signatures
  `void`
  `dispose()`
  `DescriptionManager`
  `getDescriptionManager()`
  `static String`
  `getPathFromDomainFile(Program program)`
  Build an ExecutableRecord path from the domain file.
  `static ResourceFile`
  `getWeightsFile(LanguageID id1, LanguageID id2)`
  Return the weights file that should be used to compare functions between two programs
  `void`
  `openProgram(Program prog, String nmover, String archover, String compover, String repo, String path)`
  Prepare to collect signatures for a new program, essentially by starting up a new decompiler process and creating an ExecutableRecord
  `void`
  `scanFunction(Function func)`
  Calculate signatures for a single function
  `void`
  `scanFunctions(Iterator<Function> functions, int countestimate, TaskMonitor monitor)`
  Generate signatures for a (potentially large) set of functions by spawning multiple threads to parallelize the work
  `void`
  `scanFunctionsMetadata(Iterator<Function> iter, TaskMonitor monitor)`
  Generate just the update metadata for functions in the currently open program if -iter- is null, generate metadata for all functions
  `void`
  `setVectorFactory(LSHVectorFactory vFactory)`
  `int`
  `transferCachedFunctions(DescriptionManager otherman, Iterator<Function> functions, PreFilter preFilter)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### GenSignatures

    public GenSignatures(boolean callgraph)
    Prepare for generation of signature information and (possibly) callgraph information
    Parameters:
      `callgraph` - is true if the user wants callgraph information to be generated at the same time as signatures

- ## Method Details

  - ### addExecutableCategories

    public void addExecutableCategories(List<String> names)

  - ### addFunctionTags

    public void addFunctionTags(List<String> names)

  - ### setVectorFactory

    public void setVectorFactory(LSHVectorFactory vFactory) throws LSHException
    Throws:
      `LSHException`

  - ### addDateColumnName

    public void addDateColumnName(String name)

  - ### getDescriptionManager

    public DescriptionManager getDescriptionManager()

  - ### clear

    public void clear()
    Clear out any accumulated signatures

  - ### openProgram

    public void openProgram(Program prog, String nmover, String archover, String compover, String repo, String path) throws LSHException
    Prepare to collect signatures for a new program, essentially by starting up a new decompiler process and creating an ExecutableRecord
    Parameters:
      `prog` - is the program to prepare for
      `nmover` - if not null, overrides the "name" of the executable
      `archover` - if not null, overrides the "architecture" of the executable
      `compover` - if not null, overrides the "compiler" used to build the executable
      `repo` - the repository containing the executable
      `path` - the path (within the repo) where the executable can be found
    Throws:
      `LSHException` - if a new executable record cannot be created

  - ### transferCachedFunctions

    public int transferCachedFunctions(DescriptionManager otherman, Iterator<Function> functions, PreFilter preFilter) throws LSHException
    Throws:
      `LSHException`

  - ### scanFunctions

    public void scanFunctions(Iterator<Function> functions, int countestimate, TaskMonitor monitor) throws DecompileException
    Generate signatures for a (potentially large) set of functions by spawning multiple threads to parallelize the work
    Parameters:
      `functions` - the set of functions to signature
      `countestimate` - estimated number of functions (to initialize the monitor)
      `monitor` - controls interruptions and progress reports
    Throws:
      `DecompileException` - if the functions cannot be decompiled

  - ### scanFunction

    public void scanFunction(Function func) throws DecompileException
    Calculate signatures for a single function
    Parameters:
      `func` - is the function to scan
    Throws:
      `DecompileException` - if the decompiler task fails

  - ### scanFunctionsMetadata

    public void scanFunctionsMetadata(Iterator<Function> iter, TaskMonitor monitor)
    Generate just the update metadata for functions in the currently open program if -iter- is null, generate metadata for all functions
    Parameters:
      `iter` - iterates over the set of Functions to generate metadata for
      `monitor` - the task monitor

  - ### dispose

    public void dispose()

  - ### getPathFromDomainFile

    public static String getPathFromDomainFile(Program program)
    Build an ExecutableRecord path from the domain file. WARNING: Make sure the program has been saved previously before calling this, otherwise you get an (inaccurate) result of "/"
    Parameters:
      `program` - the current program
    Returns:
      the path to this program within the repository as a string

  - ### getWeightsFile

    public static ResourceFile getWeightsFile(LanguageID id1, LanguageID id2) throws IOException
    Return the weights file that should be used to compare functions between two programs
    Parameters:
      `id1` - is the language of the first program
      `id2` - is the language of the second program (can be same as first program)
    Returns:
      the XML weights file, or null if there is no valid weights file
    Throws:
      `IOException` - if the module data directory cannot be found