Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::SigManager Class Referenceabstract

A container for collecting a set of features (a feature vector) for a single function. More...

#include <signature.hh>

Inheritance diagram for ghidra::SigManager:
[legend]
Collaboration diagram for ghidra::SigManager:
[legend]

Public Member Functions

 SigManager (void)
 Constructor.
 
virtual ~SigManager (void)
 Destructor.
 
virtual void clear (void)
 Clear all current Signature/feature resources.
 
virtual void initializeFromStream (istream &s)=0
 Read configuration information from a character stream.
 
virtual void setCurrentFunction (const Funcdata *f)
 Set the function used for (future) feature generation.
 
virtual void generate (void)=0
 Generate all features for the current function.
 
int4 numSignatures (void) const
 Get the number of features currently generated.
 
SignaturegetSignature (int4 i) const
 Get the i-th Signature/feature.
 
void getSignatureVector (vector< uint4 > &feature) const
 Get the feature vector as a simple array of hashes.
 
hashword getOverallHash (void) const
 Combine all feature hashes into one overall hash.
 
void sortByHash (void)
 Sort all current features.
 
void print (ostream &s) const
 Print a brief description of all current features to a stream.
 
void encode (Encoder &encoder) const
 Encode all current features to the given stream.
 

Static Public Member Functions

static uint4 getSettings (void)
 Get the settings currently being used for signature generation.
 
static void setSettings (uint4 newvalue)
 Establish settings to use for future signature generation.
 

Protected Member Functions

void addSignature (Signature *sig)
 Add a new feature to the manager.
 

Protected Attributes

const Funcdatafd
 Current function off of which we are generating features.
 

Private Member Functions

void clearSignatures (void)
 Clear all current Signature/feature objects from this manager.
 

Private Attributes

vector< Signature * > sigs
 Feature set for the current function.
 

Static Private Attributes

static uint4 settings = 0
 Signature settings (across all managers)
 

Detailed Description

A container for collecting a set of features (a feature vector) for a single function.

This manager handles:

The manager can be reused for multiple functions.

Member Function Documentation

◆ clear()

void ghidra::SigManager::clear ( void  )
virtual

Clear all current Signature/feature resources.

Clear all resources consumed by the manager, including Signature objects and other resources used for generating features. The manager is ready for another round of signature generation.

Reimplemented in ghidra::GraphSigManager.

References clearSignatures().

Referenced by ghidra::GraphSigManager::clear().

◆ clearSignatures()

void ghidra::SigManager::clearSignatures ( void  )
private

Clear all current Signature/feature objects from this manager.

Clear any Signature objects specifically.

References sigs.

Referenced by clear(), and ~SigManager().

◆ encode()

void ghidra::SigManager::encode ( Encoder encoder) const

Encode all current features to the given stream.

Full details about all features currently stored in this manager are written to the stream.

Parameters
encoderis the stream encoder

References ghidra::Encoder::closeElement(), ghidra::Encoder::openElement(), and sigs.

◆ generate()

virtual void ghidra::SigManager::generate ( void  )
pure virtual

Generate all features for the current function.

Implemented in ghidra::GraphSigManager.

◆ getOverallHash()

hashword ghidra::SigManager::getOverallHash ( void  ) const

Combine all feature hashes into one overall hash.

Returns
the overall hash value

References getSignatureVector().

◆ getSignatureVector()

void ghidra::SigManager::getSignatureVector ( vector< uint4 > &  feature) const

Get the feature vector as a simple array of hashes.

The hash value associated with any features currently held by the manager are written to the provided container. The hash values are sorted.

Parameters
featurewill contain the collected hash values

References sigs.

Referenced by getOverallHash().

◆ initializeFromStream()

virtual void ghidra::SigManager::initializeFromStream ( istream &  s)
pure virtual

Read configuration information from a character stream.

Implemented in ghidra::GraphSigManager.

◆ print()

void ghidra::SigManager::print ( ostream &  s) const

Print a brief description of all current features to a stream.

A brief description of each feature and the hash value itself are printed to the stream, one feature per line.

Parameters
sis the character stream to write to

References sigs.

◆ setCurrentFunction()

void ghidra::SigManager::setCurrentFunction ( const Funcdata f)
virtual

Set the function used for (future) feature generation.

Parameters
fis the function being set

Reimplemented in ghidra::GraphSigManager.

References fd.

Referenced by ghidra::GraphSigManager::setCurrentFunction().

◆ setSettings()

void ghidra::SigManager::setSettings ( uint4  newvalue)
static

Establish settings to use for future signature generation.

Parameters
newvalueare the settings to be used

References settings.

Referenced by ghidra::SetSignatureSettings::rawAction().


The documentation for this class was generated from the following files: