Predator  [unstable] git snapshot
Data Structures | Namespaces | Typedefs | Enumerations | Functions
symheap.hh File Reference

SymHeap - the elementary representation of the state of program memory. More...

#include "config.h"
#include "intrange.hh"
#include "symid.hh"
#include "util.hh"
#include <cl/code_listener.h>
#include <map>
#include <set>
#include <string>
#include <vector>

Go to the source code of this file.

Data Structures

union  CustomValueData
class  CustomValue
 representation of a custom value, such as integer literal, or code pointer More...
struct  CVar
 bundles static identification of a variable with its instance number More...
struct  CallInst
 bundles static identification of a function with its call instance number More...
struct  UniformBlock
 only uninitialized or nullified blocks; generic arrays and strings need more More...
class  SymHeapCore
 SymHeapCore - the elementary representation of the state of program memory. More...
class  FldHandle
class  PtrHandle
class  FldList
 ugly, but typedefs do not support partial declarations More...
struct  BindingOff
 tuple of binding offsets assigned to abstract objects More...
class  SymHeap
 extension of SymHeapCore dealing with abstract objects (list segments etc.) More...
class  ProtectionIntrusion
 temporarily disable protected mode of SymHeap in a debug build More...

Namespaces

namespace  CodeStorage
 object model that describes the analyzed code on the input
namespace  Trace
 directed acyclic graph of the symbolic execution trace

Typedefs

typedef IR::TInt TOffset
 a type used for integral offsets (changing this is known to cause problems)
typedef IR::TInt TSizeOf
 a type used for block sizes (do not set this to anything else than TOffset)
typedef IR::Range TSizeRange
 a type used for block size ranges (do not try to change this one either)
typedef std::vector< TOffsetTOffList
 a container to store offsets to
typedef std::vector< TValIdTValList
 container used to store value IDs to
typedef std::vector< TObjIdTObjList
 container used to store object IDs to
typedef std::set< TValIdTValSet
 container used to store value IDs to
typedef std::set< TObjIdTObjSet
 container used to store object IDs to
typedef std::map< TValId, TValIdTValMap
 a type used for (injective) value IDs mapping
typedef std::map< TObjId, TObjIdTObjMap
 a type used for (injective) object IDs mapping
typedef struct cl_typeTObjType
 a type used for type-info
typedef enum cl_type_e TObjCode
 a class of type (structure, pointer, union, ...)
typedef const
CodeStorage::Storage
TStorRef
 a reference to CodeStorage::Storage instance describing the analyzed code
typedef short TProtoLevel
 a type used for prototype level (0 means not a prototype)
typedef std::vector< CVarTCVarList
 a list of program variables
typedef std::set< CVarTCVarSet
 a set of program variables
typedef std::map< TOffset,
UniformBlock
TUniBlockMap
 a container used to return list of uniform blocks
typedef std::set< FldHandleTFldSet
 set of object handles
typedef short TMinLen
 a type used for minimal segment length (0+, 1+, ...)

Enumerations

enum  EValueOrigin {
  VO_INVALID,
  VO_ASSIGNED,
  VO_UNKNOWN,
  VO_REINTERPRET,
  VO_DEREF_FAILED,
  VO_STACK,
  VO_HEAP
}
 classification of kind of origins a value may come from More...
enum  EValueTarget {
  VT_INVALID,
  VT_UNKNOWN,
  VT_COMPOSITE,
  VT_CUSTOM,
  VT_OBJECT,
  VT_RANGE
}
 classification of kind of objects a value may point to More...
enum  EStorageClass {
  SC_INVALID,
  SC_UNKNOWN,
  SC_STATIC,
  SC_ON_HEAP,
  SC_ON_STACK
}
 classification of the storage class for objects More...
enum  ETargetSpecifier {
  TS_INVALID,
  TS_REGION,
  TS_FIRST,
  TS_LAST,
  TS_ALL
}
 classification of the target of an address (a.k.a. target specifier) More...
enum  ECustomValue {
  CV_INVALID,
  CV_FNC,
  CV_INT_RANGE,
  CV_REAL,
  CV_STRING
}
 enumeration of custom values, such as integer literals, or code pointers More...
enum  EObjKind {
  OK_REGION = 0,
  OK_SLS,
  OK_DLS,
  OK_OBJ_OR_NULL,
  OK_SEE_THROUGH,
  OK_SEE_THROUGH_2N
}
 enumeration of abstract object (although OK_REGION is not abstract) More...

Functions

bool isUninitialized (EValueOrigin)
 true for VO_HEAP and VO_STACK
bool isAnyDataArea (EValueTarget)
 TODO: drop this!
bool isOnHeap (EStorageClass)
 true for SC_ON_HEAP
bool isProgramVar (EStorageClass)
 true for SC_STATIC and SC_ON_STACK
