Package ghidra.features.bsim.query
Class GenSignatures
java.lang.Object
ghidra.features.bsim.query.GenSignatures
Generate decompiler signatures for a set of functions
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionGenSignatures
(boolean callgraph) Prepare for generation of signature information and (possibly) callgraph information -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDateColumnName
(String name) void
addExecutableCategories
(List<String> names) void
addFunctionTags
(List<String> names) void
clear()
Clear out any accumulated signaturesvoid
dispose()
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 programsvoid
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 ExecutableRecordvoid
scanFunction
(Function func) Calculate signatures for a single functionvoid
scanFunctions
(Iterator<Function> functions, int countestimate, TaskMonitor monitor) Generate signatures for a (potentially large) set of functions by spawning multiple threads to parallelize the workvoid
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 functionsvoid
setVectorFactory
(LSHVectorFactory vFactory) int
transferCachedFunctions
(DescriptionManager otherman, Iterator<Function> functions, PreFilter preFilter)
-
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
-
addFunctionTags
-
setVectorFactory
- Throws:
LSHException
-
addDateColumnName
-
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 fornmover
- if not null, overrides the "name" of the executablearchover
- if not null, overrides the "architecture" of the executablecompover
- if not null, overrides the "compiler" used to build the executablerepo
- the repository containing the executablepath
- 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 signaturecountestimate
- estimated number of functions (to initialize the monitor)monitor
- controls interruptions and progress reports- Throws:
DecompileException
- if the functions cannot be decompiled
-
scanFunction
Calculate signatures for a single function- Parameters:
func
- is the function to scan- Throws:
DecompileException
- if the decompiler task fails
-
scanFunctionsMetadata
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 formonitor
- the task monitor
-
dispose
public void dispose() -
getPathFromDomainFile
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
Return the weights file that should be used to compare functions between two programs- Parameters:
id1
- is the language of the first programid2
- 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
-