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

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

#include <architecture.hh>

Inheritance diagram for ghidra::ArchitectureCapability:
ghidra::CapabilityPoint ghidra::BfdArchitectureCapability ghidra::RawBinaryArchitectureCapability ghidra::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 ghidra::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 ArchitectureCapabilitygetCapability (const string &name)
 Get a capability by name. 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 ghidra::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 = 5
 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 ghidra::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

◆ buildArchitecture()

virtual Architecture* ghidra::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 ghidra::BfdArchitectureCapability, ghidra::RawBinaryArchitectureCapability, and ghidra::XmlArchitectureCapability.

Referenced by ghidra::FunctionTestCollection::buildProgram().

◆ findCapability() [1/2]

ArchitectureCapability * ghidra::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.

◆ findCapability() [2/2]

ArchitectureCapability * ghidra::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.

◆ getCapability()

ArchitectureCapability * ghidra::ArchitectureCapability::getCapability ( const string &  name)
static

Get a capability by name.

Return the ArchitectureCapability object with the matching name

Parameters
nameis the name to match
Returns
the ArchitectureCapability or null if no match is found

References getName(), name, and thelist.

Referenced by ghidra::FunctionTestCollection::buildProgram().

◆ initialize()

void ghidra::ArchitectureCapability::initialize ( void  )
virtual

Do specialized initialization.

This builds a list of just the ArchitectureCapability extensions.

Implements ghidra::CapabilityPoint.

References thelist.

◆ isFileMatch()

virtual bool ghidra::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 ghidra::BfdArchitectureCapability, ghidra::RawBinaryArchitectureCapability, and ghidra::XmlArchitectureCapability.

Referenced by findCapability().

◆ isXmlMatch()

virtual bool ghidra::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 ghidra::BfdArchitectureCapability, ghidra::RawBinaryArchitectureCapability, and ghidra::XmlArchitectureCapability.

Referenced by findCapability().

◆ sortCapabilities()

void ghidra::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: