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

The decoder for the .sla file format. More...

#include <slaformat.hh>

Inheritance diagram for ghidra::sla::FormatDecode:
[legend]
Collaboration diagram for ghidra::sla::FormatDecode:
[legend]

Public Member Functions

 FormatDecode (const AddrSpaceManager *spcManager)
 Initialize the decoder.
 
virtual ~FormatDecode (void)
 Destructor.
 
virtual void ingestStream (istream &s)
 Prepare to decode a given stream.
 
- Public Member Functions inherited from ghidra::PackedDecode
 PackedDecode (const AddrSpaceManager *spcManager)
 Constructor.
 
virtual uint4 peekElement (void)
 Peek at the next child element of the current parent, without traversing in (opening) it.
 
virtual uint4 openElement (void)
 Open (traverse into) the next child element of the current parent.
 
virtual uint4 openElement (const ElementId &elemId)
 Open (traverse into) the next child element, which must be of a specific type.
 
virtual void closeElement (uint4 id)
 Close the current element.
 
virtual void closeElementSkipping (uint4 id)
 Close the current element, skipping any child elements that have not yet been parsed.
 
virtual void rewindAttributes (void)
 Reset attribute traversal for the current element.
 
virtual uint4 getNextAttributeId (void)
 Get the next attribute id for the current element.
 
virtual uint4 getIndexedAttributeId (const AttributeId &attribId)
 Get the id for the (current) attribute, assuming it is indexed.
 
virtual bool readBool (void)
 Parse the current attribute as a boolean value.
 
virtual bool readBool (const AttributeId &attribId)
 Find and parse a specific attribute in the current element as a boolean value.
 
virtual intb readSignedInteger (void)
 Parse the current attribute as a signed integer value.
 
virtual intb readSignedInteger (const AttributeId &attribId)
 Find and parse a specific attribute in the current element as a signed integer.
 
virtual intb readSignedIntegerExpectString (const string &expect, intb expectval)
 Parse the current attribute as either a signed integer value or a string.
 
virtual intb readSignedIntegerExpectString (const AttributeId &attribId, const string &expect, intb expectval)
 Find and parse a specific attribute in the current element as either a signed integer or a string.
 
virtual uintb readUnsignedInteger (void)
 Parse the current attribute as an unsigned integer value.
 
virtual uintb readUnsignedInteger (const AttributeId &attribId)
 Find and parse a specific attribute in the current element as an unsigned integer.
 
virtual string readString (void)
 Parse the current attribute as a string.
 
virtual string readString (const AttributeId &attribId)
 Find the specific attribute in the current element and return it as a string.
 
virtual AddrSpacereadSpace (void)
 Parse the current attribute as an address space.
 
virtual AddrSpacereadSpace (const AttributeId &attribId)
 Find the specific attribute in the current element and return it as an address space.
 
virtual OpCode readOpcode (void)
 Parse the current attribute as a p-code OpCode.
 
virtual OpCode readOpcode (AttributeId &attribId)
 Find the specific attribute in the current element and return it as an OpCode.
 
- Public Member Functions inherited from ghidra::Decoder
 Decoder (const AddrSpaceManager *spc)
 Base constructor.
 
const AddrSpaceManagergetAddrSpaceManager (void) const
 Get the manager used for address space decoding.
 
virtual ~Decoder (void)
 Destructor.
 
void skipElement (void)
 Skip parsing of the next element.
 

Private Attributes

uint1 * inBuffer
 The input buffer.
 

Static Private Attributes

static const int4 IN_BUFFER_SIZE = 4096
 The size of the input buffer.
 

Additional Inherited Members

- Static Public Attributes inherited from ghidra::PackedDecode
static const int4 BUFFER_SIZE = 1024
 The size, in bytes, of a single cached chunk of the input stream.
 
- Protected Member Functions inherited from ghidra::PackedDecode
uint1 * allocateNextInputBuffer (int4 pad)
 Allocate the next chunk of space in the input stream.
 
void endIngest (int4 bufPos)
 Finish set up for reading input stream.
 
- Protected Attributes inherited from ghidra::Decoder
const AddrSpaceManagerspcManager
 Manager for decoding address space attributes.
 

Detailed Description

The decoder for the .sla file format.

This verifies the .sla file header, does decompression, and decodes the raw data elements/attributes.

Constructor & Destructor Documentation

◆ FormatDecode()

ghidra::sla::FormatDecode::FormatDecode ( const AddrSpaceManager spcManager)

Initialize the decoder.

Parameters
spcManageris the (uninitialized) manager that will hold decoded address spaces

References IN_BUFFER_SIZE, and inBuffer.

Member Function Documentation

◆ ingestStream()

void ghidra::sla::FormatDecode::ingestStream ( istream &  s)
virtual

Prepare to decode a given stream.

Called once before any decoding. Currently this is assumed to make an internal copy of the stream data, i.e. the input stream is cleared before any decoding takes place.

Parameters
sis the given input stream to be decode
Returns
true if the stream was fully ingested

Reimplemented from ghidra::PackedDecode.

References ghidra::PackedDecode::allocateNextInputBuffer(), ghidra::PackedDecode::BUFFER_SIZE, ghidra::PackedDecode::endIngest(), IN_BUFFER_SIZE, inBuffer, ghidra::Decompress::inflate(), ghidra::Decompress::input(), and ghidra::Decompress::isFinished().

Referenced by ghidra::Sleigh::initialize().


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