ROSE 0.11.145.192
|
Creates GraphViz files from Partitioner data.
This class operates in these steps:
Step 2 (choosing vertices and edges) is accomplished via vertexOrganization and edgeOrganization methods and the Organization::select method invoked on their return values. Step 3 (setting labels and other attributes) is performed the same way, but with Organization::label and Organization::attributes methods. This class also has a number of "select" methods that perform steps 2 and 3 at the same time; these methods adjust labels and attributes only when selecting a previously unselected vertex, edge, or subgraph–otherwise they use the label and attributes that were previously specified. Step 4 is normally achieved by invoking the emit method, but the class also defines other emitters that combine a "select" method of the same name with emit.
Definition at line 436 of file GraphViz.h.
#include <Rose/BinaryAnalysis/Partitioner2/GraphViz.h>
Public Member Functions | |
PartitionerConstPtr | partitioner () |
Property: partitioner. | |
void | selectInterval (const AddressInterval &) |
Selects vertices in some interval. | |
void | selectIntraFunction (const FunctionPtr &) |
Select vertices and intra-function edges for one function. | |
void | selectFunctionCallees (const FunctionPtr &) |
Select outgoing edges to neighboring vertices. | |
void | selectFunctionCallers (const FunctionPtr &) |
Select incoming edges from neighboring vertices. | |
void | deselectReturnEdges () |
Deselect all function return edges. | |
void | deselectUnusedVertex (ControlFlowGraph::ConstVertexIterator) |
Deselect a vertex if it has no selected incident edges. | |
void | deselectUnusedVertexType (VertexType) |
Deselect vertices of specified type if they have no selected incident edges. | |
void | selectNeighbors (bool selectInEdges=true, bool selectOutEdges=true) |
Select neighboring vertices. | |
CfgEmitter & | selectWholeGraph () |
Selects graph elements for whole-graph output. | |
CfgEmitter & | selectFunctionGraph (const FunctionPtr &) |
Selects the CFG for one function. | |
CfgEmitter & | selectIntervalGraph (const AddressInterval &interval) |
Selects vertices that start within some interval. | |
void | emitWholeGraph (std::ostream &) |
Dump entire control flow graph. | |
void | emitFunctionGraph (std::ostream &, const FunctionPtr &) |
Dump control flow graph for one function. | |
void | emitIntervalGraph (std::ostream &, const AddressInterval &) |
Dump control flow graph for some address interval. | |
void | assignFunctionSubgraphs () |
Assign vertices and edges to subgraphs. | |
virtual std::string | sourceLocation (const ControlFlowGraph::ConstVertexIterator &) const |
Source location for vertex. | |
virtual std::string | functionLabel (const FunctionPtr &) const |
Label for function vertex. | |
virtual Attributes | functionAttributes (const FunctionPtr &) const |
Attributes for function vertex. | |
CfgEmitter (const PartitionerConstPtr &) | |
Constructor. | |
CfgEmitter (const PartitionerConstPtr &, const ControlFlowGraph &) | |
Constructor. | |
bool | useFunctionSubgraphs () const |
Property: use function subgraphs. | |
void | useFunctionSubgraphs (bool b) |
Property: use function subgraphs. | |
bool | showInstructions () const |
Property: show basic block instructions. | |
void | showInstructions (bool b) |
Property: show basic block instructions. | |
bool | showInstructionAddresses () const |
Property: show instruction addresses. | |
void | showInstructionAddresses (bool b) |
Property: show instruction addresses. | |
bool | strikeNoopSequences () const |
Property: strike no-op sequences. | |
void | strikeNoopSequences (bool b) |
Property: strike no-op sequences. | |
const Color::HSV & | funcEnterColor () const |
Property: color to use for background of function entrance nodes. | |
void | funcEnterColor (const Color::HSV &bg) |
Property: color to use for background of function entrance nodes. | |
const Color::HSV & | funcReturnColor () const |
Property: color to use for background of function return nodes. | |
void | funcReturnColor (const Color::HSV &bg) |
Property: color to use for background of function return nodes. | |
const Color::HSV & | warningColor () const |
Property: color to use for background of special nodes and for warnings. | |
void | warningColor (const Color::HSV &bg) |
Property: color to use for background of special nodes and for warnings. | |
bool | showOutNeighbors () const |
Property: show outgoing edges to neighbor vertices. | |
void | showOutNeighbors (bool b) |
Property: show outgoing edges to neighbor vertices. | |
bool | showInNeighbors () const |
Property: show incoming edges from neighbor vertices. | |
void | showInNeighbors (bool b) |
Property: show incoming edges from neighbor vertices. | |
bool | showReturnEdges () const |
Property: show function return edges. | |
void | showReturnEdges (bool b) |
Property: show function return edges. | |
const SourceLocations & | srcMapper () const |
Property: Address-to-source mapping. | |
SourceLocations & | srcMapper () |
Property: Address-to-source mapping. | |
void | srcMapper (const SourceLocations &mapper) |
Property: Address-to-source mapping. | |
virtual std::string | vertexLabel (const ControlFlowGraph::ConstVertexIterator &) const |
Label for CFG vertex. | |
std::string | vertexLabel (const ControlFlowGraph::Vertex &) const |
Label for CFG vertex. | |
virtual std::string | vertexLabelDetailed (const ControlFlowGraph::ConstVertexIterator &) const |
Detailed label for CFG vertex. | |
std::string | vertexLabelDetailed (const ControlFlowGraph::Vertex &) const |
Detailed label for CFG vertex. | |
virtual Attributes | vertexAttributes (const ControlFlowGraph::ConstVertexIterator &) const |
Attributes for a CFG vertex. | |
Attributes | vertexAttributes (const ControlFlowGraph::Vertex &) const |
Attributes for a CFG vertex. | |
virtual std::string | edgeLabel (const ControlFlowGraph::ConstEdgeIterator &) const |
Label for CFG edge. | |
std::string | edgeLabel (const ControlFlowGraph::Edge &) const |
Label for CFG edge. | |
virtual Attributes | edgeAttributes (const ControlFlowGraph::ConstEdgeIterator &) const |
Attributes for a CFG edge. | |
Attributes | edgeAttributes (const ControlFlowGraph::Edge &) const |
Attributes for a CFG edge. | |
Public Member Functions inherited from Rose::BinaryAnalysis::Partitioner2::GraphViz::BaseEmitter< ControlFlowGraph > | |
BaseEmitter () | |
Default constructor. | |
BaseEmitter (const Graph &g) | |
Constructor. | |
void | graph (const Graph &g) |
Reset the graph. | |
void | selectAll (bool b=true) |
Causes all vertices and edges to be selected. | |
void | selectNone () |
Deselects all vertices and edges. | |
void | selectAllVertices (bool b=true) |
Causes all vertices to be selected. | |
void | selectAllEdges (bool b=true) |
Causes all edges to be selected. | |
void | deselectParallelEdges () |
Deselect all but one parallel edge. | |
virtual void | emit (std::ostream &) const |
Dump selected vertices, edges, and subgraphs. | |
Attributes & | defaultGraphAttributes () |
Property: default graph attributes. | |
const Attributes & | defaultGraphAttributes () const |
Property: default graph attributes. | |
Attributes & | defaultNodeAttributes () |
Property: default graph node attributes. | |
const Attributes & | defaultNodeAttributes () const |
Property: default graph node attributes. | |
Attributes & | defaultEdgeAttributes () |
Property: default graph edge attributes. | |
const Attributes & | defaultEdgeAttributes () const |
Property: default graph edge attributes. | |
const Color::HSV & | subgraphColor () const |
Property: color to use for function subgraph background. | |
void | subgraphColor (const Color::HSV &bg) |
Property: color to use for function subgraph background. | |
const VertexOrganization & | vertexOrganization () const |
Property: Controls which vertices are to appear in the output, and how. | |
VertexOrganization & | vertexOrganization () |
Property: Controls which vertices are to appear in the output, and how. | |
const Organization & | vertexOrganization (size_t vertexId) const |
Property: Controls which vertices are to appear in the output, and how. | |
Organization & | vertexOrganization (size_t vertexId) |
Property: Controls which vertices are to appear in the output, and how. | |
const Organization & | vertexOrganization (const typename G::ConstVertexIterator &vertex) const |
Property: Controls which vertices are to appear in the output, and how. | |
const Organization & | vertexOrganization (const typename G::Vertex &vertex) const |
Property: Controls which vertices are to appear in the output, and how. | |
Organization & | vertexOrganization (const typename G::ConstVertexIterator &vertex) |
Property: Controls which vertices are to appear in the output, and how. | |
Organization & | vertexOrganization (const typename G::Vertex &vertex) |
Property: Controls which vertices are to appear in the output, and how. | |
const EdgeOrganization & | edgeOrganization () const |
Property: Controls which edges are to appear in the output, and how. | |
EdgeOrganization & | edgeOrganization () |
Property: Controls which edges are to appear in the output, and how. | |
const Organization & | edgeOrganization (size_t edgeId) const |
Property: Controls which edges are to appear in the output, and how. | |
Organization & | edgeOrganization (size_t edgeId) |
Property: Controls which edges are to appear in the output, and how. | |
const Organization & | edgeOrganization (const typename G::ConstEdgeIterator &edge) const |
Property: Controls which edges are to appear in the output, and how. | |
const Organization & | edgeOrganization (const typename G::Edge &edge) const |
Property: Controls which edges are to appear in the output, and how. | |
Organization & | edgeOrganization (const typename G::ConstEdgeIterator &edge) |
Property: Controls which edges are to appear in the output, and how. | |
Organization & | edgeOrganization (const typename G::Edge &edge) |
Property: Controls which edges are to appear in the output, and how. | |
const SubgraphOrganization & | subgraphOrganization () const |
Property: Controls which subgraphs appear in the output, and how. | |
SubgraphOrganization & | subgraphOrganization () |
Property: Controls which subgraphs appear in the output, and how. | |
const Organization & | subgraphOrganization (const std::string &name) const |
Property: Controls which subgraphs appear in the output, and how. | |
Organization & | subgraphOrganization (const std::string &name) |
Property: Controls which subgraphs appear in the output, and how. | |
Static Public Member Functions | |
static bool | isInterFunctionEdge (const ControlFlowGraph::Edge &) |
Returns true if the edge spans two different functions. | |
static bool | isInterFunctionEdge (const ControlFlowGraph::ConstEdgeIterator &) |
Returns true if the edge spans two different functions. | |
static FunctionPtr | firstOwningFunction (const ControlFlowGraph::Vertex &) |
First function that owns a vertex. | |
static FunctionPtr | firstOwningFunction (const ControlFlowGraph::ConstVertexIterator &v) |
First function that owns a vertex. | |
static FunctionSet | owningFunctions (const ControlFlowGraph::Vertex &) |
Functions that own a vertex. | |
static FunctionSet | owningFunctions (const ControlFlowGraph::ConstVertexIterator &) |
Functions that own a vertex. | |
|
explicit |
Constructor.
Constructs a GraphViz emitter that uses the control flow graph (and possibly other data structures) from the specified partitioner, or the provided control flow graph which must be compatible with the partitioner. The GraphViz object will hold a reference to the partitioner, therefore the partitioner should not be deleted before the GraphViz object.
Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::CfgEmitter | ( | const PartitionerConstPtr & | , |
const ControlFlowGraph & | |||
) |
Constructor.
Constructs a GraphViz emitter that uses the control flow graph (and possibly other data structures) from the specified partitioner, or the provided control flow graph which must be compatible with the partitioner. The GraphViz object will hold a reference to the partitioner, therefore the partitioner should not be deleted before the GraphViz object.
|
inline |
Property: partitioner.
The partitioner that's being used, set when this emitter was constructed.
Definition at line 470 of file GraphViz.h.
|
inline |
Property: use function subgraphs.
When this property is true, GraphViz-emitting methods that adjust the vertex, edge, and/or subgraph organization will create new subgraphs for each function that has selected vertices. The subgraphs will correspond to functions. Vertices that don't appear in any function will likewise not belong to any subgraph.
Definition at line 479 of file GraphViz.h.
|
inline |
Property: use function subgraphs.
When this property is true, GraphViz-emitting methods that adjust the vertex, edge, and/or subgraph organization will create new subgraphs for each function that has selected vertices. The subgraphs will correspond to functions. Vertices that don't appear in any function will likewise not belong to any subgraph.
Definition at line 480 of file GraphViz.h.
|
inline |
Property: show basic block instructions.
When true, vertex labels computed by the GraphViz-emitting methods (as opposed to labels set by the user), will contain the disassembled instructions. Otherwise such labels will consist of only the basic block starting address. This property is expected to be honored by the vertexLabel virtual method.
Definition at line 490 of file GraphViz.h.
|
inline |
Property: show basic block instructions.
When true, vertex labels computed by the GraphViz-emitting methods (as opposed to labels set by the user), will contain the disassembled instructions. Otherwise such labels will consist of only the basic block starting address. This property is expected to be honored by the vertexLabel virtual method.
Definition at line 491 of file GraphViz.h.
|
inline |
Property: show instruction addresses.
When true and basic block instructions are shown (showInstructions), then the address of each instruction is also rendered. This property is expected to be honored by the vertexLabel virtual method.
Definition at line 500 of file GraphViz.h.
|
inline |
Property: show instruction addresses.
When true and basic block instructions are shown (showInstructions), then the address of each instruction is also rendered. This property is expected to be honored by the vertexLabel virtual method.
Definition at line 501 of file GraphViz.h.
|
inline |
Property: strike no-op sequences.
Those instructions that are part of a no-op sequence are rendered in a different font (such as strike-through). When two or more sequences overlap, the largest sequence is struck and all overlapping sequences are not processed. For nested squences, this causes all instructions to be struck; for overlapping but non-nested sequences, only the largest one is struck.
Definition at line 512 of file GraphViz.h.
|
inline |
Property: strike no-op sequences.
Those instructions that are part of a no-op sequence are rendered in a different font (such as strike-through). When two or more sequences overlap, the largest sequence is struck and all overlapping sequences are not processed. For nested squences, this causes all instructions to be struck; for overlapping but non-nested sequences, only the largest one is struck.
Definition at line 513 of file GraphViz.h.
|
inline |
Property: color to use for background of function entrance nodes.
Edges to these nodes are created by converting the background color to a foreground color by inverting the value in HSV space (keeping the same hue and saturation).
Definition at line 523 of file GraphViz.h.
|
inline |
Property: color to use for background of function entrance nodes.
Edges to these nodes are created by converting the background color to a foreground color by inverting the value in HSV space (keeping the same hue and saturation).
Definition at line 524 of file GraphViz.h.
|
inline |
Property: color to use for background of function return nodes.
Definition at line 530 of file GraphViz.h.
|
inline |
Property: color to use for background of function return nodes.
Definition at line 531 of file GraphViz.h.
|
inline |
Property: color to use for background of special nodes and for warnings.
Definition at line 537 of file GraphViz.h.
|
inline |
Property: color to use for background of special nodes and for warnings.
Definition at line 538 of file GraphViz.h.
|
inline |
Property: show outgoing edges to neighbor vertices.
If set, then a function selector will also select inter-function edges originating from the selected function, and the incident vertices for those edges. Most of the time the incident vertices will be entry points for called functions.
Definition at line 547 of file GraphViz.h.
|
inline |
Property: show outgoing edges to neighbor vertices.
If set, then a function selector will also select inter-function edges originating from the selected function, and the incident vertices for those edges. Most of the time the incident vertices will be entry points for called functions.
Definition at line 548 of file GraphViz.h.
|
inline |
Property: show incoming edges from neighbor vertices.
If set, then a function selector will also select inter-function edges targeting the selected function, and the incident vertices for those edges. Under certain (usual) circumstances, all incident vertices from the same function are collapsed into a single function vertex and the parallel edges are replaced with a single edge having a label indicating the number of original edges and their types.
Definition at line 559 of file GraphViz.h.
|
inline |
Property: show incoming edges from neighbor vertices.
If set, then a function selector will also select inter-function edges targeting the selected function, and the incident vertices for those edges. Under certain (usual) circumstances, all incident vertices from the same function are collapsed into a single function vertex and the parallel edges are replaced with a single edge having a label indicating the number of original edges and their types.
Definition at line 560 of file GraphViz.h.
|
inline |
Property: show function return edges.
If this property is false, then selector functions that normally add E_FUNCTION_RETURN edges to the output will omit those edges instead by calling deselectReturnEdges.
Definition at line 569 of file GraphViz.h.
|
inline |
Property: show function return edges.
If this property is false, then selector functions that normally add E_FUNCTION_RETURN edges to the output will omit those edges instead by calling deselectReturnEdges.
Definition at line 570 of file GraphViz.h.
|
inline |
Property: Address-to-source mapping.
If an address to source mapping is provided then source location information will be shown in each vertex.
Definition at line 578 of file GraphViz.h.
|
inline |
Property: Address-to-source mapping.
If an address to source mapping is provided then source location information will be shown in each vertex.
Definition at line 579 of file GraphViz.h.
|
inline |
Property: Address-to-source mapping.
If an address to source mapping is provided then source location information will be shown in each vertex.
Definition at line 580 of file GraphViz.h.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::selectInterval | ( | const AddressInterval & | ) |
Selects vertices in some interval.
Selects all vertices whose starting address falls within the specified interval, then selects all edges that connect any two selected vertices (regardless of whether those vertices were just selected by this method or were previously selected).
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::selectFunctionCallees | ( | const FunctionPtr & | ) |
Select outgoing edges to neighboring vertices.
These edges typically represent calls to other functions.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::selectFunctionCallers | ( | const FunctionPtr & | ) |
Select incoming edges from neighboring vertices.
These edges typically represent calls from other functions. When possible, multiple edges from the same function will be replaced with a single pseudo-edge coming from that function's entry vertex.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::deselectReturnEdges | ( | ) |
Deselect all function return edges.
Any edge of type E_FUNCTION_RETURN is deselected.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::selectNeighbors | ( | bool | selectInEdges = true , |
bool | selectOutEdges = true |
||
) |
Select neighboring vertices.
Selects vertices that are neighbors of selected vertices, and the edges that connect them.
CfgEmitter & Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::selectWholeGraph | ( | ) |
Selects graph elements for whole-graph output.
(Re)selects all vertices and edges and gives them default names and attributes according to certain properties defined in this object. The user then has a chance to make adjustments to the organization before calling emit. The emitWholeGraph does the selection and emitting in one step.
CfgEmitter & Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::selectFunctionGraph | ( | const FunctionPtr & | ) |
Selects the CFG for one function.
Selects all vertices and edges that are part of the specified function. Additionally, any inter-function edges to/from this function and their incident vertices are also selected according to selectFunctionCallees and selectFunctionCallers.
CfgEmitter & Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::selectIntervalGraph | ( | const AddressInterval & | interval | ) |
Selects vertices that start within some interval.
Selects all vertices whose starting address falls within the specified interval, plus all edges whose incident vertices are selected. Additionally, neighboring vertices and connective edges are optionally added depending on showOutNeighbors and showInNeighbors.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::emitWholeGraph | ( | std::ostream & | ) |
Dump entire control flow graph.
This is a convenient wrapper around selectWholeGraph and emit.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::emitFunctionGraph | ( | std::ostream & | , |
const FunctionPtr & | |||
) |
Dump control flow graph for one function.
This is a convenient wrapper around selectFunctionGraph and emit.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::emitIntervalGraph | ( | std::ostream & | , |
const AddressInterval & | |||
) |
Dump control flow graph for some address interval.
This is a convenient wrapper around selectIntervalGraph and emit.
|
static |
First function that owns a vertex.
Returns the first of possibly many functions that own a vertex. "First" is defined as the function listed first in the set returned by CfgVertex::owningFunctions. Returns null if there are no owning functions.
|
inlinestatic |
First function that owns a vertex.
Returns the first of possibly many functions that own a vertex. "First" is defined as the function listed first in the set returned by CfgVertex::owningFunctions. Returns null if there are no owning functions.
Definition at line 689 of file GraphViz.h.
|
static |
Functions that own a vertex.
Returns a set of pointers to the functions that own the specified vertex. Usually a vertex is owned by either zero or one function.
|
static |
Functions that own a vertex.
Returns a set of pointers to the functions that own the specified vertex. Usually a vertex is owned by either zero or one function.
void Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::assignFunctionSubgraphs | ( | ) |
Assign vertices and edges to subgraphs.
Each vertex is assigned to a subgraph, one subgraph per function. If a vertex is owned by more than one function then the "first" function is used, where the definition of "first" is quite arbitrary.
|
virtual |
Source location for vertex.
Returns a string indicating the source code location for a vertex. If no information is available then an empty string is returned.
|
virtual |
Label for CFG vertex.
Returns the simple label for a CFG vertex. The simple label is usually just an address rather than instructions, etc. The returned lable must include the delimiting double quotes or angle brackets and have proper escaping of contents.
std::string Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::vertexLabel | ( | const ControlFlowGraph::Vertex & | ) | const |
Label for CFG vertex.
Returns the simple label for a CFG vertex. The simple label is usually just an address rather than instructions, etc. The returned lable must include the delimiting double quotes or angle brackets and have proper escaping of contents.
|
virtual |
Detailed label for CFG vertex.
The detailed label can be a multi-line value and must include delimiting double quotes or angle brackets with proper escaping of the content. This method should honor the showInstructionAddresses property.
std::string Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::vertexLabelDetailed | ( | const ControlFlowGraph::Vertex & | ) | const |
Detailed label for CFG vertex.
The detailed label can be a multi-line value and must include delimiting double quotes or angle brackets with proper escaping of the content. This method should honor the showInstructionAddresses property.
|
virtual |
Label for CFG edge.
The returned lable must include the delimiting double quotes or angle brackets and have proper escaping of contents.
std::string Rose::BinaryAnalysis::Partitioner2::GraphViz::CfgEmitter::edgeLabel | ( | const ControlFlowGraph::Edge & | ) | const |
Label for CFG edge.
The returned lable must include the delimiting double quotes or angle brackets and have proper escaping of contents.
|
virtual |
Label for function vertex.
The returned label must include the delimiting double quotes or angle brackets and have proper escaping of contents.