Dyninst::SymtabAPI::Region Class Reference

#include <Region.h>

Inheritance diagram for Dyninst::SymtabAPI::Region:
Dyninst::AnnotatableSparse

Public Types

enum  perm_t { RP_R, RP_RW, RP_RX, RP_RWX }
enum  RegionType {
  RT_TEXT, RT_DATA, RT_TEXTDATA, RT_SYMTAB,
  RT_STRTAB, RT_BSS, RT_SYMVERSIONS, RT_SYMVERDEF,
  RT_SYMVERNEEDED, RT_REL, RT_RELA, RT_PLTREL,
  RT_PLTRELA, RT_DYNAMIC, RT_HASH, RT_GNU_HASH,
  RT_OTHER, RT_INVALID = -1
}
typedef dyn_hash_map< void
*, void *, void_ptr_hasher
annos_by_type_t
typedef std::vector
< annos_by_type_t * > 
annos_t

Public Member Functions

SYMTAB_EXPORT Region ()
SYMTAB_EXPORT Region (const Region &reg)
SYMTAB_EXPORT Regionoperator= (const Region &reg)
SYMTAB_EXPORT std::ostream & operator<< (std::ostream &os)
SYMTAB_EXPORT bool operator== (const Region &reg)
SYMTAB_EXPORT ~Region ()
SYMTAB_EXPORT unsigned getRegionNumber () const
SYMTAB_EXPORT bool setRegionNumber (unsigned regnumber)
SYMTAB_EXPORT std::string getRegionName () const
SYMTAB_EXPORT Offset getDiskOffset () const
SYMTAB_EXPORT unsigned long getDiskSize () const
SYMTAB_EXPORT unsigned long getFileOffset ()
SYMTAB_EXPORT Offset getMemOffset () const
SYMTAB_EXPORT unsigned long getMemSize () const
SYMTAB_EXPORT unsigned long getMemAlignment () const
SYMTAB_EXPORT void setMemOffset (Offset)
SYMTAB_EXPORT void setMemSize (unsigned long)
SYMTAB_EXPORT void setDiskSize (unsigned long)
SYMTAB_EXPORT void setFileOffset (Offset)
SYMTAB_EXPORT void * getPtrToRawData () const
SYMTAB_EXPORT bool setPtrToRawData (void *, unsigned long)
SYMTAB_EXPORT bool isBSS () const
SYMTAB_EXPORT bool isText () const
SYMTAB_EXPORT bool isData () const
SYMTAB_EXPORT bool isTLS () const
SYMTAB_EXPORT bool isOffsetInRegion (const Offset &offset) const
SYMTAB_EXPORT bool isLoadable () const
SYMTAB_EXPORT bool setLoadable (bool isLoadable)
SYMTAB_EXPORT bool isDirty () const
SYMTAB_EXPORT std::vector
< relocationEntry > & 
getRelocations ()
SYMTAB_EXPORT bool patchData (Offset off, void *buf, unsigned size)
SYMTAB_EXPORT bool isStandardCode ()
SYMTAB_EXPORT perm_t getRegionPermissions () const
SYMTAB_EXPORT bool setRegionPermissions (perm_t newPerms)
SYMTAB_EXPORT RegionType getRegionType () const
SYMTAB_EXPORT bool addRelocationEntry (Offset relocationAddr, Symbol *dynref, unsigned long relType, Region::RegionType rtype=Region::RT_REL)
SYMTAB_EXPORT bool addRelocationEntry (const relocationEntry &rel)
SYMTAB_EXPORT bool updateRelocations (Address start, Address end, Symbol *oldsym, Symbol *newsym)
SYMTAB_EXPORT Serializableserialize_impl (SerializerBase *sb, const char *tag="Region") THROW_SPEC(SerializerError)
SYMTAB_EXPORT Symtabsymtab () const
template<class T >
AN_INLINE bool addAnnotation (const T *a, AnnotationClass< T > &a_id)
bool operator== (AnnotatableSparse &cmp)
template<class T >
AN_INLINE bool getAnnotation (T *&a, AnnotationClass< T > &a_id) const
template<class T >
bool removeAnnotation (AnnotationClass< T > &a_id)
void serializeAnnotations (SerializerBase *sb, const char *)
void annotationsReport ()

