decompiler  1.0.0
Public Member Functions | List of all members
JoinSpace Class Reference

The pool of logically joined variables. More...

#include <space.hh>

Inheritance diagram for JoinSpace:
AddrSpace

Public Member Functions

 JoinSpace (AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
 
virtual void saveXmlAttributes (ostream &s, uintb offset) const
 
virtual void saveXmlAttributes (ostream &s, uintb offset, int4 size) const
 
virtual uintb restoreXmlAttributes (const Element *el, uint4 &size) const
 
virtual void printRaw (ostream &s, uintb offset) const
 Write an address in this space to a stream. More...
 
virtual uintb read (const string &s, int4 &size) const
 Read in an address (and possible size) from a string. More...
 
virtual void saveXml (ostream &s) const
 Write the details of this space as XML. More...
 
virtual void restoreXml (const Element *el)
 Recover the details of this space from XML. More...
 
- Public Member Functions inherited from AddrSpace
 AddrSpace (AddrSpaceManager *m, const Translate *t, spacetype tp, const string &nm, uint4 size, uint4 ws, int4 ind, uint4 fl, int4 dl)
 
 AddrSpace (AddrSpaceManager *m, const Translate *t, spacetype tp)
 For use with restoreXml. More...
 
virtual ~AddrSpace (void)
 The address space destructor.
 
const string & getName (void) const
 Get the name. More...
 
AddrSpaceManagergetManager (void) const
 Get the space manager. More...
 
const TranslategetTrans (void) const
 Get the processor translator. More...
 
spacetype getType (void) const
 Get the type of space. More...
 
int4 getDelay (void) const
 Get number of heritage passes being delayed. More...
 
int4 getDeadcodeDelay (void) const
 Get number of passes before deadcode removal is allowed. More...
 
int4 getIndex (void) const
 Get the integer identifier. More...
 
uint4 getWordSize (void) const
 Get the addressable unit size. More...
 
uint4 getAddrSize (void) const
 Get the size of the space. More...
 
uintb getHighest (void) const
 Get the highest byte-scaled address. More...
 
uintb wrapOffset (uintb off) const
 Wrap -off- to the offset that fits into this space. More...
 
char getShortcut (void) const
 Get the shortcut character. More...
 
bool contain (AddrSpace *id2) const
 Determine if this space contains another. More...
 
bool isHeritaged (void) const
 Return true if dataflow has been traced. More...
 
bool doesDeadcode (void) const
 Return true if dead code analysis should be done on this space. More...
 
bool hasPhysical (void) const
 Return true if data is physically stored in this. More...
 
bool isBigEndian (void) const
 Return true if values in this space are big endian. More...
 
bool isReverseJustified (void) const
 Return true if alignment justification does not match endianness. More...
 
bool isOverlay (void) const
 Return true if this is an overlay space.
 
bool isOverlayBase (void) const
 Return true if other spaces overlay this space.
 
bool isTruncated (void) const
 Return true if this space is truncated from its original size. More...
 
uintm data2Uintm (const uint1 *ptr, int4 size) const
 Convert a sequence of bytes into an integer value. More...
 
void printOffset (ostream &s, uintb offset) const
 Write an address offset to a stream. More...
 
virtual int4 numSpacebase (void) const
 Number of base registers associated with this space. More...
 
virtual const VarnodeDatagetSpacebase (int4 i) const
 Get a base register that creates this virtual space. More...
 
virtual const VarnodeDatagetSpacebaseFull (int4 i) const
 Return original spacebase register before truncation. More...
 
virtual bool stackGrowsNegative (void) const
 Return true if a stack in this space grows negative. More...
 
virtual AddrSpacegetContain (void) const
 Return this space's containing space (if any) More...
 

Additional Inherited Members

- Public Types inherited from AddrSpace
enum  {
  big_endian = 1, heritaged = 2, does_deadcode = 4, programspecific = 8,
  reverse_justification = 16, overlay = 32, overlaybase = 64, truncated = 128,
  hasphysical = 256
}
 
- Static Public Member Functions inherited from AddrSpace
static uintb addressToByte (uintb val, uint4 ws)
 Scale from addressable units to byte units. More...
 
static uintb byteToAddress (uintb val, uint4 ws)
 Scale from byte units to addressable units. More...
 
static int4 addressToByteInt (int4 val, uint4 ws)
 Scale int4 from addressable units to byte units. More...
 
static int4 byteToAddressInt (int4 val, uint4 ws)
 Scale int4 from byte units to addressable units. More...
 
- Protected Member Functions inherited from AddrSpace
void calcScaleMask (void)
 Calculate scale and mask. More...
 
void assignShortcut (void)
 Assign a shortcut character to the space. More...
 
void setFlags (uint4 fl)
 Set a cached attribute. More...
 
void clearFlags (uint4 fl)
 Clear a cached attribute. More...
 
void saveBasicAttributes (ostream &s) const
 Write the XML attributes of this space. More...
 
void truncateSpace (uint4 newsize)
 
- Protected Attributes inherited from AddrSpace
string name
 Name of this space.
 
uint4 addressSize
 Size of an address into this space in bytes.
 
uint4 wordsize
 Size of unit being addressed (1=byte)
 
int4 index
 An integer identifier for the space.
 
int4 delay
 Delay in heritaging this space.
 
int4 deadcodedelay
 Delay before deadcode removal is allowed on this space.
 

Detailed Description

The pool of logically joined variables.

Some logical variables are split across non-contiguous regions of memory. This space creates a virtual place for these logical variables to exist. Any memory location within this space is backed by 2 or more memory locations in other spaces that physically hold the pieces of the logical value. The database controlling symbols is responsible for keeping track of mapping the logical address in this space to its physical pieces. Offsets into this space do not have an absolute meaning, the database may vary what offset is assigned to what set of pieces.

Constructor & Destructor Documentation

◆ JoinSpace()

JoinSpace::JoinSpace ( AddrSpaceManager m,
const Translate t,
const string &  nm,
int4  ind 
)

This is the constructor for the join space, which is automatically constructed by the analysis engine, and constructed only once. The name should always be join.

Parameters
mis the associated address space manager
tis the associated processor translator
nmis the name of the space
indis the integer identifier

References AddrSpace::clearFlags(), and AddrSpace::heritaged.

Member Function Documentation

◆ printRaw()

void JoinSpace::printRaw ( ostream &  s,
uintb  offset 
) const
virtual

Write an address in this space to a stream.

This is a printing method for the debugging routines. It prints taking into account the wordsize, adding a "+n" if the offset is not on-cut with wordsize. It also returns the expected/typical size of values from this space.

Parameters
sis the stream being written
offsetis the offset to be printed

Reimplemented from AddrSpace.

References AddrSpaceManager::findJoin(), AddrSpace::getManager(), JoinRecord::getPiece(), JoinRecord::getUnified(), JoinRecord::numPieces(), and VarnodeData::size.

◆ read()

uintb JoinSpace::read ( const string &  s,
int4 &  size 
) const
virtual

Read in an address (and possible size) from a string.

For the console mode, an address space can tailor how it converts user strings into offsets within the space. The base routine can read and convert register names as well as absolute hex addresses. A size can be indicated by appending a ':' and integer, .i.e. 0x1000:2. Offsets within a register can be indicated by appending a '+' and integer, i.e. eax+2

Parameters
sis the string to be parsed
sizeis a reference to the size being returned
Returns
the parsed offset

Reimplemented from AddrSpace.

References AddrSpaceManager::findAddJoin(), AddrSpace::getManager(), Translate::getRegister(), AddrSpaceManager::getSpaceByShortcut(), AddrSpace::getTrans(), JoinRecord::getUnified(), VarnodeData::offset, AddrSpace::read(), and AddrSpace::shortcut.

◆ restoreXml()

void JoinSpace::restoreXml ( const Element el)
virtual

Recover the details of this space from XML.

Walk a parsed XML tag and recover all the properties defining this space. The processor translator, trans, and the type must already be filled in.

Parameters
elis the parsed XML tag

Reimplemented from AddrSpace.

◆ restoreXmlAttributes()

uintb JoinSpace::restoreXmlAttributes ( const Element el,
uint4 &  size 
) const
virtual

Restore a join address from an XML tag. Pieces of the join are encoded as a sequence of tag attributes. The Translate::findAddJoin method is used to construct a logical address within the join space.

Parameters
elis the parsed XML element to extract the address from
sizeis a reference to be filled in as the size encoded by the tag
Returns
the offset of the final address encoded by the tag

Reimplemented from AddrSpace.

References AddrSpaceManager::findAddJoin(), AddrSpace::getManager(), Translate::getRegister(), AddrSpaceManager::getSpaceByName(), AddrSpace::getTrans(), JoinRecord::getUnified(), VarnodeData::offset, VarnodeData::size, VarnodeData::space, and AddrSpace::trans.

◆ saveXml()

void JoinSpace::saveXml ( ostream &  s) const
virtual

Write the details of this space as XML.

Write a tag fully describing the details of this space suitable for later recovery via restoreXml.

Parameters
sis the stream being written

Reimplemented from AddrSpace.

◆ saveXmlAttributes() [1/2]

void JoinSpace::saveXmlAttributes ( ostream &  s,
uintb  offset 
) const
virtual

Save a join address to the stream as XML. This method in the interface only outputs XML attributes for a single tag, so we are forced to encode what should probably be recursive tags into an attribute

Parameters
sis the stream being written to
offsetis the offset within the address space to encode

Reimplemented from AddrSpace.

References AddrSpaceManager::findJoin(), AddrSpace::getManager(), AddrSpace::getName(), JoinRecord::getPiece(), JoinRecord::getUnified(), JoinRecord::numPieces(), VarnodeData::size, and VarnodeData::space.

◆ saveXmlAttributes() [2/2]

void JoinSpace::saveXmlAttributes ( ostream &  s,
uintb  offset,
int4  size 
) const
virtual

Save a join address to the stream as XML. This method in the interface only outputs XML attributes for a single tag, so we are forced to encode what should probably be recursive tags into an attribute

Parameters
sis the stream being written to
offsetis the offset within the address space to encode
sizeis the size of the memory location being encoded

Reimplemented from AddrSpace.

References AddrSpaceManager::findJoin(), AddrSpace::getManager(), AddrSpace::getName(), JoinRecord::getPiece(), JoinRecord::getUnified(), JoinRecord::numPieces(), VarnodeData::size, and VarnodeData::space.


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