Ghidra Decompiler Analysis Engine
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ArchitectureCapability Class Referenceabstract

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

#include <architecture.hh>

Inheritance diagram for ArchitectureCapability:
Inheritance graph
[legend]
Collaboration diagram for ArchitectureCapability:
Collaboration graph
[legend]

Public Member Functions

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...
 

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 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.
 

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

◆ buildArchitecture()

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.

◆ findCapability() [1/2]

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

◆ findCapability() [2/2]

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

◆ getCapability()

ArchitectureCapability * 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

◆ initialize()

void ArchitectureCapability::initialize ( void  )
virtual

Do specialized initialization.

This builds a list of just the ArchitectureCapability extensions.

Implements CapabilityPoint.

◆ isFileMatch()

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.

◆ isXmlMatch()

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.

◆ sortCapabilities()

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


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