ROSE 0.11.145.147
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::Unparser::Cil Class Reference

Description

Unparser for CIL.

Definition at line 20 of file Unparser/Cil.h.

#include <Rose/BinaryAnalysis/Unparser/Cil.h>

Inheritance diagram for Rose::BinaryAnalysis::Unparser::Cil:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Unparser::Cil:
Collaboration graph
[legend]

Public Member Functions

Ptr copy () const override
 
const CilSettingssettings () const override
 Property: Settings associated with this unparser.
 
CilSettingssettings () override
 Property: Settings associated with this unparser.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::Unparser::Base
Architecture::BaseConstPtr architecture () const
 Property: Architecture.
 
virtual void initializeState (State &) const
 Finish initializing the unparser state.
 
virtual void updateIntraFunctionArrows (State &) const
 Calculate intra-function arrows.
 
void settings (const Settings &s)
 Property: Settings associated with this unparser.
 
Ptr nextUnparser () const
 Property: Next parser in chain.
 
void nextUnparser (Ptr next)
 Property: Next parser in chain.
 
void operator() (std::ostream &, const Partitioner2::PartitionerConstPtr &) const
 Emit the entity to an output stream.
 
void operator() (std::ostream &, const Partitioner2::PartitionerConstPtr &, SgAsmInstruction *) const
 Emit the entity to an output stream.
 
void operator() (std::ostream &, const Partitioner2::PartitionerConstPtr &, const Partitioner2::BasicBlockPtr &) const
 Emit the entity to an output stream.
 
void operator() (std::ostream &, const Partitioner2::PartitionerConstPtr &, const Partitioner2::DataBlockPtr &) const
 Emit the entity to an output stream.
 
void operator() (std::ostream &, const Partitioner2::PartitionerConstPtr &, const Partitioner2::FunctionPtr &) const
 Emit the entity to an output stream.
 
void operator() (std::ostream &, SgAsmInstruction *) const
 Emit the entity to an output stream.
 
std::string operator() (const Partitioner2::PartitionerConstPtr &, const Progress::Ptr &=Progress::Ptr()) const
 Emit the entity to a string.
 
std::string operator() (const Partitioner2::PartitionerConstPtr &, SgAsmInstruction *) const
 Emit the entity to a string.
 
std::string operator() (const Partitioner2::PartitionerConstPtr &, const Partitioner2::BasicBlockPtr &) const
 Emit the entity to a string.
 
std::string operator() (const Partitioner2::PartitionerConstPtr &, const Partitioner2::DataBlockPtr &) const
 Emit the entity to a string.
 
std::string operator() (const Partitioner2::PartitionerConstPtr &, const Partitioner2::FunctionPtr &) const
 Emit the entity to a string.
 
std::string operator() (SgAsmInstruction *) const
 Emit the entity to a string.
 
void unparse (std::ostream &, const Partitioner2::PartitionerConstPtr &, const Progress::Ptr &=Progress::Ptr()) const
 High-level unparsing function.
 
void unparse (std::ostream &, const Partitioner2::PartitionerConstPtr &, SgAsmInstruction *) const
 High-level unparsing function.
 
void unparse (std::ostream &, const Partitioner2::PartitionerConstPtr &, const Partitioner2::BasicBlockPtr &) const
 High-level unparsing function.
 
void unparse (std::ostream &, const Partitioner2::PartitionerConstPtr &, const Partitioner2::DataBlockPtr &) const
 High-level unparsing function.
 
void unparse (std::ostream &, const Partitioner2::PartitionerConstPtr &, const Partitioner2::FunctionPtr &) const
 High-level unparsing function.
 
void unparse (std::ostream &, SgAsmInstruction *) const
 High-level unparsing function.
 
std::string unparse (const Partitioner2::PartitionerConstPtr &, const Progress::Ptr &=Progress::Ptr()) const
 High-level unparsing function.
 
std::string unparse (const Partitioner2::PartitionerConstPtr &, SgAsmInstruction *) const
 High-level unparsing function.
 
std::string unparse (const Partitioner2::PartitionerConstPtr &, const Partitioner2::BasicBlockPtr &) const
 High-level unparsing function.
 
std::string unparse (const Partitioner2::PartitionerConstPtr &, const Partitioner2::DataBlockPtr &) const
 High-level unparsing function.
 
std::string unparse (const Partitioner2::PartitionerConstPtr &, const Partitioner2::FunctionPtr &) const
 High-level unparsing function.
 
std::string unparse (SgAsmInstruction *) const
 High-level unparsing function.
 
