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

Special AddrSpace for representing constants during analysis. More...

#include <space.hh>

Inheritance diagram for ConstantSpace:
AddrSpace

Public Member Functions

 ConstantSpace (AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
 Only constructor. More...
 
virtual void printRaw (ostream &s, uintb offset) const
 
virtual void saveXml (ostream &s) const
 
virtual void restoreXml (const Element *el)
 
- 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 getPointerLowerBound (void) const
 Get lower bound for assuming an offset is a pointer. More...
 
uintb getPointerUpperBound (void) const
 Get upper bound for assuming an offset is a pointer. More...
 
int4 getMinimumPtrSize (void) const
 Get the minimum pointer size for this space. 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 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 isOtherSpace (void) const
 Return true if this is the other address space.
 
bool isTruncated (void) const
 Return true if this space is truncated from its original size. More...
 
bool hasNearPointers (void) const
 Return true if near (truncated) pointers into this space are possible.
 
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...
 
virtual void saveXmlAttributes (ostream &s, uintb offset) const
 Save an address as XML. More...
 
virtual void saveXmlAttributes (ostream &s, uintb offset, int4 size) const
 Save an address and size as XML. More...
 
virtual uintb restoreXmlAttributes (const Element *el, uint4 &size) const
 Recover an offset and size. More...
 
virtual uintb read (const string &s, int4 &size) const
 Read in an address (and possible size) from a string. 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, is_otherspace = 512, has_nearpointers = 0x400
}
 
enum  { constant_space_index = 0, other_space_index = 1 }
 
- 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...
 
static bool compareByIndex (const AddrSpace *a, const AddrSpace *b)
 Compare two spaces by their index. More...
 
- Protected Member Functions inherited from AddrSpace
void calcScaleMask (void)
 Calculate scale and mask. 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 minimumPointerSize
 Smallest size of a pointer into this space (in bytes)
 
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

Special AddrSpace for representing constants during analysis.

The underlying RTL (See PcodeOp) represents all data in terms of an Address, which is made up of an AddrSpace and offset pair. In order to represent constants in the semantics of the RTL, there is a special constant address space. An offset within the address space encodes the actual constant represented by the pair. I.e. the pair (const,4) represents the constant 4 within the RTL. The size of the ConstantSpace has no meaning, as we always want to be able to represent an arbitrarily large constant. In practice, the size of a constant is limited by the offset field of an Address.

Constructor & Destructor Documentation

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

Only constructor.

This constructs the unique constant space By convention, the name is always "const" and the index is always 0.

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

References AddrSpace::big_endian, AddrSpace::clearFlags(), AddrSpace::does_deadcode, AddrSpace::heritaged, and AddrSpace::setFlags().

Member Function Documentation

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

Constants are always printed as hexidecimal values in the debugger and console dumps

Reimplemented from AddrSpace.

void ConstantSpace::restoreXml ( const Element el)
virtual

As the ConstantSpace is never saved, it should never get restored either.

Reimplemented from AddrSpace.

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

The ConstantSpace should never be explicitly saved as it is always built automatically

Reimplemented from AddrSpace.


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