ROSE 0.11.145.147
|
State for unparsing.
This object stores the current state for unparsing. The state is kept separate from the unparser class so that (1) the unparser can be a const reference, and (2) multiple threads can be unparsing with the same unparser object.
Definition at line 198 of file Unparser/Base.h.
#include <Rose/BinaryAnalysis/Unparser/Base.h>
Public Types | |
typedef Sawyer::Container::Map< rose_addr_t, std::string > | AddrString |
Map from address to string. | |
Public Member Functions | |
State (const Partitioner2::PartitionerConstPtr &, const Architecture::BaseConstPtr &, const Settings &, const Base &frontUnparser) | |
Partitioner2::PartitionerConstPtr | partitioner () const |
Property: Partitioner, which may be null. | |
const Partitioner2::FunctionCallGraph & | cg () const |
Property: Call grap, which may be empty. | |
Reachability::ReasonFlags | isCfgVertexReachable (size_t vertexId) const |
Returns reachability based on the cfgVertexReachability property. | |
void | thisIsBasicBlockFirstInstruction () |
Call this when you're about to output the first instruction of a basic block. | |
void | thisIsBasicBlockLastInstruction () |
Call this when you're about to output the last instruction of a basic block. | |
Partitioner2::FunctionPtr | currentFunction () const |
void | currentFunction (const Partitioner2::FunctionPtr &) |
Partitioner2::BasicBlockPtr | currentBasicBlock () const |
void | currentBasicBlock (const Partitioner2::BasicBlockPtr &) |
const std::string & | nextInsnLabel () const |
void | nextInsnLabel (const std::string &) |
const RegisterNames & | registerNames () const |
void | registerNames (const RegisterNames &r) |
const AddrString & | basicBlockLabels () const |
AddrString & | basicBlockLabels () |
const Base & | frontUnparser () const |
First unparser in the chained list of unparsers. | |
const std::vector< Reachability::ReasonFlags > | cfgVertexReachability () const |
Property: Reachability analysis results. | |
void | cfgVertexReachability (const std::vector< Reachability::ReasonFlags > &) |
Property: Reachability analysis results. | |
const ArrowMargin & | intraFunctionCfgArrows () const |
Control flow graph arrows within a function. | |
ArrowMargin & | intraFunctionCfgArrows () |
Control flow graph arrows within a function. | |
const ArrowMargin & | intraFunctionBlockArrows () const |
User-defined intra-function margin arrows. | |
ArrowMargin & | intraFunctionBlockArrows () |
User-defined intra-function margin arrows. | |
const ArrowMargin & | globalBlockArrows () const |
User-defined arrows to basic blocks across entire output. | |
ArrowMargin & | globalBlockArrows () |
User-defined arrows to basic blocks across entire output. | |
Sawyer::Optional< EdgeArrows::VertexId > | currentPredSuccId () const |
Property: ID for CFG edge arrow endpoint. | |
void | currentPredSuccId (Sawyer::Optional< EdgeArrows::VertexId > id) |
Property: ID for CFG edge arrow endpoint. | |
bool | cfgArrowsPointToInsns () const |
Property: Whether CFG margin arrows point to instructions. | |
void | cfgArrowsPointToInsns (bool b) |
Property: Whether CFG margin arrows point to instructions. | |
const StyleStack & | styleStack () const |
Property: Stack of styles. | |
StyleStack & | styleStack () |
Property: Stack of styles. | |
void | reachabilityName (Reachability::Reason value, const std::string &name) |
Assign a reachability name to a reachability value. | |
std::string | reachabilityName (Reachability::ReasonFlags value) const |
Assign a reachability name to a reachability value. | |
typedef Sawyer::Container::Map<rose_addr_t, std::string> Rose::BinaryAnalysis::Unparser::State::AddrString |
Map from address to string.
Definition at line 200 of file Unparser/Base.h.
const std::vector< Reachability::ReasonFlags > Rose::BinaryAnalysis::Unparser::State::cfgVertexReachability | ( | ) | const |
Property: Reachability analysis results.
This property stores a vector indexed by CFG vertex IDs that holds information about whether the vertex is reachable and why.
void Rose::BinaryAnalysis::Unparser::State::cfgVertexReachability | ( | const std::vector< Reachability::ReasonFlags > & | ) |
Property: Reachability analysis results.
This property stores a vector indexed by CFG vertex IDs that holds information about whether the vertex is reachable and why.
Reachability::ReasonFlags Rose::BinaryAnalysis::Unparser::State::isCfgVertexReachable | ( | size_t | vertexId | ) | const |
Returns reachability based on the cfgVertexReachability property.
If the property has more elements than vertices in the CFG, then the extras are ignored; if the CFG is larger then the missing reachability values are assumed to be zero.
|
inline |
Control flow graph arrows within a function.
This property holds information about how and when to draw arrows in the left margin to represent the edges of a control flow graph whose endpoints are both within the same function. The object is initialized each time a function is entered (see Base::emitFunction) just before emitting the first basic block, but only if the unparser settings indicate that these margin arrows should be displayed. The object is reset just after printing the basic blocks. The object should be in a default state when printing the function prologue and epilogue information, otherwise those parts of the output would be unecessarily indented.
See also, intraFunctionBlockArrows, globalBlockArrows.
Definition at line 258 of file Unparser/Base.h.
|
inline |
Control flow graph arrows within a function.
This property holds information about how and when to draw arrows in the left margin to represent the edges of a control flow graph whose endpoints are both within the same function. The object is initialized each time a function is entered (see Base::emitFunction) just before emitting the first basic block, but only if the unparser settings indicate that these margin arrows should be displayed. The object is reset just after printing the basic blocks. The object should be in a default state when printing the function prologue and epilogue information, otherwise those parts of the output would be unecessarily indented.
See also, intraFunctionBlockArrows, globalBlockArrows.
Definition at line 259 of file Unparser/Base.h.
|
inline |
User-defined intra-function margin arrows.
This object holds information about user-defined arrows in the margin. These arrows point to/from basic blocks such that both basic blocks are in the same function.
To update these arrows during unparsing, the user should provide an unparser updateIntraFunctionArrows either by class derivation or chaining. The actual information about the arrows will be in that function's state
argument in state.intraFunctionBlockArrows()
.arrows. Although it will have already been computed, the state.intraFunctionCfgArrows
can be adjusted at the same time.
See also, intraFunctionCfgArrows, globalBlockArrows.
Definition at line 275 of file Unparser/Base.h.
|
inline |
User-defined intra-function margin arrows.
This object holds information about user-defined arrows in the margin. These arrows point to/from basic blocks such that both basic blocks are in the same function.
To update these arrows during unparsing, the user should provide an unparser updateIntraFunctionArrows either by class derivation or chaining. The actual information about the arrows will be in that function's state
argument in state.intraFunctionBlockArrows()
.arrows. Although it will have already been computed, the state.intraFunctionCfgArrows
can be adjusted at the same time.
See also, intraFunctionCfgArrows, globalBlockArrows.
Definition at line 276 of file Unparser/Base.h.
|
inline |
User-defined arrows to basic blocks across entire output.
This object holds information about user-defined arrows in the margin. These arrows point to/from basic blocks anywhere in the program (not just within functions as with intraFunctionBlockArrows).
See also, intraFunctionCfgArrows, intraFunctionBlockArrows.
Definition at line 287 of file Unparser/Base.h.
|
inline |
User-defined arrows to basic blocks across entire output.
This object holds information about user-defined arrows in the margin. These arrows point to/from basic blocks anywhere in the program (not just within functions as with intraFunctionBlockArrows).
See also, intraFunctionCfgArrows, intraFunctionBlockArrows.
Definition at line 288 of file Unparser/Base.h.
|
inline |
Property: ID for CFG edge arrow endpoint.
When generating margin arrows that point to the "predecessor:" and "successor:" lines of the output (instead of arrows that point to the basic block instructions), this property holds the ID number for the arrow endpoint. See EdgeArrows::computeCfgEdgeLayout.
Definition at line 304 of file Unparser/Base.h.
|
inline |
Property: ID for CFG edge arrow endpoint.
When generating margin arrows that point to the "predecessor:" and "successor:" lines of the output (instead of arrows that point to the basic block instructions), this property holds the ID number for the arrow endpoint. See EdgeArrows::computeCfgEdgeLayout.
Definition at line 305 of file Unparser/Base.h.
|
inline |
Property: Whether CFG margin arrows point to instructions.
If set, then the CFG arrows in the left margin origin from and point to instructions of basic blocks. If false, they originate from "successor:" lines and point to "predecessor:" lines. If there are no CFG margin arrows then the value of this property doesn't matter.
Definition at line 315 of file Unparser/Base.h.
|
inline |
Property: Whether CFG margin arrows point to instructions.
If set, then the CFG arrows in the left margin origin from and point to instructions of basic blocks. If false, they originate from "successor:" lines and point to "predecessor:" lines. If there are no CFG margin arrows then the value of this property doesn't matter.
Definition at line 316 of file Unparser/Base.h.
|
inline |
Property: Stack of styles.
Definition at line 322 of file Unparser/Base.h.
|
inline |
Property: Stack of styles.
Definition at line 323 of file Unparser/Base.h.
void Rose::BinaryAnalysis::Unparser::State::reachabilityName | ( | Reachability::Reason | value, |
const std::string & | name | ||
) |
Assign a reachability name to a reachability value.
The two-argument version of this function associates a name with a value. An empty name clears the association.
The one-argument version returns the name corresponding to the value, or generates a name on the fly. To generate a name, the value is first looked up in the mapping and that name is used if present. Otherwise, the value is broken down into individual bits and the resulting string is the comma-separated names for each of the bits. If the mapping has a name for a bit then it's used. Otherwise, if the bit is greater than or equal to BinaryAnalysis::Reachability::Reason USER_DEFINED_0
the string will be "user-defined-x" where x
is the number of bits to right shift the flag to make it equal to USER_DEFINED_0. Otherwise, the name of the bit is obtained by treating the value as an enum and obtaining the enum name. If that fails due to the fact that not all bits have corresponding enum constants, the name is the hexadecimal string for the bit.
std::string Rose::BinaryAnalysis::Unparser::State::reachabilityName | ( | Reachability::ReasonFlags | value | ) | const |
Assign a reachability name to a reachability value.
The two-argument version of this function associates a name with a value. An empty name clears the association.
The one-argument version returns the name corresponding to the value, or generates a name on the fly. To generate a name, the value is first looked up in the mapping and that name is used if present. Otherwise, the value is broken down into individual bits and the resulting string is the comma-separated names for each of the bits. If the mapping has a name for a bit then it's used. Otherwise, if the bit is greater than or equal to BinaryAnalysis::Reachability::Reason USER_DEFINED_0
the string will be "user-defined-x" where x
is the number of bits to right shift the flag to make it equal to USER_DEFINED_0. Otherwise, the name of the bit is obtained by treating the value as an enum and obtaining the enum name. If that fails due to the fact that not all bits have corresponding enum constants, the name is the hexadecimal string for the bit.