ROSE  0.9.11.30
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::BinaryLoaderPe Class Reference

Description

Loader for Windows PE files.

Definition at line 13 of file BinaryLoaderPe.h.

#include <BinaryLoaderPe.h>

Inheritance diagram for Rose::BinaryAnalysis::BinaryLoaderPe:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::BinaryLoaderPe:
Collaboration graph
[legend]

Public Types

typedef Sawyer::SharedPointer< BinaryLoaderPePtr
 Reference counting pointer to BinaryLoaderPe. More...
 
- Public Types inherited from Rose::BinaryAnalysis::BinaryLoader
enum  MappingContribution {
  CONTRIBUTE_NONE,
  CONTRIBUTE_ADD,
  CONTRIBUTE_SUB
}
 Describes how a section contributes to the overall memory map. More...
 
enum  ConflictResolution {
  RESOLVE_THROW,
  RESOLVE_OVERMAP,
  RESOLVE_REMAP,
  RESOLVE_REMAP_ABOVE
}
 Describes how conflicts are resolved when mapping a section. More...
 
typedef Sawyer::SharedPointer< BinaryLoaderPtr
 Referenc counting pointer to BinaryLoader. More...
 
typedef std::vector< ExceptionFixupErrors
 

Public Member Functions

virtual BinaryLoaderPtr clone () const
 Creates a new copy of a loader. More...
 
virtual bool canLoad (SgAsmGenericHeader *) const ROSE_OVERRIDE
 Predicate determining the suitability of a loader for a specific file header. More...
 
virtual SgAsmGenericSectionPtrList getRemapSections (SgAsmGenericHeader *) ROSE_OVERRIDE
 Selects those sections of a header that should be mapped. More...
 
virtual MappingContribution alignValues (SgAsmGenericSection *, const MemoryMap::Ptr &, rose_addr_t *malign_lo, rose_addr_t *malign_hi, rose_addr_t *va, rose_addr_t *mem_size, rose_addr_t *offset, rose_addr_t *file_size, bool *map_private, rose_addr_t *va_offset, bool *anon_lo, bool *anon_hi, ConflictResolution *resolve) ROSE_OVERRIDE
 Windows-specific PE section alignment. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::BinaryLoader
void appendDirectories (const std::vector< std::string > &dirnames)
 Appends directories to the list of directories searched for libraries. More...
 
virtual std::string findSoFile (const std::string &libname) const
 Convert name to fully qualified name. More...
 
virtual void load (SgAsmInterpretation *)
 Top-level method to do everything. More...
 
virtual void link (SgAsmInterpretation *interp)
 Finds and parses all shared objects needed by an interpretation. More...
 
virtual void remap (SgAsmInterpretation *interp)
 Maps sections of the interpretation into the virtual address space. More...
 
virtual void fixup (SgAsmInterpretation *interp, FixupErrors *errors=NULL)
 Performs relocation fixups on the specified interpretation. More...
 
virtual std::vector< std::string > dependencies (SgAsmGenericHeader *)
 Finds shared object dependencies of a single binary header. More...
 
virtual void remap (Rose::BinaryAnalysis::MemoryMap::Ptr &, SgAsmGenericHeader *)
 Remaps the sections for a particular header. More...
 
virtual rose_addr_t rebase (const MemoryMap::Ptr &, SgAsmGenericHeader *header, const SgAsmGenericSectionPtrList &)
 Returns an alternate base virtual address if necessary for remapping. More...
 
rose_addr_t bialign (rose_addr_t val1, rose_addr_t align1, rose_addr_t val2, rose_addr_t align2)
 Calculate adjustment to cause two values to be aligned to two different alignments. More...
 
virtual void addSectionsForRemap (SgAsmGenericHeader *header, SgAsmGenericSectionPtrList &allSections)
 Selects loadable sections. More...
 
virtual unsigned mappingPermissions (SgAsmGenericSection *) const
 MemoryMap permissions. More...
 
void set_perform_dynamic_linking (bool b) ROSE_DEPRECATED("use performingDynamicLinking")
 
bool get_perform_dynamic_linking () const ROSE_DEPRECATED("use performingDynamicLinking")
 
void set_perform_remap (bool b) ROSE_DEPRECATED("use performingRemap")
 
bool get_perform_remap () const ROSE_DEPRECATED("use performingRemap")
 
void set_perform_relocations (bool b) ROSE_DEPRECATED("use performingRelocations")
 
bool get_perform_relocations () const ROSE_DEPRECATED("use performingRelocations")
 
void add_preload (const std::string &libname) ROSE_DEPRECATED("use preloads")
 
const std::vector< std::string > & get_preloads () const ROSE_DEPRECATED("use preloads")
 
void add_directory (const std::string &dirname) ROSE_DEPRECATED("use directories")
 
void add_directories (const std::vector< std::string > &dirnames) ROSE_DEPRECATED("use appendDirectories")
 
const std::vector< std::string > & get_directories () const ROSE_DEPRECATED("use directories")
 
bool performingDynamicLinking () const
 Property: Whether this loader will perform the linking step. More...
 
void performingDynamicLinking (bool b)
 Property: Whether this loader will perform the linking step. More...
 
bool performingRemap () const
 Property: Whether this loader will perform the mapping step. More...
 
