Class ExecutableRecord
java.lang.Object
ghidra.features.bsim.query.description.ExecutableRecord
- All Implemented Interfaces:
- Comparable<ExecutableRecord>
Metadata about a specific executable, as stored in a BSim database
 There are two basic varieties:
   Normal executables, which can be viewed as a container of functions where
     each function has a body and an address (and a corresponding feature vector)
   Library executables, which contains functions that can only be identified by
     name and have no body (or corresponding feature vector)
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final Datestatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedExecutableRecord(String md5) Constructor for searching within a DescriptionManagerExecutableRecord(String enm, String arc, RowKey id) Constructor for a "library" executableExecutableRecord(String md5, String execName, String compilerName, String architecture, Date date, RowKey id, String repo, String path) Construct a normal (non-library) record.ExecutableRecord(String md5, String enm, String cnm, String arc, Date dt, List<CategoryRecord> uc, RowKey id, String repo, String pth) Construct a normal (non-library) record.
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringcalcLibraryMd5Placeholder(String enm, String arc) Generate a placeholder md5 string for a library executable based just on its name and architecturebooleanprotected voidbooleanCompare the set of categories that -this- and -op2- belong tointCompare just the metadata portion (names and versions) of two ExecutableRecords We do NOT compare categories as these may not have been read into the object yetintbooleandiffForUpdate(ExecutableRecord.Update res, ExecutableRecord fromDB) Assuming this is a (possibly) updated variant of another executable metadata record Prepare an Update record describing the difference between the two recordsbooleangetCategory(String type) Return the executable's settings for a specific category typegetDate()Get all the category settings of a specific type in alphabetic order.getMd5()getPath()getRowId()intbooleanhasCategory(String type, String value) Determine if an executable has been set with a specific category valueinthashCode()booleanbooleanstatic booleanisLibraryHash(String md5) Identify whether an md5 string is a placeholder hash (as generated bycalcLibraryMd5Placeholder(java.lang.String, java.lang.String))printRaw()Get the formatted raw executable metadata as a stringstatic ExecutableRecordrestoreXml(XmlPullParser parser, DescriptionManager man) Build a newExecutableRecordby deserializing from an XML streamvoidSerialize this executable (meta-data) to an XML streamprotected voidprotected voidsetCategory(List<CategoryRecord> cats) protected voidsetRepository(String repo, String newpath) Set the repository and path Strings for an executable, replacing any previous setting.protected voidprotected voidsetXrefIndex(int val) toString()
- 
Field Details- 
EMPTY_DATE
- 
ALREADY_STOREDpublic static final int ALREADY_STORED- See Also:
 
- 
LIBRARYpublic static final int LIBRARY- See Also:
 
- 
CATEGORIES_SETpublic static final int CATEGORIES_SET- See Also:
 
- 
METADATA_NAMEpublic static final int METADATA_NAME- See Also:
 
- 
METADATA_ARCHpublic static final int METADATA_ARCH- See Also:
 
- 
METADATA_COMPpublic static final int METADATA_COMP- See Also:
 
- 
METADATA_DATEpublic static final int METADATA_DATE- See Also:
 
- 
METADATA_REPOpublic static final int METADATA_REPO- See Also:
 
- 
METADATA_PATHpublic static final int METADATA_PATH- See Also:
 
- 
METADATA_LIBRpublic static final int METADATA_LIBR- See Also:
 
 
- 
- 
Constructor Details- 
ExecutableRecordConstructor for searching within a DescriptionManager- Parameters:
- md5- is hash of executable being searched for
 
- 
ExecutableRecordpublic ExecutableRecord(String md5, String execName, String compilerName, String architecture, Date date, RowKey id, String repo, String path) Construct a normal (non-library) record. Fill-in all fields except categories. Categories are marked as NOT set- Parameters:
- md5- is the md5 checksum
- execName- is the executable name
- compilerName- is the compiler name
- architecture- is the processor architecture
- date- is the date of ingest (may be null)
- id- is the row id of the record
- repo- is the repository containing the executable (may be null)
- path- is the path to the executable (may be null)
 
- 
ExecutableRecordpublic ExecutableRecord(String md5, String enm, String cnm, String arc, Date dt, List<CategoryRecord> uc, RowKey id, String repo, String pth) Construct a normal (non-library) record. Fill-in all fields.- Parameters:
- md5- is the md5 checksum
- enm- is the executable name
- cnm- is the compiler name
- arc- is the architecture
- dt- is the date of ingest (may be null)
- uc- is the categories (may be null, categories are considered SET regardless)
- id- is the row id of the record
- repo- is the repository containing the executable (may be null)
- pth- is the path to the executable (may be null)
 