Static Public Member Functions

static const char * permissions2Str (perm_t)
static const char * regionType2Str (RegionType)
static SYMTAB_EXPORT RegioncreateRegion (Offset diskOff, perm_t perms, RegionType regType, unsigned long diskSize=0, Offset memOff=0, unsigned long memSize=0, std::string name="", char *rawDataPtr=NULL, bool isLoadable=false, bool isTLS=false, unsigned long memAlign=sizeof(unsigned))

Protected Member Functions

SYMTAB_EXPORT Region (unsigned regnum, std::string name, Offset diskOff, unsigned long diskSize, Offset memOff, unsigned long memSize, char *rawDataPtr, perm_t perms, RegionType regType, bool isLoadable=false, bool isTLS=false, unsigned long memAlign=sizeof(unsigned))
void setSymtab (Symtab *sym)

Private Attributes

unsigned regNum_
std::string name_
Offset diskOff_
unsigned long diskSize_
Offset memOff_
unsigned long memSize_
Offset fileOff_
void * rawDataPtr_
perm_t permissions_
RegionType rType_
bool isDirty_
std::vector< relocationEntryrels_
char * buffer_
bool isLoadable_
bool isTLS_
unsigned long memAlign_
Symtabsymtab_

Friends

class Object
class Symtab
class SymtabTranslatorBase
class SymtabTranslatorBin

Detailed Description

Definition at line 45 of file Region.h.


Member Typedef Documentation

typedef dyn_hash_map<void *, void *, void_ptr_hasher> Dyninst::AnnotatableSparse::annos_by_type_t [inherited]

Definition at line 505 of file Annotatable.h.

typedef std::vector<annos_by_type_t *> Dyninst::AnnotatableSparse::annos_t [inherited]

Definition at line 508 of file Annotatable.h.


Member Enumeration Documentation

Enumerator:
RP_R 
RP_RW 
RP_RX 
RP_RWX 

Definition at line 53 of file Region.h.

Enumerator:
RT_TEXT 
RT_DATA 
RT_TEXTDATA 
RT_SYMTAB 
RT_STRTAB 
RT_BSS 
RT_SYMVERSIONS 
RT_SYMVERDEF 
RT_SYMVERNEEDED 
RT_REL 
RT_RELA 
RT_PLTREL 
RT_PLTRELA 
RT_DYNAMIC 
RT_HASH 
RT_GNU_HASH 
RT_OTHER 
RT_INVALID 

Definition at line 63 of file Region.h.


Constructor & Destructor Documentation

Region::Region (  ) 

Definition at line 54 of file Region.C.

Referenced by createRegion().

Region::Region ( const Region reg  ) 

Definition at line 71 of file Region.C.

Region::~Region (  ) 

Definition at line 144 of file Region.C.

References buffer_.

Region::Region ( unsigned  regnum,
std::string  name,
Offset  diskOff,
unsigned long  diskSize,
Offset  memOff,
unsigned long  memSize,
char *  rawDataPtr,
perm_t  perms,
RegionType  regType,
bool  isLoadable = false,
bool  isTLS = false,
unsigned long  memAlign = sizeof(unsigned) 
) [protected]

Definition at line 58 of file Region.C.

References isLoadable_.


Member Function Documentation

template<class T >
AN_INLINE bool Dyninst::AnnotatableSparse::addAnnotation ( const T *  a,
AnnotationClass< T > &  a_id 
) [inline, inherited]
bool Region::addRelocationEntry ( const relocationEntry rel  ) 

Definition at line 366 of file Region.C.

References rels_.