bool operator== (const CustomValue &a, const CustomValue &b)
bool operator!= (const CustomValue &a, const CustomValue &b)
bool operator== (const CVar &a, const CVar &b)
bool operator!= (const CVar &a, const CVar &b)
bool operator== (const CallInst &a, const CallInst &b)
bool operator!= (const CallInst &a, const CallInst &b)
bool operator< (const CallInst &a, const CallInst &b)
 lexicographical comparison of CallInst objects
bool operator< (const CVar &a, const CVar &b)
 lexicographical comparison of CVar objects
bool operator< (const FldHandle &a, const FldHandle &b)
 this allows to insert FldHandle instances into std::set
bool operator== (const FldHandle &a, const FldHandle &b)
bool operator!= (const FldHandle &a, const FldHandle &b)
bool isMayExistObj (const enum EObjKind kind)
bool operator== (const BindingOff &off1, const BindingOff &off2)
 point-wise comparison of BindingOff
bool operator!= (const BindingOff &off1, const BindingOff &off2)
 point-wise comparison of BindingOff
bool operator< (const BindingOff &off1, const BindingOff &off2)
 lexicographical comparison of BindingOff, need for std::map
void enableProtectedMode (bool enable)
 enable/disable built-in self-checks (takes effect only in debug build)

Detailed Description

SymHeap - the elementary representation of the state of program memory.

Definition in file symheap.hh.

Typedef Documentation

typedef std::vector<CVar> TCVarList

a list of program variables

Definition at line 325 of file symheap.hh.

typedef std::set<CVar> TCVarSet

a set of program variables

Definition at line 328 of file symheap.hh.

typedef std::set<FldHandle> TFldSet

set of object handles

Definition at line 753 of file symheap.hh.

typedef short TMinLen

a type used for minimal segment length (0+, 1+, ...)

Definition at line 756 of file symheap.hh.

typedef enum cl_type_e TObjCode

a class of type (structure, pointer, union, ...)

Definition at line 228 of file symheap.hh.

typedef std::vector<TObjId> TObjList

container used to store object IDs to

Definition at line 210 of file symheap.hh.

typedef std::map<TObjId, TObjId> TObjMap

a type used for (injective) object IDs mapping

Definition at line 222 of file symheap.hh.

typedef std::set<TObjId> TObjSet

container used to store object IDs to

Definition at line 216 of file symheap.hh.

typedef struct cl_type* TObjType

a type used for type-info

Definition at line 225 of file symheap.hh.

typedef std::vector<TOffset> TOffList

a container to store offsets to

Definition at line 204 of file symheap.hh.

typedef IR::TInt TOffset

a type used for integral offsets (changing this is known to cause problems)

Definition at line 195 of file symheap.hh.

typedef short TProtoLevel

a type used for prototype level (0 means not a prototype)

Definition at line 234 of file symheap.hh.

typedef IR::TInt TSizeOf

a type used for block sizes (do not set this to anything else than TOffset)

Definition at line 198 of file symheap.hh.

a type used for block size ranges (do not try to change this one either)

Definition at line 201 of file symheap.hh.

a reference to CodeStorage::Storage instance describing the analyzed code

Definition at line 231 of file symheap.hh.

typedef std::map<TOffset, UniformBlock> TUniBlockMap

a container used to return list of uniform blocks

Definition at line 338 of file symheap.hh.

typedef std::vector<TValId> TValList

container used to store value IDs to

Definition at line 207 of file symheap.hh.

typedef std::map<TValId, TValId> TValMap

a type used for (injective) value IDs mapping

Definition at line 219 of file symheap.hh.

typedef std::set<TValId> TValSet

container used to store value IDs to

Definition at line 213 of file symheap.hh.

Enumeration Type Documentation

enumeration of custom values, such as integer literals, or code pointers

Enumerator:
CV_INVALID 

reserved for signalling error states

CV_FNC 

code pointer

CV_INT_RANGE 

a closed interval over integral domain

CV_REAL 

floating-point number

CV_STRING 

string literal

Definition at line 98 of file symheap.hh.

enum EObjKind

enumeration of abstract object (although OK_REGION is not abstract)

Enumerator:
OK_REGION 

concrete object (not a segment)

OK_SLS 

singly-linked list segment

OK_DLS 

doubly-linked list segment

OK_OBJ_OR_NULL 

0..1 object, assume NULL if not allocated

OK_SEE_THROUGH 

0..1 object, see through if not allocated

OK_SEE_THROUGH_2N 

OK_SEE_THROUGH with two next pointers.

Definition at line 759 of file symheap.hh.

classification of the storage class for objects

Enumerator:
SC_INVALID 

reserved for signalling error states

SC_UNKNOWN 

no assumptions, the object may be even shared

SC_STATIC 

safely allocated in static data if not a 0+ obj

SC_ON_HEAP 

safely allocated on heap except for 0+ objects

SC_ON_STACK 

safely allocated on stack except for 0+ objects

Definition at line 74 of file symheap.hh.

classification of the target of an address (a.k.a. target specifier)

Enumerator:
TS_INVALID 

reserved for signalling error states

TS_REGION 

the only allowed TS for addresses of regions

TS_FIRST 

target is the first node of an abstract object

TS_LAST 

target is the last node of an abstract object

TS_ALL 

target is any node of an abstract object

Definition at line 89 of file symheap.hh.

classification of kind of origins a value may come from

Enumerator:
VO_INVALID 

reserved for signalling error states

VO_ASSIGNED 

known result of an operation

VO_UNKNOWN 

value was abstracted out and guessed later on

VO_REINTERPRET 

a result of unsupported data reinterpretation

VO_DEREF_FAILED 

a result of invalid dereference

VO_STACK 

untouched contents of stack

VO_HEAP 

untouched contents of heap

Definition at line 45 of file symheap.hh.

classification of kind of objects a value may point to

Enumerator:
VT_INVALID 

completely invalid target

VT_UNKNOWN 

arbitrary target

VT_COMPOSITE 

value of a composite field (not a pointer to!)

VT_CUSTOM 

non-pointer data, classified by ECustomValue

VT_OBJECT 

target is a (possibly invalid) object

VT_RANGE 

an offset value where offset is given by range

Definition at line 59 of file symheap.hh.

Function Documentation

void enableProtectedMode ( bool  enable)

enable/disable built-in self-checks (takes effect only in debug build)

Referenced by ProtectionIntrusion::ProtectionIntrusion(), and ProtectionIntrusion::~ProtectionIntrusion().

bool isAnyDataArea ( EValueTarget  )

TODO: drop this!

bool isMayExistObj ( const enum EObjKind  kind)
inline

Definition at line 768 of file symheap.hh.

References OK_OBJ_OR_NULL, OK_SEE_THROUGH, and OK_SEE_THROUGH_2N.

bool isOnHeap ( EStorageClass  )

true for SC_ON_HEAP

bool isProgramVar ( EStorageClass  )

true for SC_STATIC and SC_ON_STACK

Referenced by gatherProgramVarsCore(), and traverseProgramVarsGeneric().

bool isUninitialized ( EValueOrigin  )

true for VO_HEAP and VO_STACK

bool operator!= ( const CustomValue a,
const CustomValue b 
)
inline

Definition at line 181 of file symheap.hh.

References operator==().

bool operator!= ( const CVar a,
const CVar b 
)
inline

Definition at line 275 of file symheap.hh.

References operator==().

bool operator!= ( const CallInst a,
const CallInst b 
)
inline

Definition at line 306 of file symheap.hh.

References operator==().

bool operator!= ( const FldHandle a,
const FldHandle b 
)
inline

Definition at line 734 of file symheap.hh.

References operator==().

bool operator!= ( const BindingOff off1,
const BindingOff off2 
)
inline

point-wise comparison of BindingOff

Definition at line 813 of file symheap.hh.

References operator==().

bool operator< ( const CallInst a,
const CallInst b 
)
inline

lexicographical comparison of CallInst objects

Note
we need it in order to place the objects into ordered containers

Definition at line 315 of file symheap.hh.

References CallInst::inst, and RETURN_IF_COMPARED.

bool operator< ( const CVar a,
const CVar b 
)
inline

lexicographical comparison of CVar objects

Note
we need it in order to place the objects into ordered containers

Definition at line 344 of file symheap.hh.

References CVar::inst, and RETURN_IF_COMPARED.

bool operator< ( const FldHandle a,
const FldHandle b 
)
inline

this allows to insert FldHandle instances into std::set

Definition at line 719 of file symheap.hh.

References FldHandle::fieldId(), RETURN_IF_COMPARED, and SymProc::sh().

bool operator< ( const BindingOff off1,
const BindingOff off2 
)
inline

lexicographical comparison of BindingOff, need for std::map

Definition at line 819 of file symheap.hh.

References BindingOff::head, and RETURN_IF_COMPARED.

bool operator== ( const CustomValue a,
const CustomValue b 
)
bool operator== ( const CVar a,
const CVar b 
)
inline

Definition at line 263 of file symheap.hh.

References CVar::inst, and CVar::uid.

bool operator== ( const CallInst a,
const CallInst b 
)
inline

Definition at line 300 of file symheap.hh.

References CallInst::inst, and CallInst::uid.

bool operator== ( const FldHandle a,
const FldHandle b 
)
inline

Definition at line 728 of file symheap.hh.

References FldHandle::fieldId(), and FldHandle::sh().

bool operator== ( const BindingOff off1,
const BindingOff off2 
)
inline

point-wise comparison of BindingOff

Definition at line 805 of file symheap.hh.

References BindingOff::head, BindingOff::next, and BindingOff::prev.