decompiler  1.0.0
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Private Attributes | List of all members
ArchitectureCapability Class Referenceabstract

Abstract extension point for building Architecture objects. More...

#include <architecture.hh>

Inheritance diagram for ArchitectureCapability:
CapabilityPoint BfdArchitectureCapability RawBinaryArchitectureCapability XmlArchitectureCapability

Public Member Functions

const string & getName (void) const
 Get the capability identifier.
 
virtual void initialize (void)
 Do specialized initialization. More...
 
virtual ArchitecturebuildArchitecture (const string &filename, const string &target, ostream *estream)=0
 Build an Architecture given a raw file or data. More...
 
virtual bool isFileMatch (const string &filename) const =0
 Determine if this extension can handle this file. More...
 
virtual bool isXmlMatch (Document *doc) const =0
 Determine is this extension can handle this XML document. More...
 
- Public Member Functions inherited from CapabilityPoint
virtual ~CapabilityPoint (void)
 Destructor.
 

Static Public Member Functions

static ArchitectureCapabilityfindCapability (const string &filename)
 Find an extension to process a file. More...
 
static ArchitectureCapabilityfindCapability (Document *doc)
 Find an extension to process an XML document. More...
 
static void sortCapabilities (void)
 Sort extensions. More...
 
static uint4 getMajorVersion (void)
 Get major decompiler version.
 
static uint4 getMinorVersion (void)
 Get minor decompiler version.
 
- Static Public Member Functions inherited from CapabilityPoint
static void initializeAll (void)
 Finish initialization for all extension points. More...
 

Protected Attributes

string name
 Identifier for this capability.
 

Static Private Attributes

static const uint4 majorversion = 4
 Current major version of decompiler.
 
static const uint4 minorversion = 0
 Current minor version of decompiler.
 
static vector< ArchitectureCapability * > thelist
 The list of registered extensions.
 

Additional Inherited Members

- Protected Member Functions inherited from CapabilityPoint
 CapabilityPoint (void)
 Construct extension capability exactly once. More...
 

Detailed Description

Abstract extension point for building Architecture objects.

Decompilation hinges on initially recognizing the format of code then bootstrapping into discovering the processor etc. This is the base class for the different extensions that perform this process. Each extension implements the buildArchitecture() method as the formal entry point for the bootstrapping process.

Member Function Documentation

virtual Architecture* ArchitectureCapability::buildArchitecture ( const string &  filename,
const string &  target,
ostream *  estream 
)
pure virtual

Build an Architecture given a raw file or data.

This is implemented by each separate extension. The method is handed a filename and possibly external target information and must build the Architecture object, initializing all the major subcomponents, using just this info.

Parameters
filenameis the path to the executable file to examine
targetif non-empty is a language id string
estreamis an output stream for error messages

Implemented in BfdArchitectureCapability, RawBinaryArchitectureCapability, and XmlArchitectureCapability.

ArchitectureCapability * ArchitectureCapability::findCapability ( const string &  filename)
static

Find an extension to process a file.

Given a specific file, find an ArchitectureCapability that can handle it.

Parameters
filenameis the path to the file
Returns
an ArchitectureCapability that can handle it or NULL

References isFileMatch(), and thelist.

ArchitectureCapability * ArchitectureCapability::findCapability ( Document doc)
static

Find an extension to process an XML document.

Given a parsed XML document, find an ArchitectureCapability that can handle it.

Parameters
docis the parsed XML document
Returns
an ArchitectureCapability that can handle it or NULL

References isXmlMatch(), and thelist.

void ArchitectureCapability::initialize ( void  )
virtual

Do specialized initialization.

This builds a list of just the ArchitectureCapability extensions.

Implements CapabilityPoint.

References thelist.

virtual bool ArchitectureCapability::isFileMatch ( const string &  filename) const
pure virtual

Determine if this extension can handle this file.

Parameters
filenameis the name of the file to examine
Returns
true is this extension is suitable for analyzing the file

Implemented in BfdArchitectureCapability, RawBinaryArchitectureCapability, and XmlArchitectureCapability.

Referenced by findCapability().

virtual bool ArchitectureCapability::isXmlMatch ( Document doc) const
pure virtual

Determine is this extension can handle this XML document.

If a file to analyze is XML based, this method examines the XML parse to determine if this extension can understand the document

Parameters
docis the parsed XML document
Returns
true if this extension understands the XML

Implemented in BfdArchitectureCapability, RawBinaryArchitectureCapability, and XmlArchitectureCapability.

Referenced by findCapability().

void ArchitectureCapability::sortCapabilities ( void  )
static

Sort extensions.

Modify order that extensions are searched, to effect which gets a chance to run first. Right now all we need to do is make sure the raw architecture comes last

References getName(), and thelist.


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