bool Region::addRelocationEntry ( Offset  relocationAddr,
Symbol dynref,
unsigned long  relType,
Region::RegionType  rtype = Region::RT_REL 
)
void Dyninst::AnnotatableSparse::annotationsReport (  )  [inline, inherited]
Region * Region::createRegion ( Offset  diskOff,
perm_t  perms,
RegionType  regType,
unsigned long  diskSize = 0,
Offset  memOff = 0,
unsigned long  memSize = 0,
std::string  name = "",
char *  rawDataPtr = NULL,
bool  isLoadable = false,
bool  isTLS = false,
unsigned long  memAlign = sizeof(unsigned) 
) [static]

Definition at line 41 of file Region.C.

References Region().

Referenced by Dyninst::SymtabAPI::emitElfStatic::createLinkMap().

template<class T >
AN_INLINE bool Dyninst::AnnotatableSparse::getAnnotation ( T *&  a,
AnnotationClass< T > &  a_id 
) const [inline, inherited]
Offset Region::getDiskOffset (  )  const
unsigned long Region::getDiskSize (  )  const
unsigned long Region::getFileOffset (  ) 

Definition at line 249 of file Region.C.

References fileOff_.

unsigned long Region::getMemAlignment (  )  const
Offset Region::getMemOffset (  )  const
unsigned long Region::getMemSize (  )  const
void * Region::getPtrToRawData (  )  const
std::string Region::getRegionName (  )  const
unsigned Region::getRegionNumber (  )  const
Region::perm_t Region::getRegionPermissions (  )  const

Definition at line 371 of file Region.C.

References permissions_.

Referenced by isStandardCode(), and Dyninst::SymtabAPI::Symtab::rebuild_region_indexes().

Region::RegionType Region::getRegionType (  )  const
std::vector< relocationEntry > & Region::getRelocations (  ) 
bool Region::isBSS (  )  const

Definition at line 302 of file Region.C.

References RT_BSS, and rType_.

Referenced by Dyninst::SymtabAPI::emitElfStatic::copyRegions().

bool Region::isData (  )  const

Definition at line 312 of file Region.C.

References RT_DATA, and rType_.

bool Region::isDirty (  )  const

Definition at line 334 of file Region.C.

References isDirty_.

bool Region::isLoadable (  )  const

Definition at line 327 of file Region.C.

References isLoadable_, and memOff_.

Referenced by Dyninst::SymtabAPI::Symtab::rebuild_region_indexes().

bool Region::isOffsetInRegion ( const Offset offset  )  const

Definition at line 322 of file Region.C.

References diskOff_, and diskSize_.

Referenced by Dyninst::SymtabAPI::Object::handle_opd_symbol().

bool Region::isStandardCode (  ) 

Definition at line 5497 of file Object-elf.C.

References getRegionPermissions(), name_, RP_RWX, and RP_RX.

bool Region::isText (  )  const

Definition at line 307 of file Region.C.

References RT_TEXT, and rType_.

bool Region::isTLS (  )  const

Definition at line 317 of file Region.C.

References isTLS_.

SYMTAB_EXPORT std::ostream& Dyninst::SymtabAPI::Region::operator<< ( std::ostream &  os  ) 
Region & Region::operator= ( const Region reg  ) 
bool Dyninst::AnnotatableSparse::operator== ( AnnotatableSparse cmp  )  [inline, inherited]
bool Region::operator== ( const Region reg  ) 
bool Region::patchData ( Offset  off,
void *  buf,
unsigned  size 
)
const char * Region::permissions2Str ( perm_t  p  )  [static]

Definition at line 150 of file Region.C.

References CASE_RETURN_STR, RP_R, RP_RW, RP_RWX, and RP_RX.

const char * Region::regionType2Str ( RegionType  rt  )  [static]
template<class T >
bool Dyninst::AnnotatableSparse::removeAnnotation ( AnnotationClass< T > &  a_id  )  [inline, inherited]
Serializable * Region::serialize_impl ( SerializerBase sb,
const char *  tag = "Region" 
)

Definition at line 217 of file Region.C.

void Dyninst::AnnotatableSparse::serializeAnnotations ( SerializerBase sb,
const char *   
) [inline, inherited]
void Region::setDiskSize ( unsigned long  newsize  ) 

Definition at line 284 of file Region.C.

References diskSize_.

void Region::setFileOffset ( Offset  newoff  ) 
SYMTAB_EXPORT bool Dyninst::SymtabAPI::Region::setLoadable ( bool  isLoadable  ) 
void Region::setMemOffset ( Offset  newoff  ) 

Definition at line 269 of file Region.C.

References memOff_.

Referenced by Dyninst::SymtabAPI::Symtab::fixup_RegionAddr().

void Region::setMemSize ( unsigned long  newsize  ) 

Definition at line 279 of file Region.C.

References memSize_.

Referenced by Dyninst::SymtabAPI::Symtab::fixup_RegionAddr().

bool Region::setPtrToRawData ( void *  buf,
unsigned long  newsize 
)
bool Region::setRegionNumber ( unsigned  regnumber  ) 

Definition at line 228 of file Region.C.

References regNum_.

bool Region::setRegionPermissions ( Region::perm_t  newPerms  ) 

Definition at line 377 of file Region.C.

References permissions_.

void Dyninst::SymtabAPI::Region::setSymtab ( Symtab sym  )  [inline, protected]

Definition at line 148 of file Region.h.

References symtab_.

Referenced by Dyninst::SymtabAPI::Symtab::addRegion().

SYMTAB_EXPORT Symtab* Dyninst::SymtabAPI::Region::symtab (  )  const [inline]

Definition at line 142 of file Region.h.

References symtab_.

Referenced by Dyninst::SymtabAPI::emitElfStatic::calculateTOCs().

bool Region::updateRelocations ( Address  start,
Address  end,
Symbol oldsym,
Symbol newsym 
)

Friends And Related Function Documentation

friend class Object [friend]

Definition at line 46 of file Region.h.

friend class Symtab [friend]

Definition at line 47 of file Region.h.

friend class SymtabTranslatorBase [friend]

Definition at line 48 of file Region.h.

friend class SymtabTranslatorBin [friend]

Definition at line 49 of file Region.h.


Field Documentation

Definition at line 162 of file Region.h.

Referenced by operator=(), patchData(), and ~Region().

Definition at line 152 of file Region.h.

Referenced by getDiskOffset(), isOffsetInRegion(), operator=(), and operator==().

unsigned long Dyninst::SymtabAPI::Region::diskSize_ [private]

Definition at line 156 of file Region.h.

Referenced by getFileOffset(), and setFileOffset().

Definition at line 160 of file Region.h.

Referenced by isDirty(), operator=(), operator==(), and setPtrToRawData().

Definition at line 163 of file Region.h.

Referenced by isLoadable(), operator=(), operator==(), and Region().

Definition at line 164 of file Region.h.

Referenced by isTLS(), operator=(), and operator==().

unsigned long Dyninst::SymtabAPI::Region::memAlign_ [private]

Definition at line 165 of file Region.h.

Referenced by getMemAlignment(), operator=(), and operator==().

Definition at line 154 of file Region.h.

Referenced by getMemOffset(), isLoadable(), operator=(), operator==(), and setMemOffset().

unsigned long Dyninst::SymtabAPI::Region::memSize_ [private]

Definition at line 155 of file Region.h.

Referenced by getMemSize(), operator=(), operator==(), and setMemSize().

std::string Dyninst::SymtabAPI::Region::name_ [private]

Definition at line 151 of file Region.h.

Referenced by getRegionName(), isStandardCode(), operator=(), and operator==().

Definition at line 158 of file Region.h.

Referenced by getRegionPermissions(), operator=(), operator==(), and setRegionPermissions().

Definition at line 157 of file Region.h.

Referenced by getPtrToRawData(), operator=(), patchData(), and setPtrToRawData().

Definition at line 150 of file Region.h.

Referenced by getRegionNumber(), operator=(), operator==(), and setRegionNumber().

Definition at line 159 of file Region.h.

Referenced by getRegionType(), isBSS(), isData(), isText(), operator=(), and operator==().

Definition at line 166 of file Region.h.

Referenced by setSymtab(), and symtab().


The documentation for this class was generated from the following files:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1