void performingRemap (bool b)
 Property: Whether this loader will perform the mapping step. More...
 
bool performingRelocations () const
 Property: Whether this loader will perform the relocation step. More...
 
void performingRelocations (bool b)
 Property: Whether this loader will perform the relocation step. More...
 
const std::vector< std::string > & preloads () const
 Property: List of libraries that will be pre-loaded. More...
 
std::vector< std::string > & preloads ()
 Property: List of libraries that will be pre-loaded. More...
 
void preloads (const std::vector< std::string > &v)
 Property: List of libraries that will be pre-loaded. More...
 
const std::vector< std::string > & directories () const
 Property: List of directories searched for libraries. More...
 
std::vector< std::string > & directories ()
 Property: List of directories searched for libraries. More...
 
void directories (const std::vector< std::string > &v)
 Property: List of directories searched for libraries. More...
 
virtual bool isLinked (SgBinaryComposite *composite, const std::string &filename)
 Returns true if the specified file name is already linked into the AST.
 
virtual bool isLinked (SgAsmInterpretation *interp, const std::string &filename)
 Returns true if the specified file name is already linked into the AST.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Static Public Member Functions

static Ptr instance ()
 Allocating constructor. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::BinaryLoader
static Ptr instance ()
 Allocating constructor. More...
 
static void initDiagnostics ()
 Initialize diagnostic streams for binary loaders. More...
 
static void registerSubclass (const Ptr &)
 Register a loader instance. More...
 
static Ptr lookup (SgAsmGenericHeader *)
 Finds a suitable loader. More...
 
static Ptr lookup (SgAsmInterpretation *)
 Finds a suitable loader. More...
 
static void load (SgBinaryComposite *composite, bool read_executable_file_format_only=false)
 Top-level method to do everything. More...
 
static SgAsmGenericFilecreateAsmAST (SgBinaryComposite *composite, std::string filePath)
 Parses a single binary file. More...
 
static int64_t gcd (int64_t a, int64_t b, int64_t *x=NULL, int64_t *y=NULL)
 Extended Euclid Algorithm. More...
 
static SgAsmGenericHeaderPtrList findSimilarHeaders (SgAsmGenericHeader *matchHeader, SgAsmGenericHeaderPtrList &candidateHeaders)
 Find headers similar to given header. More...
 
static bool isHeaderSimilar (SgAsmGenericHeader *, SgAsmGenericHeader *)
 Determines whether two headers are similar. More...
 
static void register_subclass (const Ptr &loader) ROSE_DEPRECATED("use registerSubclass")
 

Protected Member Functions

 BinaryLoaderPe (const BinaryLoaderPe &other)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::BinaryLoader
 BinaryLoader (const BinaryLoader &other)
 Copy constructor. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Rose::BinaryAnalysis::BinaryLoader
static Sawyer::Message::Facility mlog
 Logging facility initialized by initDiagnostics(). More...
 

Member Typedef Documentation

Reference counting pointer to BinaryLoaderPe.

Definition at line 16 of file BinaryLoaderPe.h.

Member Function Documentation

static Ptr Rose::BinaryAnalysis::BinaryLoaderPe::instance ( )
inlinestatic

Allocating constructor.

Definition at line 27 of file BinaryLoaderPe.h.

virtual BinaryLoaderPtr Rose::BinaryAnalysis::BinaryLoaderPe::clone ( ) const
inlinevirtual

Creates a new copy of a loader.

The new copy has all the same settings as the original. Subclasses that define data methods should certainly provide an implementation of this method, although all they'll need to change is the data type for the 'new' operator.

Reimplemented from Rose::BinaryAnalysis::BinaryLoader.

Definition at line 31 of file BinaryLoaderPe.h.

virtual bool Rose::BinaryAnalysis::BinaryLoaderPe::canLoad ( SgAsmGenericHeader ) const
virtual

Predicate determining the suitability of a loader for a specific file header.

If this loader is capable of loading the specified file header, then this predicate returns true, otherwise it returns false. The implementation in BinaryLoader always returns true because BinaryLoader is able to generically load all types of files, albeit with limited functionality. Subclasses should certainly redefine this method so it returns true only for certain headers.

Reimplemented from Rose::BinaryAnalysis::BinaryLoader.

virtual SgAsmGenericSectionPtrList Rose::BinaryAnalysis::BinaryLoaderPe::getRemapSections ( SgAsmGenericHeader header)
virtual

Selects those sections of a header that should be mapped.

Returns the sections in the order they should be mapped.

Reimplemented from Rose::BinaryAnalysis::BinaryLoader.

virtual MappingContribution Rose::BinaryAnalysis::BinaryLoaderPe::alignValues ( SgAsmGenericSection ,
const MemoryMap::Ptr ,
rose_addr_t *  malign_lo,
rose_addr_t *  malign_hi,
rose_addr_t *  va,
rose_addr_t *  mem_size,
rose_addr_t *  offset,
rose_addr_t *  file_size,
bool *  map_private,
rose_addr_t *  va_offset,
bool *  anon_lo,
bool *  anon_hi,
ConflictResolution resolve 
)
virtual

Windows-specific PE section alignment.

Reimplemented from Rose::BinaryAnalysis::BinaryLoader.


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