Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::Signature Class Reference

A feature describing some aspect of a function or other unit of code. More...

#include <signature.hh>

Inheritance diagram for ghidra::Signature:
[legend]

Public Member Functions

 Signature (hashword h)
 Constructor.
 
uint4 getHash (void) const
 Get the underyling 32-bit hash of the feature.
 
void print (ostream &s) const
 Print the feature hash and a brief description of this feature to the given stream.
 
int4 compare (const Signature *op2) const
 Compare two features.
 
virtual ~Signature (void)
 Destructor.
 
virtual void encode (Encoder &encoder) const
 
virtual void decode (Decoder &decoder)
 Encode this feature to the given stream.
 
virtual void printOrigin (ostream &s) const
 Restore this feature from the given stream.
 

Static Public Member Functions

static bool comparePtr (Signature *a, Signature *b)
 Compare two Signature pointers via their underlying hash values.
 

Private Attributes

uint4 sig
 Underlying 32-bit hash.
 

Detailed Description

A feature describing some aspect of a function or other unit of code.

The underlying representation is just a 32-bit hash of the information representing the feature, but derived classes may be contain other meta-data describing where and how the feature was formed. Two features are generally unordered (they are either equal or not equal), but an ordering is used internally to normalize the vector representation and accelerate comparison.

Member Function Documentation

◆ compare()

int4 ghidra::Signature::compare ( const Signature op2) const

Compare two features.

The underlying hashes of the two features are compared as unsigned values.

Parameters
op2is the other feature to compare with this
Returns
-1, 0, or 1 if this is ordered before, equal to, or after the other feature

References sig.

◆ decode()

void ghidra::Signature::decode ( Decoder decoder)
virtual

Encode this feature to the given stream.

The hash value corresponding to this feature is read from the stream.

Parameters
decoderis the stream decoder

References ghidra::Decoder::closeElement(), ghidra::Decoder::openElement(), ghidra::Decoder::readUnsignedInteger(), and sig.

◆ encode()

void ghidra::Signature::encode ( Encoder encoder) const
virtual

The hash value is encoded to the stream, along with any descriptive information about how the feature was formed.

Parameters
encoderis the stream encoder

Reimplemented in ghidra::VarnodeSignature, ghidra::BlockSignature, and ghidra::CopySignature.

References ghidra::Encoder::closeElement(), getHash(), ghidra::Encoder::openElement(), and ghidra::Encoder::writeUnsignedInteger().

◆ print()

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

Print the feature hash and a brief description of this feature to the given stream.

Parameters
sis the given stream to write to

References printOrigin(), and sig.

◆ printOrigin()

virtual void ghidra::Signature::printOrigin ( ostream &  s) const
inlinevirtual

Restore this feature from the given stream.

Print a brief description of this feature to the given stream

Reimplemented in ghidra::VarnodeSignature, ghidra::BlockSignature, and ghidra::CopySignature.

References sig.

Referenced by print().


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