- 
ExecutableRecordConstructor for a "library" executable- Parameters:
- enm- is the name of the library
- arc- is the architecture for functions in the library
- id- is the database (row) id of the record (may be null)
 
 
- 
- 
Method Details- 
calcLibraryMd5PlaceholderGenerate a placeholder md5 string for a library executable based just on its name and architecture- Parameters:
- enm- is the name of the library
- arc- is the architecture
- Returns:
- the placeholder md5 String
 
- 
setRepositorySet the repository and path Strings for an executable, replacing any previous setting. Truncate any trailing slash.- Parameters:
- repo- is (URL) string indicating which repository contains this executable
- newpath- is the path, relative to the repository, to the executable
- Throws:
- IllegalArgumentException- if invalid repo URL specified
 
- 
setRowId
- 
setAlreadyStoredprotected void setAlreadyStored()
- 
setXrefIndexprotected void setXrefIndex(int val) 
- 
setCategory
- 
cloneCategories
- 
getAllCategories- Returns:
- the list of CategoryRecords associated with this executable
 
- 
getCategoryReturn the executable's settings for a specific category type- Parameters:
- type- is the category type
- Returns:
- the list of settings with this type (or null)
 
- 
hasCategoryDetermine if an executable has been set with a specific category value- Parameters:
- type- is the type of category to check
- value- is the value to check for
- Returns:
- true if the executable has that value, false otherwise
 
- 
getMd5- Returns:
- the MD5 hash of the executable
 
- 
getNameExec- Returns:
- the name of the executable
 
- 
getArchitecture- Returns:
- the architecture associated with the executable
 
- 
getNameCompiler- Returns:
- the name of the compiler that built this executable
 
- 
getDate- Returns:
- the date this executable was ingested into the database
 
- 
getRepository- Returns:
- the URL of the repository containing this executable
 
- 
getPath- Returns:
- the (repository relative) path to the executable
 
- 
isLibrarypublic boolean isLibrary()- Returns:
- true if this executable is a "library" (functions identified only by name)
 
- 
isAlreadyStoredpublic boolean isAlreadyStored()- Returns:
- true if this database record has already been stored in the database
 
- 
categoriesAreSetpublic boolean categoriesAreSet()- Returns:
- true if categories have been queried in (does not mean that it has any categories)
 
- 
getURLString- Returns:
- the fully formed URL to this executable or null
 
- 
getExeCategoryAlphabeticGet all the category settings of a specific type in alphabetic order. Multiple values are returned in a single String separated by ','- Parameters:
- type- is the type of category to retrieve
- Returns:
- the concatenated list of settings
 
- 
getRowId- Returns:
- the database (row) id of this executable object
 
- 
getXrefIndexpublic int getXrefIndex()- Returns:
- the internal cross-referencing index for this executable
 
- 
saveXmlSerialize this executable (meta-data) to an XML stream- Parameters:
- fwrite- is the XML stream
- Throws:
- IOException- if there are I/O errors writing to the stream
 
- 
isLibraryHashIdentify whether an md5 string is a placeholder hash (as generated bycalcLibraryMd5Placeholder(java.lang.String, java.lang.String))- Parameters:
- md5- is the md5 string
- Returns:
- true if it is a placeholder, false otherwise
 
- 
restoreXmlpublic static ExecutableRecord restoreXml(XmlPullParser parser, DescriptionManager man) throws LSHException Build a newExecutableRecordby deserializing from an XML stream- Parameters:
- parser- is the XML parser
- man- is the DescriptionManager that should hold the new executable
- Returns:
- the new ExecutableRecord
- Throws:
- LSHException- if there are inconsistencies in the XML description
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
compareTo- Specified by:
- compareToin interface- Comparable<ExecutableRecord>
 
- 
compareMetadataCompare just the metadata portion (names and versions) of two ExecutableRecords We do NOT compare categories as these may not have been read into the object yet- Parameters:
- o- is ExecutableRecord to compare with this
- Returns:
- bit vector with a 1 bit for every field that differs
 
- 
compareCategoryCompare the set of categories that -this- and -op2- belong to- Parameters:
- op2- is executable to compare with this
- Returns:
- true if the categories are exactly the same
 
- 
diffForUpdateAssuming this is a (possibly) updated variant of another executable metadata record Prepare an Update record describing the difference between the two records- Parameters:
- res- is the Update record to fill in
- fromDB- is the other ExecutableRecord metadata
- Returns:
- true if overall there has been an update
 
- 
printRawGet the formatted raw executable metadata as a string- Returns:
- formatted metadata
 
 
-