virtual void emitFunction (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionPrologue (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionBody (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionEpilogue (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionSourceLocation (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionReasons (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionCallers (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionCallees (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionComment (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionStackDelta (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionCallingConvention (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionNoopAnalysis (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitFunctionMayReturn (std::ostream &, const Partitioner2::FunctionPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitDataBlockSourceLocation (std::ostream &, const Partitioner2::DataBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitDataBlock (std::ostream &, const Partitioner2::DataBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitDataBlockPrologue (std::ostream &, const Partitioner2::DataBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitDataBlockBody (std::ostream &, const Partitioner2::DataBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitDataBlockEpilogue (std::ostream &, const Partitioner2::DataBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlock (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockPrologue (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockBody (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockEpilogue (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockSourceLocation (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockComment (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockSharing (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockPredecessors (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockSuccessors (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitBasicBlockReachability (std::ostream &, const Partitioner2::BasicBlockPtr &, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionPrologue (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionBody (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionEpilogue (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionAddress (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionBytes (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionStackDelta (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionMnemonic (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionOperands (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionComment (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitInstructionSemantics (std::ostream &, SgAsmInstruction *, State &) const
 Mid-level unparser function.
 
virtual void emitOperand (std::ostream &, SgAsmExpression *, State &) const
 Mid-level unparser function.
 
virtual void emitOperandPrologue (std::ostream &, SgAsmExpression *, State &) const
 Mid-level unparser function.
 
virtual void emitOperandEpilogue (std::ostream &, SgAsmExpression *, State &) const
 Mid-level unparser function.
 
virtual void emitExpression (std::ostream &, SgAsmExpression *, State &) const
 Mid-level unparser function.
 
virtual void emitRegister (std::ostream &, RegisterDescriptor, State &) const
 Mid-level unparser function.
 
virtual std::vector< std::string > emitUnsignedInteger (std::ostream &, const Sawyer::Container::BitVector &, State &) const
 Mid-level unparser function.
 
virtual std::vector< std::string > emitSignedInteger (std::ostream &, const Sawyer::Container::BitVector &, State &) const
 Mid-level unparser function.
 
virtual std::vector< std::string > emitInteger (std::ostream &, const Sawyer::Container::BitVector &, State &, bool isSigned) const
 Mid-level unparser function.
 
virtual bool emitAddress (std::ostream &, rose_addr_t, State &, bool always=true) const
 Mid-level unparser function.
 
virtual bool emitAddress (std::ostream &, const Sawyer::Container::BitVector &, State &, bool always=true) const
 Mid-level unparser function.
 
virtual void emitCommentBlock (std::ostream &, const std::string &, State &, const std::string &prefix=";;; ") const
 Mid-level unparser function.
 
virtual void emitTypeName (std::ostream &, SgAsmType *, State &) const
 Mid-level unparser function.
 
virtual void emitLinePrefix (std::ostream &, State &) const
 Mid-level unparser function.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 

Static Public Member Functions

static Ptr instance (const Architecture::BaseConstPtr &, const CilSettings &=CilSettings())
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::Unparser::Base
static std::string leftJustify (const std::string &, size_t nchars)
 Render a string left justified.
 
static std::string juxtaposeColumns (const std::vector< std::string > &content, const std::vector< size_t > &minWidths, const std::vector< std::pair< std::string, std::string > > &colorEscapes, const std::string &columnSeparator=" ")
 Render a table row.
 
static bool ascendingSourceAddress (Partitioner2::ControlFlowGraph::ConstEdgeIterator a, Partitioner2::ControlFlowGraph::ConstEdgeIterator b)
 Return true if edges are in order by source address.
 
static bool ascendingTargetAddress (Partitioner2::ControlFlowGraph::ConstEdgeIterator a, Partitioner2::ControlFlowGraph::ConstEdgeIterator b)
 Return true if edges are in order by target address.
 
static std::vector< Partitioner2::ControlFlowGraph::ConstEdgeIterator > orderedBlockPredecessors (const Partitioner2::PartitionerConstPtr &, const Partitioner2::BasicBlockPtr &)
 Ordered incoming CFG edges.
 
static std::vector< Partitioner2::ControlFlowGraph::ConstEdgeIterator > orderedBlockSuccessors (const Partitioner2::PartitionerConstPtr &, const Partitioner2::BasicBlockPtr &)
 Ordered outgoing CFG edges.
 

Protected Member Functions

 Cil (const Architecture::BaseConstPtr &, const CilSettings &)
 
void emitInstruction (std::ostream &, SgAsmInstruction *, State &) const override
 Mid-level unparser function.
 
void emitOperandBody (std::ostream &, SgAsmExpression *, State &) const override
 Mid-level unparser function.
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::Unparser::Base
 Base (const Architecture::BaseConstPtr &)
 
 Base (const Ptr &nextUnparser)
 

Additional Inherited Members

- Public Types inherited from Rose::BinaryAnalysis::Unparser::Base
typedef Sawyer::SharedPointer< BasePtr
 

Member Function Documentation

◆ copy()

Ptr Rose::BinaryAnalysis::Unparser::Cil::copy ( ) const
overridevirtual

◆ settings() [1/2]

const CilSettings & Rose::BinaryAnalysis::Unparser::Cil::settings ( ) const
inlineoverridevirtual

Property: Settings associated with this unparser.

Most of these settings can also be configured from the command-line. They control features of the unparser directly without the programmer having to invervene by creating a subclss or chaining a new parser. Most of the switches simply turn things on and off.

Copying an unparser also copies its settings.

Implements Rose::BinaryAnalysis::Unparser::Base.

Definition at line 33 of file Unparser/Cil.h.

◆ settings() [2/2]

CilSettings & Rose::BinaryAnalysis::Unparser::Cil::settings ( )
inlineoverridevirtual

Property: Settings associated with this unparser.

Most of these settings can also be configured from the command-line. They control features of the unparser directly without the programmer having to invervene by creating a subclss or chaining a new parser. Most of the switches simply turn things on and off.

Copying an unparser also copies its settings.

Implements Rose::BinaryAnalysis::Unparser::Base.

Definition at line 34 of file Unparser/Cil.h.

◆ emitInstruction()

void Rose::BinaryAnalysis::Unparser::Cil::emitInstruction ( std::ostream &  ,
SgAsmInstruction ,
State  
) const
overrideprotectedvirtual

Mid-level unparser function.

This function emits some entity to the specified output stream. All call-specific state is supplied in the State reference so that this function can be called with a const parser references and is thread safe per state object. The high-level functions create the state – states are not intended for end users – before calling this mid-level function.

This mid-level function uses a combination of C++ virtual function calls and object chaining. The virtual functions allow subclasses to override or augment behavior from the base class, so that, e.g., an x86 operand expression can be output in a different format than an m68k expression. The object chaining allows one unparser to override or augment the behavior of another function and is used, for example, to provide HTML wrapping around various entities.

The object chaining is implemented in two parts: every unparser object has a nextUnparser pointer and the final unparser in the list has a null pointer for this property; the Unparser::State object has a frontUnparser method that returns the first unparser in this list. This mid-level function is expected to always invoke functions on the front unparser in order to give every parser in the chain a chance to influence behavior. The base implementation of this mid-level function defers to the next parser in the chain if there is one, otherwise it performs some default output that's hopefully appropriate for most unparsers.

All such chained and virtual emitters begin with the letters "emit".

Reimplemented from Rose::BinaryAnalysis::Unparser::Base.

◆ emitOperandBody()

void Rose::BinaryAnalysis::Unparser::Cil::emitOperandBody ( std::ostream &  ,
SgAsmExpression ,
State  
) const
overrideprotectedvirtual

Mid-level unparser function.

This function emits some entity to the specified output stream. All call-specific state is supplied in the State reference so that this function can be called with a const parser references and is thread safe per state object. The high-level functions create the state – states are not intended for end users – before calling this mid-level function.

This mid-level function uses a combination of C++ virtual function calls and object chaining. The virtual functions allow subclasses to override or augment behavior from the base class, so that, e.g., an x86 operand expression can be output in a different format than an m68k expression. The object chaining allows one unparser to override or augment the behavior of another function and is used, for example, to provide HTML wrapping around various entities.

The object chaining is implemented in two parts: every unparser object has a nextUnparser pointer and the final unparser in the list has a null pointer for this property; the Unparser::State object has a frontUnparser method that returns the first unparser in this list. This mid-level function is expected to always invoke functions on the front unparser in order to give every parser in the chain a chance to influence behavior. The base implementation of this mid-level function defers to the next parser in the chain if there is one, otherwise it performs some default output that's hopefully appropriate for most unparsers.

All such chained and virtual emitters begin with the letters "emit".

Reimplemented from Rose::BinaryAnalysis::Unparser::Base.


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