ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinaryLoaderPe Class Reference

#include <BinaryLoaderPe.h>

Inheritance diagram for BinaryLoaderPe:
Collaboration diagram for BinaryLoaderPe:

Public Member Functions

 BinaryLoaderPe ()
 
 BinaryLoaderPe (const BinaryLoaderPe &other)
 
virtual ~BinaryLoaderPe ()
 
virtual BinaryLoaderPeclone () const
 Creates a new copy of a loader. More...
 
virtual bool can_load (SgAsmGenericHeader *) const
 Predicate determining the suitability of a loader for a specific file header. More...
 
virtual SgAsmGenericSectionPtrList get_remap_sections (SgAsmGenericHeader *)
 Returns sections in order of their definition in the PE Section Table. More...
 
virtual MappingContribution align_values (SgAsmGenericSection *, MemoryMap *, 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)
 Windows-specific PE section alignment. More...
 
- Public Member Functions inherited from BinaryLoader
 BinaryLoader ()
 
 BinaryLoader (const BinaryLoader &other)
 
virtual ~BinaryLoader ()
 
void set_perform_dynamic_linking (bool b)
 Set whether this loader will perform the linking step. More...
 
bool get_perform_dynamic_linking () const
 Returns whether this loader will perform the linking step. More...
 
void set_perform_remap (bool b)
 Set whether this loader will perform the mapping step. More...
 
bool get_perform_remap () const
 Returns whether this loader will perform the mapping step. More...
 
void set_perform_relocations (bool b)
 Set whether this loader will perform the relocation step. More...
 
bool get_perform_relocations () const
 Returns whether this loader will perform the relocation step. More...
 
void set_debug (FILE *f)
 Set whether this loader will emit diagnostics for debugging. More...
 
FILE * get_debug () const
 Returns whether this loader will emit diagnostics for debugging. More...
 
void add_preload (const std::string &libname)
 Adds a library to the list of pre-loaded libraries. More...
 
const std::vector< std::string > & get_preloads () const
 Returns the list of libraries that will be pre-loaded. More...
 
void add_directory (const std::string &dirname)
 Adds a directory to the list of directories searched for libraries. More...
 
void add_directories (const std::vector< std::string > &dirnames)
 Adds directories to the list of directories searched for libraries. More...
 
const std::vector< std::string > & get_directories () const
 Returns the list of shared object search directories. More...
 
virtual std::string find_so_file (const std::string &libname) const
 Given the name of a shared object, return the fully qualified name where the library is located in the file system. More...
 
virtual void load (SgAsmInterpretation *)
 Conditionally parse, map, link, and/or relocate the interpretation according to properties of this loader. More...
 
virtual void link (SgAsmInterpretation *interp)
 Links an interpretation by parsing all shared objects required by that 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 bool is_linked (SgBinaryComposite *composite, const std::string &filename)
 Returns true if the specified file name is already linked into the AST. More...
 
virtual bool is_linked (SgAsmInterpretation *interp, const std::string &filename)
 Returns true if the specified file name is already linked into the AST. More...
 
virtual std::vector< std::string > dependencies (SgAsmGenericHeader *)
 Finds shared object dependencies of a single binary header. More...
 
virtual void remap (MemoryMap *, SgAsmGenericHeader *)
 Remaps the sections for a particular header. More...
 
virtual rose_addr_t rebase (MemoryMap *, 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 those sections which should be layed out by the Loader and inserts them into the allSections argument. More...
 

Additional Inherited Members

- Public Types inherited from 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 std::vector< ExceptionFixupErrors
 
- Static Public Member Functions inherited from BinaryLoader
static void register_subclass (BinaryLoader *)
 Register a loader instance. More...
 
static BinaryLoaderlookup (SgAsmGenericHeader *)
 Finds a suitable loader. More...
 
static BinaryLoaderlookup (SgAsmInterpretation *)
 Finds a suitable loader. More...
 
static void load (SgBinaryComposite *composite, bool read_executable_file_format_only=false)
 Class method to parse, map, link, and/or relocate all interpretations of the specified binary composite. 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 all headers in candidateHeaders that are similar to matchHeader. More...
 
static bool isHeaderSimilar (SgAsmGenericHeader *, SgAsmGenericHeader *)
 Determines whether two headers are similar enough to be in the same interpretation. More...
 

Detailed Description

Definition at line 6 of file BinaryLoaderPe.h.

Constructor & Destructor Documentation

BinaryLoaderPe::BinaryLoaderPe ( )
inline

Definition at line 8 of file BinaryLoaderPe.h.

Referenced by clone().

BinaryLoaderPe::BinaryLoaderPe ( const BinaryLoaderPe other)
inline

Definition at line 10 of file BinaryLoaderPe.h.

virtual BinaryLoaderPe::~BinaryLoaderPe ( )
inlinevirtual

Definition at line 14 of file BinaryLoaderPe.h.

Member Function Documentation

virtual BinaryLoaderPe* 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 BinaryLoader.

Definition at line 18 of file BinaryLoaderPe.h.

References BinaryLoaderPe().

virtual bool BinaryLoaderPe::can_load ( 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 BinaryLoader.

virtual SgAsmGenericSectionPtrList BinaryLoaderPe::get_remap_sections ( SgAsmGenericHeader )
virtual

Returns sections in order of their definition in the PE Section Table.

Reimplemented from BinaryLoader.

virtual MappingContribution BinaryLoaderPe::align_values ( SgAsmGenericSection ,
MemoryMap ,
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 BinaryLoader.


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